diff options
author | Benjamin Otte <otte@redhat.com> | 2011-10-16 13:41:30 -0700 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-10-16 22:32:55 -0700 |
commit | 67fc10c553ca1f4d7831a19a8bbfd5985eadc43c (patch) | |
tree | 3487ac97185f2c73a6b8bfa65a8a579bf3375003 | |
parent | 0218e8c635affca4a299cc47b03459688aba2bcf (diff) |
animation: Remove ability to create animations from GdkPixbuf
It was unused anyway, and it's a bad idea.
-rw-r--r-- | libgame/game-animation.c | 69 | ||||
-rw-r--r-- | libgame/game-animation.h | 5 |
2 files changed, 0 insertions, 74 deletions
diff --git a/libgame/game-animation.c b/libgame/game-animation.c index 3d88497..625c754 100644 --- a/libgame/game-animation.c +++ b/libgame/game-animation.c @@ -219,75 +219,6 @@ game_animation_get_type () } GameGraphic * -game_animation_new_from_file (GameGame *game, const char *filename, GError **error) -{ - GdkPixbufAnimation *anim; - - g_return_val_if_fail (GAME_IS_GAME (game), NULL); - g_return_val_if_fail (filename != NULL, NULL); - - if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { - anim = gdk_pixbuf_animation_new_from_file (filename, error); - } else { - char *s = g_build_filename (game_get_data_dir (), game->name, filename, NULL); - anim = gdk_pixbuf_animation_new_from_file (s, error); - g_free (s); - } - if (!anim) - return NULL; - - return game_animation_new_from_animation (game, anim); -} - -static void -game_animation_append_gdk_animation (GameAnimation *anim, GdkPixbufAnimation *gdkanim) -{ - GdkPixbuf *pixbuf, *start; - GdkPixbufAnimationIter *iter; - GTimeVal tv = { 0, 0 }; - int delay; - - iter = gdk_pixbuf_animation_get_iter (gdkanim, &tv); - start = pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (iter); - delay = gdk_pixbuf_animation_iter_get_delay_time (iter); - game_animation_add_image (anim, game_cairo_surface_from_pixbuf (pixbuf), delay); - while (delay >= 0) { - g_time_val_add (&tv, 1000 * delay); - gdk_pixbuf_animation_iter_advance (iter, &tv); - pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (iter); - delay = gdk_pixbuf_animation_iter_get_delay_time (iter); - /* FIXME: This is hacky because it assumes we get different images every frame */ - if (pixbuf == start) - break; - game_animation_add_image (anim, game_cairo_surface_from_pixbuf (pixbuf), delay); - } -} - -/** - * game_animation_new_from_pixbuf: - * @animation: a #GdkPixbufAnimation - takes ownership of the animation, so you - * need to ref it if you want to keep using it. - * - * Creates a graphic from a given #GdkPixbufAnimation. - * - * Returns: a newly created graphic. - **/ -GameGraphic * -game_animation_new_from_animation (GameGame *game, GdkPixbufAnimation *animation) -{ - GameGraphic *ret; - - g_return_val_if_fail (GAME_IS_GAME (game), NULL); - g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL); - - ret = GAME_GRAPHIC (game_game_add_object (game, GAME_TYPE_ANIMATION, - "width", 1.0, "height", 1.0, NULL)); - game_animation_append_gdk_animation (GAME_ANIMATION (ret), animation); - g_object_unref (animation); - return ret; -} - -GameGraphic * game_animation_new_from_files (GameGame *game, const GameRectangle *size, const char *pattern, guint delay, GError **error) { diff --git a/libgame/game-animation.h b/libgame/game-animation.h index 89d089b..60b2081 100644 --- a/libgame/game-animation.h +++ b/libgame/game-animation.h @@ -52,11 +52,6 @@ struct _GameAnimationClass { GType game_animation_get_type (void) G_GNUC_CONST; -GameGraphic * game_animation_new_from_file (GameGame * game, - const char * filename, - GError ** error); -GameGraphic * game_animation_new_from_animation(GameGame * game, - GdkPixbufAnimation * animation); GameGraphic * game_animation_new_from_files (GameGame * game, const GameRectangle * size, const char * pattern, |