Don't stop on empty frames. (gif_get_lzw): Handle empty frames as 1x1
2003-06-21 Matthias Clasen <maclas@gmx.de> * io-gif.c (gif_get_frame_info): Don't stop on empty frames. (gif_get_lzw): Handle empty frames as 1x1 transparent pixbufs. (#106962, Federico Mena Quintero)
This commit is contained in:
committed by
Matthias Clasen
parent
e881862b46
commit
83bda553c0
@@ -1,3 +1,9 @@
|
||||
2003-06-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-gif.c (gif_get_frame_info): Don't stop on empty frames.
|
||||
(gif_get_lzw): Handle empty frames as 1x1 transparent
|
||||
pixbufs. (#106962, Federico Mena Quintero)
|
||||
|
||||
2003-06-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-gif.c (gif_get_lzw): Correct the calls to update_func() to
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
|
||||
|
||||
#undef DUMP_IMAGE_DETAILS
|
||||
#undef IO_GIFDEBUG
|
||||
|
||||
#define MAXCOLORMAPSIZE 256
|
||||
#define MAX_LZW_BITS 12
|
||||
@@ -792,12 +793,31 @@ gif_get_lzw (GifContext *context)
|
||||
context->frame->composited = NULL;
|
||||
context->frame->revert = NULL;
|
||||
|
||||
context->frame->pixbuf =
|
||||
gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
TRUE,
|
||||
8,
|
||||
context->frame_len,
|
||||
context->frame_height);
|
||||
if (context->frame_len == 0 || context->frame_height == 0) {
|
||||
/* An empty frame, we just output a single transparent
|
||||
* pixel at (0, 0).
|
||||
*/
|
||||
context->x_offset = 0;
|
||||
context->y_offset = 0;
|
||||
context->frame_len = 1;
|
||||
context->frame_height = 1;
|
||||
context->frame->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
|
||||
if (context->frame->pixbuf) {
|
||||
guchar *pixels;
|
||||
|
||||
pixels = gdk_pixbuf_get_pixels (context->frame->pixbuf);
|
||||
pixels[0] = 0;
|
||||
pixels[1] = 0;
|
||||
pixels[2] = 0;
|
||||
pixels[3] = 0;
|
||||
}
|
||||
} else
|
||||
context->frame->pixbuf =
|
||||
gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
TRUE,
|
||||
8,
|
||||
context->frame_len,
|
||||
context->frame_height);
|
||||
if (!context->frame->pixbuf) {
|
||||
g_free (context->frame);
|
||||
g_set_error (context->error,
|
||||
@@ -1180,17 +1200,6 @@ gif_get_frame_info (GifContext *context)
|
||||
context->x_offset = LM_to_uint (buf[0], buf[1]);
|
||||
context->y_offset = LM_to_uint (buf[2], buf[3]);
|
||||
|
||||
if ((context->frame_height == 0) || (context->frame_len == 0)) {
|
||||
context->state = GIF_DONE;
|
||||
|
||||
g_set_error (context->error,
|
||||
GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
_("GIF image contained a frame with height or width 0."));
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (((context->frame_height + context->y_offset) > context->height) ||
|
||||
((context->frame_len + context->x_offset) > context->width)) {
|
||||
/* All frames must fit in the image bounds */
|
||||
|
||||
Reference in New Issue
Block a user