summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2013-04-18 09:36:05 +0200
committerMarcin Bukat <marcin.bukat@gmail.com>2013-04-18 09:42:48 +0200
commit62cb84a57c6faa84e249e1a62e9e08af824b7ff2 (patch)
tree6c42e12a1b2201c7bf363ea7b0b9135def3d01f4 /apps/plugins
parent540e5d103f803cfd508297f483c054328c59375f (diff)
downloadrockbox-62cb84a57c6faa84e249e1a62e9e08af824b7ff2.zip
rockbox-62cb84a57c6faa84e249e1a62e9e08af824b7ff2.tar.gz
rockbox-62cb84a57c6faa84e249e1a62e9e08af824b7ff2.tar.bz2
rockbox-62cb84a57c6faa84e249e1a62e9e08af824b7ff2.tar.xz
imageviewer: fix animated gifs handling
If disposal method is set to BACKGROUND one would expect that canvas should be restored to global background color. That is what gif standard suggests. Most (all?) decoders however treat this as reseting canvas to transparency or fixed, decoder specific background color. Virtually all gifs are prepared with this in mind so to not break them we can't follow standard here. Change-Id: I90ca712bba89d4190771eb5320eabda353d3e2bb
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/imageviewer/gif/gif.c7
-rw-r--r--apps/plugins/imageviewer/gif/gif_decoder.c26
2 files changed, 10 insertions, 23 deletions
diff --git a/apps/plugins/imageviewer/gif/gif.c b/apps/plugins/imageviewer/gif/gif.c
index c3cad71..31fd11d 100644
--- a/apps/plugins/imageviewer/gif/gif.c
+++ b/apps/plugins/imageviewer/gif/gif.c
@@ -110,10 +110,9 @@ static int load_image(char *filename, struct image_info *info,
if (!iv->running_slideshow)
{
- rb->lcd_putsf(0, 2, "image %dx%d",
- p_decoder->width,
- p_decoder->height);
- rb->lcd_putsf(0, 3, "decoding %d*%d",
+ rb->lcd_putsf(0, 2, "file: %s",
+ filename);
+ rb->lcd_putsf(0, 3, "size: %dx%d",
p_decoder->width,
p_decoder->height);
rb->lcd_update();
diff --git a/apps/plugins/imageviewer/gif/gif_decoder.c b/apps/plugins/imageviewer/gif/gif_decoder.c
index 74330c3..e45814c 100644
--- a/apps/plugins/imageviewer/gif/gif_decoder.c
+++ b/apps/plugins/imageviewer/gif/gif_decoder.c
@@ -125,30 +125,18 @@ void gif_open(char *filename, struct gif_decoder *d)
d->frames_count = 0;
}
-static void set_canvas_background(GifPixelType *Line, pixel_t *out,
- GifFileType *GifFile)
+static void set_canvas_background(pixel_t *out, GifFileType *GifFile)
{
- int i;
-
/* Reading Gif spec it seems one should always use background color
* in canvas but most real files omit this and sets background color to 0
* (which IS valid index). We can choose to either conform to standard
* (and wrongly display most of gifs with transparency) or stick to
* common practise and treat background color 0 as transparent.
- * I preffer the second.
+ * Moreover when dispose method is BACKGROUND spec suggest
+ * to reset canvas to global background color specified in gif BUT
+ * all renderers I know use transparency instead.
*/
- if (GifFile->SColorMap && GifFile->SBackGroundColor != 0)
- {
- memset(Line, GifFile->SBackGroundColor, GifFile->SWidth);
-
- for(i=0; i<GifFile->SHeight; i++)
- gif2pixels(Line, out, i, 0, GifFile->SWidth);
- }
- else
- {
- memset(out, PIXEL_TRANSPARENT, PIXELS_SZ);
- }
-
+ memset(out, PIXEL_TRANSPARENT, PIXELS_SZ);
}
/* var names adhere to giflib coding style */
@@ -212,7 +200,7 @@ void gif_decode(struct gif_decoder *d,
}
/* Global background color */
- set_canvas_background(Line, pixels_buffer[0], GifFile);
+ set_canvas_background(pixels_buffer[0], GifFile);
bm.width = GifFile->SWidth;
bm.height = GifFile->SHeight;
@@ -335,7 +323,7 @@ void gif_decode(struct gif_decoder *d,
switch (GifFile->Image.GCB->DisposalMode)
{
case DISPOSE_BACKGROUND:
- set_canvas_background(Line, pixels_buffer[buf_idx],
+ set_canvas_background(pixels_buffer[buf_idx],
GifFile);
break;