perf(vg_lite): invert the vector font Y axis coordinate in advance (#6353)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
@@ -255,9 +255,6 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_
|
|||||||
/* scale size */
|
/* scale size */
|
||||||
vg_lite_scale(scale, scale, &matrix);
|
vg_lite_scale(scale, scale, &matrix);
|
||||||
|
|
||||||
/* Cartesian coordinates to LCD coordinates */
|
|
||||||
lv_vg_lite_matrix_flip_y(&matrix);
|
|
||||||
|
|
||||||
/* calc inverse matrix */
|
/* calc inverse matrix */
|
||||||
vg_lite_matrix_t result;
|
vg_lite_matrix_t result;
|
||||||
if(!lv_vg_lite_matrix_inverse(&result, &matrix)) {
|
if(!lv_vg_lite_matrix_inverse(&result, &matrix)) {
|
||||||
@@ -305,23 +302,28 @@ static void vg_lite_outline_push(const lv_freetype_outline_event_param_t * param
|
|||||||
|
|
||||||
lv_freetype_outline_type_t type = param->type;
|
lv_freetype_outline_type_t type = param->type;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the Y-axis coordinate direction to achieve
|
||||||
|
* the conversion from Cartesian coordinate system to LCD coordinate system
|
||||||
|
*/
|
||||||
case LV_FREETYPE_OUTLINE_END:
|
case LV_FREETYPE_OUTLINE_END:
|
||||||
lv_vg_lite_path_end(outline);
|
lv_vg_lite_path_end(outline);
|
||||||
break;
|
break;
|
||||||
case LV_FREETYPE_OUTLINE_MOVE_TO:
|
case LV_FREETYPE_OUTLINE_MOVE_TO:
|
||||||
lv_vg_lite_path_move_to(outline, param->to.x, param->to.y);
|
lv_vg_lite_path_move_to(outline, param->to.x, -param->to.y);
|
||||||
break;
|
break;
|
||||||
case LV_FREETYPE_OUTLINE_LINE_TO:
|
case LV_FREETYPE_OUTLINE_LINE_TO:
|
||||||
lv_vg_lite_path_line_to(outline, param->to.x, param->to.y);
|
lv_vg_lite_path_line_to(outline, param->to.x, -param->to.y);
|
||||||
break;
|
break;
|
||||||
case LV_FREETYPE_OUTLINE_CUBIC_TO:
|
case LV_FREETYPE_OUTLINE_CUBIC_TO:
|
||||||
lv_vg_lite_path_cubic_to(outline, param->control1.x, param->control1.y,
|
lv_vg_lite_path_cubic_to(outline, param->control1.x, -param->control1.y,
|
||||||
param->control2.x, param->control2.y,
|
param->control2.x, -param->control2.y,
|
||||||
param->to.x, param->to.y);
|
param->to.x, -param->to.y);
|
||||||
break;
|
break;
|
||||||
case LV_FREETYPE_OUTLINE_CONIC_TO:
|
case LV_FREETYPE_OUTLINE_CONIC_TO:
|
||||||
lv_vg_lite_path_quad_to(outline, param->control1.x, param->control1.y,
|
lv_vg_lite_path_quad_to(outline, param->control1.x, -param->control1.y,
|
||||||
param->to.x, param->to.y);
|
param->to.x, -param->to.y);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LV_LOG_ERROR("unknown point type: %d", type);
|
LV_LOG_ERROR("unknown point type: %d", type);
|
||||||
|
|||||||
@@ -964,11 +964,6 @@ void lv_vg_lite_matrix_multiply(vg_lite_matrix_t * matrix, const vg_lite_matrix_
|
|||||||
lv_memcpy(matrix, &temp, sizeof(temp));
|
lv_memcpy(matrix, &temp, sizeof(temp));
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_vg_lite_matrix_flip_y(vg_lite_matrix_t * matrix)
|
|
||||||
{
|
|
||||||
matrix->m[1][1] = -matrix->m[1][1];
|
|
||||||
}
|
|
||||||
|
|
||||||
bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t * matrix)
|
bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t * matrix)
|
||||||
{
|
{
|
||||||
vg_lite_float_t det00, det01, det02;
|
vg_lite_float_t det00, det01, det02;
|
||||||
|
|||||||
@@ -159,8 +159,6 @@ bool lv_vg_lite_16px_align(void);
|
|||||||
|
|
||||||
void lv_vg_lite_matrix_multiply(vg_lite_matrix_t * matrix, const vg_lite_matrix_t * mult);
|
void lv_vg_lite_matrix_multiply(vg_lite_matrix_t * matrix, const vg_lite_matrix_t * mult);
|
||||||
|
|
||||||
void lv_vg_lite_matrix_flip_y(vg_lite_matrix_t * matrix);
|
|
||||||
|
|
||||||
bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t * matrix);
|
bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t * matrix);
|
||||||
|
|
||||||
lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * matrix, const lv_point_precise_t * point);
|
lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * matrix, const lv_point_precise_t * point);
|
||||||
|
|||||||
Reference in New Issue
Block a user