diff options
author | Larry Ewing <lewing@helixcode.com> | 2000-06-06 20:37:28 +0000 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2000-06-06 20:37:28 +0000 |
commit | 93d6686ce937fadac85ada341948bfdb05c1e5dd (patch) | |
tree | 5dc56266537d79c2398bceb46f04e4839de67f74 /gdk-pixbuf/gdk-pixbuf-loader.c | |
parent | 65c1ef36ad4686fa8020eff5ed6c5061de094696 (diff) | |
download | gtk+-93d6686ce937fadac85ada341948bfdb05c1e5dd.tar.gz |
take frame offest into account when trying to calculate the animation
2000-06-06 Larry Ewing <lewing@helixcode.com>
* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
take frame offest into account when trying to calculate the
animation bbox. Also set the width to the width not the height.
(gdk_pixbuf_loader_frame_done): cycle over the frames to calculate
bbox since only now do we have all the offset information for each
frame.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf-loader.c')
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-loader.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index 5165c71bad..63b9f1c598 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -271,17 +271,17 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader) priv->animation = g_new0 (GdkPixbufAnimation, 1); priv->animation->n_frames = 0; priv->animation->ref_count = 1; - priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf); - priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf); + priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; } else { int w, h; /* update bbox size */ - w = gdk_pixbuf_get_width (frame->pixbuf); - h = gdk_pixbuf_get_height (frame->pixbuf); + w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; if (w > priv->animation->width) { - priv->animation->width = h; + priv->animation->width = w; } if (h > priv->animation->height) { priv->animation->height = h; @@ -298,6 +298,32 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader) static void gdk_pixbuf_loader_animation_done (GdkPixbuf *pixbuf, gpointer loader) { + GdkPixbufLoaderPrivate *priv = NULL; + GdkPixbufFrame *frame; + GList *current = NULL; + gint h, w; + + priv = GDK_PIXBUF_LOADER (loader)->private; + priv->pixbuf = NULL; + + current = gdk_pixbuf_animation_get_frames (priv->animation); + + while (current) { + frame = (GdkPixbufFrame *) current->data; + + /* update bbox size */ + w = gdk_pixbuf_get_width (frame->pixbuf) + frame->x_offset; + h = gdk_pixbuf_get_height (frame->pixbuf) + frame->y_offset; + + if (w > priv->animation->width) { + priv->animation->width = w; + } + if (h > priv->animation->height) { + priv->animation->height = h; + } + current = current->next; + } + gtk_signal_emit (GTK_OBJECT (loader), pixbuf_loader_signals[ANIMATION_DONE]); } |