diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 6bc577465e..48b4bea08a 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,12 @@ +2000-06-06 Larry Ewing + + * 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. + 2000-06-05 Mathieu Lacage * configure.in: add some gtk parameters to the 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]); } diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index 5165c71bad..63b9f1c598 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/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]); }