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.
This commit is contained in:
Larry Ewing 2000-06-06 20:37:28 +00:00 committed by Larry Ewing
parent 65c1ef36ad
commit 93d6686ce9
3 changed files with 71 additions and 10 deletions

View File

@ -1,3 +1,12 @@
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.
2000-06-05 Mathieu Lacage <mathieu@gnome.org>
* configure.in: add some gtk parameters to the

View File

@ -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]);
}

View File

@ -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]);
}