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

fix(vg_lite): fix thorvg 32bit rendering test coordinate calculation overflow (#7052)

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
VIFEX 2024-10-15 01:36:08 +08:00 committed by GitHub
parent d2ba572e34
commit 0964feae33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,9 +25,19 @@
* DEFINES
*********************/
/* Since thorvg has an upper limit on coordinates, choose a suitable value here */
#define PATH_COORD_MAX (1 << 18)
#define PATH_COORD_MIN (-PATH_COORD_MAX)
#if LV_USE_VG_LITE_THORVG
/**
* It is found that thorvg cannot handle large coordinates well.
* When the coordinates are larger than 4096, the calculation of tvgSwRle module will overflow in 32-bit system.
* So we use FLT_MAX and FLT_MIN to write the mark to bonding_box to tell vg_lite_tvg not to add clip path to the current path.
*/
#define PATH_COORD_MAX FLT_MAX
#define PATH_COORD_MIN FLT_MIN
#else
/* 18 bits is enough to represent the coordinates of path bounding box */
#define PATH_COORD_MAX (1 << 18)
#define PATH_COORD_MIN (-PATH_COORD_MAX)
#endif
/**********************
* TYPEDEFS