mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
fix(draw): fix the calculation of the transformed coordinates
fixes https://forum.lvgl.io/t/inaccurate-bitmap-zoom/8858
This commit is contained in:
parent
67446a4922
commit
76de7c6b7b
@ -434,9 +434,9 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
|
||||
|
||||
lv_point_t p[4] = {
|
||||
{0, 0},
|
||||
{w - 1, 0},
|
||||
{0, h - 1},
|
||||
{w - 1, h - 1},
|
||||
{w, 0},
|
||||
{0, h},
|
||||
{w, h},
|
||||
};
|
||||
lv_point_transform(&p[0], angle, zoom, pivot);
|
||||
lv_point_transform(&p[1], angle, zoom, pivot);
|
||||
|
@ -122,8 +122,8 @@ void lv_draw_sw_transform(lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area,
|
||||
xs_step_256 = (256 * xs_diff) / (dest_w - 1);
|
||||
ys_step_256 = (256 * ys_diff) / (dest_w - 1);
|
||||
}
|
||||
int32_t xs_ups = xs1_ups + 1 * xs_step_256 / 2 / 256; /*Init. + go the center of the pixel*/
|
||||
int32_t ys_ups = ys1_ups + 1 * ys_step_256 / 2 / 256;
|
||||
int32_t xs_ups = xs1_ups;
|
||||
int32_t ys_ups = ys1_ups;
|
||||
|
||||
if(draw_dsc->antialias == 0) {
|
||||
switch(cf) {
|
||||
@ -176,7 +176,7 @@ static void rgb_no_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, l
|
||||
int32_t xs_int = xs_ups >> 8;
|
||||
int32_t ys_int = ys_ups >> 8;
|
||||
if(xs_int < 0 || xs_int >= src_w || ys_int < 0 || ys_int >= src_h) {
|
||||
abuf[x] = 0;
|
||||
abuf[x] = 0x00;
|
||||
}
|
||||
else {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user