Regard gif disposal method; fix bug #18
This commit is contained in:
parent
71e61b13b2
commit
4864f04455
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION = git-20110929
|
VERSION = git-20111011
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -Wall -pedantic -O2
|
CFLAGS = -Wall -pedantic -O2
|
||||||
|
|
12
image.c
12
image.c
|
@ -137,6 +137,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) {
|
||||||
int intoffset[] = { 0, 4, 2, 1 };
|
int intoffset[] = { 0, 4, 2, 1 };
|
||||||
int intjump[] = { 8, 8, 4, 2 };
|
int intjump[] = { 8, 8, 4, 2 };
|
||||||
int transp = -1;
|
int transp = -1;
|
||||||
|
unsigned int disposal = 0, prev_disposal = 0;
|
||||||
unsigned int delay = 0;
|
unsigned int delay = 0;
|
||||||
bool err = false;
|
bool err = false;
|
||||||
|
|
||||||
|
@ -178,8 +179,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) {
|
||||||
if (delay)
|
if (delay)
|
||||||
delay = MAX(delay, MIN_GIF_DELAY);
|
delay = MAX(delay, MIN_GIF_DELAY);
|
||||||
|
|
||||||
/* TODO: handle disposal method, section 23.c.iv of
|
disposal = (unsigned int) ext[1] >> 2 & 0x7;
|
||||||
http://www.w3.org/Graphics/GIF/spec-gif89a.txt */
|
|
||||||
}
|
}
|
||||||
ext = NULL;
|
ext = NULL;
|
||||||
DGifGetExtensionNext(gif, &ext);
|
DGifGetExtensionNext(gif, &ext);
|
||||||
|
@ -219,7 +219,7 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) {
|
||||||
if (i < y || i >= y + h || j < x || j >= x + w ||
|
if (i < y || i >= y + h || j < x || j >= x + w ||
|
||||||
rows[i-y][j-x] == transp)
|
rows[i-y][j-x] == transp)
|
||||||
{
|
{
|
||||||
if (prev_frame != NULL)
|
if (prev_disposal != 2 && prev_frame != NULL)
|
||||||
*ptr = prev_frame[i * sw + j];
|
*ptr = prev_frame[i * sw + j];
|
||||||
else
|
else
|
||||||
*ptr = bgpixel;
|
*ptr = bgpixel;
|
||||||
|
@ -246,12 +246,14 @@ bool img_load_gif(img_t *img, const fileinfo_t *file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
imlib_context_set_image(im);
|
imlib_context_set_image(im);
|
||||||
prev_frame = imlib_image_get_data_for_reading_only();
|
|
||||||
|
|
||||||
imlib_image_set_format("gif");
|
imlib_image_set_format("gif");
|
||||||
if (transp >= 0)
|
if (transp >= 0)
|
||||||
imlib_image_set_has_alpha(1);
|
imlib_image_set_has_alpha(1);
|
||||||
|
|
||||||
|
if (disposal != 3)
|
||||||
|
prev_frame = imlib_image_get_data_for_reading_only();
|
||||||
|
prev_disposal = disposal;
|
||||||
|
|
||||||
if (img->multi.cnt == img->multi.cap) {
|
if (img->multi.cnt == img->multi.cap) {
|
||||||
img->multi.cap *= 2;
|
img->multi.cap *= 2;
|
||||||
img->multi.frames = (img_frame_t*)
|
img->multi.frames = (img_frame_t*)
|
||||||
|
|
Loading…
Reference in New Issue