1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

img: imporve zoom precision

This commit is contained in:
Gabor Kiss-Vamosi 2020-08-24 10:14:01 +02:00
parent 961f295b94
commit ede6085429
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}