fix(refr): fix matrix rotation precision loss (#8221)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
VIFEX
2025-05-14 03:24:40 +08:00
committed by GitHub
parent 5c7d71e6af
commit 452e256da1
14 changed files with 34 additions and 7 deletions
+34 -7
View File
@@ -794,21 +794,48 @@ static void refr_configured_layer(lv_layer_t * layer)
if(rotation != LV_DISPLAY_ROTATION_0) {
lv_display_rotate_area(disp_refr, &layer->phy_clip_area);
/* The screen rotation direction defined by LVGL is opposite to the drawing angle */
/**
* The screen rotation direction defined by LVGL is opposite to the drawing angle.
* Use direct matrix assignment to reduce precision loss and improve efficiency.
*/
switch(rotation) {
case LV_DISPLAY_ROTATION_90:
lv_matrix_rotate(&layer->matrix, 270);
lv_matrix_translate(&layer->matrix, -disp_refr->ver_res, 0);
/**
* lv_matrix_rotate(&layer->matrix, 270);
* lv_matrix_translate(&layer->matrix, -disp_refr->ver_res, 0);
*/
layer->matrix.m[0][0] = 0;
layer->matrix.m[0][1] = 1;
layer->matrix.m[0][2] = 0;
layer->matrix.m[1][0] = -1;
layer->matrix.m[1][1] = 0;
layer->matrix.m[1][2] = disp_refr->ver_res;
break;
case LV_DISPLAY_ROTATION_180:
lv_matrix_rotate(&layer->matrix, 180);
lv_matrix_translate(&layer->matrix, -disp_refr->hor_res, -disp_refr->ver_res);
/**
* lv_matrix_rotate(&layer->matrix, 180);
* lv_matrix_translate(&layer->matrix, -disp_refr->hor_res, -disp_refr->ver_res);
*/
layer->matrix.m[0][0] = -1;
layer->matrix.m[0][1] = 0;
layer->matrix.m[0][2] = disp_refr->hor_res;
layer->matrix.m[1][0] = 0;
layer->matrix.m[1][1] = -1;
layer->matrix.m[1][2] = disp_refr->ver_res;
break;
case LV_DISPLAY_ROTATION_270:
lv_matrix_rotate(&layer->matrix, 90);
lv_matrix_translate(&layer->matrix, 0, -disp_refr->hor_res);
/**
* lv_matrix_rotate(&layer->matrix, 90);
* lv_matrix_translate(&layer->matrix, 0, -disp_refr->hor_res);
*/
layer->matrix.m[0][0] = 0;
layer->matrix.m[0][1] = -1;
layer->matrix.m[0][2] = disp_refr->hor_res;
layer->matrix.m[1][0] = 1;
layer->matrix.m[1][1] = 0;
layer->matrix.m[1][2] = 0;
break;
default:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB