fix gif image

This commit is contained in:
lixianjing 2020-01-07 15:43:25 +08:00
parent 368d90ba73
commit c57d95a57b

View File

@ -97,6 +97,17 @@ static ret_t gif_image_on_paint_self(widget_t* widget, canvas_t* c) {
h = bitmap.gif_frame_h;
y = bitmap.gif_frame_h * image->index;
#ifdef AWTK_WEB
if (image->timer_id == TK_INVALID_ID) {
image->timer_id = timer_add(gif_image_on_timer, image, 16);
}
#else
if (image->timer_id == TK_INVALID_ID && image->frames_nr > 1) {
uint32_t delay = image->delays[image->index];
image->timer_id = timer_add(gif_image_on_timer, image, delay);
}
#endif /*AWTK_WEB*/
if (vg != NULL) {
if (image_need_transform(widget)) {
vgcanvas_save(vg);
@ -112,17 +123,6 @@ static ret_t gif_image_on_paint_self(widget_t* widget, canvas_t* c) {
dst = rect_init(0, 0, widget->w, widget->h);
canvas_draw_image_scale_down(c, &bitmap, &src, &dst);
#ifdef AWTK_WEB
if (image->timer_id == TK_INVALID_ID) {
image->timer_id = timer_add(gif_image_on_timer, image, 16);
}
#else
if (image->timer_id == TK_INVALID_ID && image->frames_nr > 1) {
uint32_t delay = image->delays[image->index];
image->timer_id = timer_add(gif_image_on_timer, image, delay);
}
#endif /*AWTK_WEB*/
return RET_OK;
}