Updates for animated image handling

This commit is contained in:
Kim Woelders 2021-12-25 17:31:46 +01:00
parent 3a93e9a92a
commit 2bbd3dc7f9
5 changed files with 14 additions and 8 deletions

View File

@ -227,7 +227,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y,
}
else
{
if (finfo.frame_flags & IMLIB_FRAME_CLEAR)
if (finfo.frame_flags & IMLIB_FRAME_DISPOSE_CLEAR)
{
bg_pm_init(0);
}
@ -266,7 +266,7 @@ progress(Imlib_Image im, char percent, int update_x, int update_y,
update_w, update_h,
up_wx, up_wy, up_ww, up_wh);
if (finfo.frame_flags & IMLIB_FRAME_CLEAR)
if (finfo.frame_flags & IMLIB_FRAME_DISPOSE_CLEAR)
XClearWindow(disp, win);
else
XClearArea(disp, win, up_wx, up_wy, up_ww, up_wh, False);

View File

@ -613,8 +613,9 @@ typedef struct {
} Imlib_Frame_Info;
/* frame info flags */
#define IMLIB_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
#define IMLIB_FRAME_CLEAR (1 << 1) /* Clear before rendering frame */
#define IMLIB_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
#define IMLIB_FRAME_DISPOSE_CLEAR (1 << 1) /* Clear before rendering next frame */
#define IMLIB_FRAME_BLEND (1 << 2) /* Blend current onto previous frame */
EAPI Imlib_Image imlib_load_image_frame(const char *file, int frame);
EAPI void imlib_image_get_frame_info(Imlib_Frame_Info * info);

View File

@ -30,8 +30,9 @@ enum _iflags {
typedef enum _iflags ImlibImageFlags;
/* Must match the ones in Imlib2.h.in */
#define FF_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
#define FF_FRAME_CLEAR (1 << 1) /* Clear before rendering frame */
#define FF_IMAGE_ANIMATED (1 << 0) /* Frames are an animated sequence */
#define FF_FRAME_DISPOSE_CLEAR (1 << 1) /* Clear before rendering next frame */
#define FF_FRAME_BLEND (1 << 2) /* Blend current onto previous frame */
typedef struct {
int left, right, top, bottom;

View File

@ -197,8 +197,8 @@ load2(ImlibImage * im, int load_data)
if (bits & 1)
transp = ext[4];
disp = (bits >> 2) & 0x7;
if (disp == 2)
im->frame_flags |= FF_FRAME_CLEAR;
if (disp == 2 || disp == 3)
im->frame_flags |= FF_FRAME_DISPOSE_CLEAR;
D(" Frame %d: disp=%d ui=%d tr=%d, delay=%d transp = #%02x\n", //
gif->ImageCount + 1, disp, (bits >> 1) & 1, bits & 1,
im->frame_delay, transp);

View File

@ -61,6 +61,10 @@ load2(ImlibImage * im, int load_data)
im->frame_x = iter.x_offset;
im->frame_y = iter.y_offset;
im->frame_delay = iter.duration;
if (iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND)
im->frame_flags |= FF_FRAME_DISPOSE_CLEAR;
if (iter.blend_method == WEBP_MUX_BLEND)
im->frame_flags |= FF_FRAME_BLEND;
D("Canvas WxH=%dx%d frame=%d/%d X,Y=%d,%d WxH=%dx%d alpha=%d T=%d dm=%d co=%d bl=%d\n", //
im->canvas_w, im->canvas_h, iter.frame_num, im->frame_count,