same as below

2000-03-29  Radek Doulik  <rodo@helixcode.com>

	* gdk-pixbuf/gdk-pixbuf-animation.c
	(gdk_pixbuf_animation_new_from_file): same as below

	* gdk-pixbuf/io-gif.c (gif_get_lzw): added update of width and
	height in GdkPixbufAnimation

2000-03-28  Radek Doulik  <rodo@helixcode.com>

	* gdk-pixbuf/io-gif.c (gif_get_lzw): test also for
	context->frame_done_func and context->anim_done_func to make
	progressive animation loading work

	* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
	added priv->pixbuf = NULL as pixbuf is now in frame (and to make
	gdk_pixbuf_loader_prepare happy)
	(gdk_pixbuf_loader_frame_done): update animation bbox

	* gdk-pixbuf/gdk-pixbuf.h: added bbox size (width, height) to
	_GdkPixbufAnimation

2000-03-27  Radek Doulik  <rodo@helixcode.com>

	* gdk-pixbuf/io-gif.c (gif_get_lzw): use frame_len and frame_width
	instead of width and height
This commit is contained in:
Radek Doulik 2000-04-03 08:59:43 +00:00 committed by Radek Doulik
parent 8a680eb75c
commit 133ab96180
6 changed files with 81 additions and 5 deletions

View File

@ -13,6 +13,33 @@
* gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_get_has_alpha): Return * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_get_has_alpha): Return
gboolean instead of int. gboolean instead of int.
2000-03-29 Radek Doulik <rodo@helixcode.com>
* gdk-pixbuf/gdk-pixbuf-animation.c
(gdk_pixbuf_animation_new_from_file): same as below
* gdk-pixbuf/io-gif.c (gif_get_lzw): added update of width and
height in GdkPixbufAnimation
2000-03-28 Radek Doulik <rodo@helixcode.com>
* gdk-pixbuf/io-gif.c (gif_get_lzw): test also for
context->frame_done_func and context->anim_done_func to make
progressive animation loading work
* gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
added priv->pixbuf = NULL as pixbuf is now in frame (and to make
gdk_pixbuf_loader_prepare happy)
(gdk_pixbuf_loader_frame_done): update animation bbox
* gdk-pixbuf/gdk-pixbuf.h: added bbox size (width, height) to
_GdkPixbufAnimation
2000-03-27 Radek Doulik <rodo@helixcode.com>
* gdk-pixbuf/io-gif.c (gif_get_lzw): use frame_len and frame_width
instead of width and height
2000-03-27 Owen Taylor <otaylor@redhat.com> 2000-03-27 Owen Taylor <otaylor@redhat.com>
* gdk-pixbuf/pixops/pixops.c: Fix problem with * gdk-pixbuf/pixops/pixops.c: Fix problem with

View File

@ -102,6 +102,8 @@ gdk_pixbuf_animation_new_from_file (const char *filename)
animation->ref_count = 1; animation->ref_count = 1;
animation->n_frames = 1; animation->n_frames = 1;
animation->frames = g_list_prepend (NULL, frame); animation->frames = g_list_prepend (NULL, frame);
animation->width = gdk_pixbuf_get_width (pixbuf);
animation->height = gdk_pixbuf_get_height (pixbuf);
} else { } else {
fseek (f, 0, SEEK_SET); fseek (f, 0, SEEK_SET);
animation = (* image_module->load_animation) (f); animation = (* image_module->load_animation) (f);

View File

@ -263,10 +263,27 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
priv = GDK_PIXBUF_LOADER (loader)->private; priv = GDK_PIXBUF_LOADER (loader)->private;
priv->pixbuf = NULL;
if (priv->animation == NULL) { if (priv->animation == NULL) {
priv->animation = g_new0 (GdkPixbufAnimation, 1); priv->animation = g_new0 (GdkPixbufAnimation, 1);
priv->animation->n_frames = 0; priv->animation->n_frames = 0;
priv->animation->ref_count = 1; priv->animation->ref_count = 1;
priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf);
priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf);
} else {
int w, h;
/* update bbox size */
w = gdk_pixbuf_get_width (frame->pixbuf);
h = gdk_pixbuf_get_height (frame->pixbuf);
if (w > priv->animation->width) {
priv->animation->width = h;
}
if (h > priv->animation->height) {
priv->animation->height = h;
}
} }
priv->animation->frames = g_list_append (priv->animation->frames, frame); priv->animation->frames = g_list_append (priv->animation->frames, frame);

View File

@ -80,6 +80,9 @@ struct _GdkPixbufAnimation {
/* List of GdkPixbufFrame structures */ /* List of GdkPixbufFrame structures */
GList *frames; GList *frames;
/* bounding box size */
int width, height;
}; };

View File

@ -669,12 +669,12 @@ gif_get_lzw (GifContext *context)
context->pixbuf = gdk_pixbuf_new (ART_PIX_RGB, context->pixbuf = gdk_pixbuf_new (ART_PIX_RGB,
context->gif89.transparent != -1, context->gif89.transparent != -1,
8, 8,
context->width, context->frame_len,
context->height); context->frame_height);
if (context->prepare_func) if (context->prepare_func)
(* context->prepare_func) (context->pixbuf, context->user_data); (* context->prepare_func) (context->pixbuf, context->user_data);
if (context->animation || context->frame_done_func) { if (context->animation || context->frame_done_func || context->anim_done_func) {
context->frame = g_new (GdkPixbufFrame, 1); context->frame = g_new (GdkPixbufFrame, 1);
context->frame->x_offset = context->x_offset; context->frame->x_offset = context->x_offset;
context->frame->y_offset = context->y_offset;; context->frame->y_offset = context->y_offset;;
@ -696,8 +696,15 @@ gif_get_lzw (GifContext *context)
} }
context->frame->pixbuf = context->pixbuf; context->frame->pixbuf = context->pixbuf;
if (context->animation) { if (context->animation) {
int w,h;
context->animation->n_frames ++; context->animation->n_frames ++;
context->animation->frames = g_list_append (context->animation->frames, context->frame); context->animation->frames = g_list_append (context->animation->frames, context->frame);
w = gdk_pixbuf_get_width (context->pixbuf);
h = gdk_pixbuf_get_height (context->pixbuf);
if (w > context->animation->width)
context->animation->width = w;
if (h > context->animation->height)
context->animation->height = h;
} }
} }
} }
@ -782,7 +789,7 @@ gif_get_lzw (GifContext *context)
} }
done: done:
/* we got enough data. there may be more (ie, newer layers) but we can quit now */ /* we got enough data. there may be more (ie, newer layers) but we can quit now */
if (context->animation) { if (context->animation || context->frame_done_func || context->anim_done_func) {
context->state = GIF_GET_NEXT_STEP; context->state = GIF_GET_NEXT_STEP;
} else } else
context->state = GIF_DONE; context->state = GIF_DONE;
@ -821,7 +828,8 @@ gif_get_lzw (GifContext *context)
} }
} }
if (context->animation && context->state == GIF_GET_NEXT_STEP) { if ((context->animation || context->frame_done_func || context->anim_done_func)
&& context->state == GIF_GET_NEXT_STEP) {
if (context->frame_done_func) if (context->frame_done_func)
(* context->frame_done_func) (context->frame, (* context->frame_done_func) (context->frame,
context->user_data); context->user_data);
@ -1210,6 +1218,8 @@ gdk_pixbuf__gif_image_load_animation (FILE *file)
context->animation->ref_count = 1; context->animation->ref_count = 1;
context->animation->n_frames = 0; context->animation->n_frames = 0;
context->animation->frames = NULL; context->animation->frames = NULL;
context->animation->width = 0;
context->animation->height = 0;
context->file = file; context->file = file;
gif_main_loop (context); gif_main_loop (context);

View File

@ -263,10 +263,27 @@ gdk_pixbuf_loader_frame_done (GdkPixbufFrame *frame, gpointer loader)
priv = GDK_PIXBUF_LOADER (loader)->private; priv = GDK_PIXBUF_LOADER (loader)->private;
priv->pixbuf = NULL;
if (priv->animation == NULL) { if (priv->animation == NULL) {
priv->animation = g_new0 (GdkPixbufAnimation, 1); priv->animation = g_new0 (GdkPixbufAnimation, 1);
priv->animation->n_frames = 0; priv->animation->n_frames = 0;
priv->animation->ref_count = 1; priv->animation->ref_count = 1;
priv->animation->width = gdk_pixbuf_get_width (frame->pixbuf);
priv->animation->height = gdk_pixbuf_get_height (frame->pixbuf);
} else {
int w, h;
/* update bbox size */
w = gdk_pixbuf_get_width (frame->pixbuf);
h = gdk_pixbuf_get_height (frame->pixbuf);
if (w > priv->animation->width) {
priv->animation->width = h;
}
if (h > priv->animation->height) {
priv->animation->height = h;
}
} }
priv->animation->frames = g_list_append (priv->animation->frames, frame); priv->animation->frames = g_list_append (priv->animation->frames, frame);