diff --git a/src/lv_draw/lv_img_buf.c b/src/lv_draw/lv_img_buf.c index 868116362..722fcbf73 100644 --- a/src/lv_draw/lv_img_buf.c +++ b/src/lv_draw/lv_img_buf.c @@ -455,7 +455,7 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc) dsc->tmp.img_dsc.header.w = dsc->cfg.src_w; dsc->tmp.img_dsc.header.h = dsc->cfg.src_h; - dsc->tmp.zoom_inv = (256 * 256) / dsc->cfg.zoom; + dsc->tmp.zoom_inv = ((256 * 256) << _LV_ZOOM_INV_UPSCALE) / dsc->cfg.zoom; dsc->res.opa = LV_OPA_COVER; dsc->res.color = dsc->cfg.color; diff --git a/src/lv_draw/lv_img_buf.h b/src/lv_draw/lv_img_buf.h index 29ee2b089..c80a2b907 100644 --- a/src/lv_draw/lv_img_buf.h +++ b/src/lv_draw/lv_img_buf.h @@ -49,6 +49,7 @@ extern "C" { #define LV_IMG_ZOOM_NONE 256 #define _LV_TRANSFORM_TRIGO_SHIFT 10 +#define _LV_ZOOM_INV_UPSCALE 4 /********************** * TYPEDEFS @@ -307,8 +308,8 @@ static inline bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_ ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256; } else if(dsc->cfg.angle == 0) { - xt *= dsc->tmp.zoom_inv; - yt *= dsc->tmp.zoom_inv; + xt = (xt * dsc->tmp.zoom_inv) >> _LV_ZOOM_INV_UPSCALE; + yt = (yt * dsc->tmp.zoom_inv) >> _LV_ZOOM_INV_UPSCALE; xs = xt + dsc->tmp.pivot_x_256; ys = yt + dsc->tmp.pivot_y_256; }