[project @ 2004-06-11 20:59:53 by rjw]

Bug fix for GIFs with a single broken frame. Relaxation of error conditions to display GIFs. Re-introduction of GIF details in the title bar.

svn path=/import/netsurf/; revision=963
This commit is contained in:
Richard Wilson 2004-06-11 20:59:53 +00:00
parent adb9ed58f4
commit 53ca329cc8
2 changed files with 18 additions and 14 deletions

View File

@ -123,7 +123,7 @@ BadGIF:Reading GIF failed.
PNGError:PNG library error.
DrawTitle:Draw image (%lux%lu, %lu bytes)
GIFTitle:GIF image (%lux%lu)
GIFTitle:GIF image (%lux%lu, %lu bytes)
JPEGTitle:JPEG image (%ux%u, %lu bytes)
PNGTitle:PNG image (%lux%lu)
SpriteTitle:Sprite image (%lux%lu, %lu bytes)

View File

@ -71,16 +71,17 @@ bool nsgif_convert(struct content *c, int iwidth, int iheight) {
/* Initialise the GIF
*/
res = gif_initialise(gif);
if (res < 0) {
if (res == GIF_INSUFFICIENT_MEMORY) {
switch (res) {
case GIF_INSUFFICIENT_MEMORY:
msg_data.error = messages_get("NoMemory");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
warn_user("NoMemory", 0);
} else {
return false;
case GIF_INSUFFICIENT_DATA:
case GIF_DATA_ERROR:
msg_data.error = messages_get("BadGIF");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
}
return false;
return false;
}
/* Abort on bad GIFs
@ -92,20 +93,19 @@ bool nsgif_convert(struct content *c, int iwidth, int iheight) {
return false;
}
/* Store our content width
/* Store our content width and description
*/
c->width = gif->width;
c->height = gif->height;
c->title = malloc(100);
if (c->title) {
snprintf(c->title, 100, messages_get("GIFTitle"), c->width, c->height, c->source_size);
}
/* Initialise the first frame so if we try to use the image data directly prior to
a plot we get some sensible data
*/
res = gif_decode_frame(c->data.gif.gif, 0);
if (res < 0 && res != GIF_INSUFFICIENT_FRAME_DATA) {
msg_data.error = messages_get("BadGIF");
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
return false;
}
gif_decode_frame(c->data.gif.gif, 0);
/* Schedule the animation if we have one
*/
@ -145,7 +145,11 @@ void nsgif_redraw(struct content *c, int x, int y,
if (c->data.gif.gif->loop_count == 0) {
current_frame = 0;
} else {
current_frame = c->data.gif.gif->frame_count - 1;
if (c->data.gif.gif->frame_count > 1) {
current_frame = c->data.gif.gif->frame_count - 1;
} else {
current_frame = 0;
}
}
tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
(option_dither_sprites?tinct_DITHER:0);