fix(vector): fix vector graphic draw test case for amd64 (#6616)
Signed-off-by: zhangjipeng <zhangjipeng@xiaomi.com> Co-authored-by: zhangjipeng <zhangjipeng@xiaomi.com>
@ -430,7 +430,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t
|
||||
c_mult[1] = color.green * mix;
|
||||
c_mult[2] = color.red * mix;
|
||||
uint8_t * tmp_buf_2 = tmp_buf;
|
||||
for(i = 0; i < size * px_size; i += px_size) {
|
||||
for(i = 0; i < (uint32_t)(size * px_size); i += px_size) {
|
||||
tmp_buf_2[i + 0] = (c_mult[0] + (tmp_buf_2[i + 0] * mix_inv)) >> 8;
|
||||
tmp_buf_2[i + 1] = (c_mult[1] + (tmp_buf_2[i + 1] * mix_inv)) >> 8;
|
||||
tmp_buf_2[i + 2] = (c_mult[2] + (tmp_buf_2[i + 2] * mix_inv)) >> 8;
|
||||
|
@ -53,8 +53,8 @@ static void _lv_area_to_tvg(_tvg_rect * rect, const lv_area_t * area)
|
||||
{
|
||||
rect->x = area->x1;
|
||||
rect->y = area->y1;
|
||||
rect->w = lv_area_get_width(area);
|
||||
rect->h = lv_area_get_height(area);
|
||||
rect->w = lv_area_get_width(area) - 1;
|
||||
rect->h = lv_area_get_height(area) - 1;
|
||||
}
|
||||
|
||||
static void _lv_color_to_tvg(_tvg_color * color, const lv_color32_t * c, lv_opa_t opa)
|
||||
@ -423,14 +423,14 @@ void lv_draw_sw_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc
|
||||
}
|
||||
|
||||
void * buf = draw_buf->data;
|
||||
int32_t width = lv_area_get_width(&layer->buf_area);
|
||||
int32_t height = lv_area_get_height(&layer->buf_area);
|
||||
int32_t width = lv_area_get_width(&layer->buf_area) - 1;
|
||||
int32_t height = lv_area_get_height(&layer->buf_area) - 1;
|
||||
uint32_t stride = draw_buf->header.stride;
|
||||
Tvg_Canvas * canvas = tvg_swcanvas_create();
|
||||
tvg_swcanvas_set_target(canvas, buf, stride / 4, width, height, TVG_COLORSPACE_ARGB8888);
|
||||
|
||||
_tvg_rect rc;
|
||||
_lv_area_to_tvg(&rc, &layer->_clip_area);
|
||||
_lv_area_to_tvg(&rc, draw_unit->clip_area);
|
||||
tvg_canvas_set_viewport(canvas, (int32_t)rc.x, (int32_t)rc.y, (int32_t)rc.w, (int32_t)rc.h);
|
||||
|
||||
lv_ll_t * task_list = dsc->task_list;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "lv_vg_lite_grad.h"
|
||||
#include "lv_draw_vg_lite_type.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -1135,8 +1136,8 @@ lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * ma
|
||||
{
|
||||
lv_point_precise_t p;
|
||||
const vg_lite_float_t (*m)[3] = matrix->m;
|
||||
p.x = (lv_value_precise_t)(point->x * m[0][0] + point->y * m[0][1] + m[0][2]);
|
||||
p.y = (lv_value_precise_t)(point->x * m[1][0] + point->y * m[1][1] + m[1][2]);
|
||||
p.x = (lv_value_precise_t)roundf(point->x * m[0][0] + point->y * m[0][1] + m[0][2]);
|
||||
p.y = (lv_value_precise_t)roundf(point->x * m[1][0] + point->y * m[1][1] + m[1][2]);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,7 @@ static inline int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2,
|
||||
return lv_cubic_bezier(t, 341, u1, 683, u2);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the atan2 of a vector.
|
||||
* @param x
|
||||
|
@ -13,9 +13,7 @@
|
||||
|
||||
#include "../stdlib/lv_string.h"
|
||||
#include "lv_math.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
@ -182,8 +180,8 @@ bool lv_matrix_inverse(lv_matrix_t * matrix, const lv_matrix_t * m)
|
||||
lv_point_precise_t lv_matrix_transform_precise_point(const lv_matrix_t * matrix, const lv_point_precise_t * point)
|
||||
{
|
||||
lv_point_precise_t p;
|
||||
p.x = (lv_value_precise_t)(point->x * matrix->m[0][0] + point->y * matrix->m[0][1] + matrix->m[0][2]);
|
||||
p.y = (lv_value_precise_t)(point->x * matrix->m[1][0] + point->y * matrix->m[1][1] + matrix->m[1][2]);
|
||||
p.x = (lv_value_precise_t)roundf(point->x * matrix->m[0][0] + point->y * matrix->m[0][1] + matrix->m[0][2]);
|
||||
p.y = (lv_value_precise_t)roundf(point->x * matrix->m[1][0] + point->y * matrix->m[1][1] + matrix->m[1][2]);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ extern "C" {
|
||||
#include "lv_types.h"
|
||||
#include "lv_area.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.1 KiB |
BIN
tests/ref_imgs/draw/vector_draw_lines.lp32.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
tests/ref_imgs/draw/vector_draw_lines.lp64.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
BIN
tests/ref_imgs/draw/vector_draw_shapes.lp32.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
tests/ref_imgs/draw/vector_draw_shapes.lp64.png
Normal file
After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
BIN
tests/ref_imgs_vg_lite/draw/vector_draw_lines.lp32.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
BIN
tests/ref_imgs_vg_lite/draw/vector_draw_shapes.lp32.png
Normal file
After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -243,6 +243,7 @@ static void canvas_draw(const char * name, void (*draw_cb)(lv_layer_t *))
|
||||
|
||||
lv_draw_buf_clear(draw_buf, NULL);
|
||||
lv_canvas_set_draw_buf(canvas, draw_buf);
|
||||
lv_canvas_fill_bg(canvas, lv_color_make(0xff, 0xff, 0xff), 255);
|
||||
|
||||
lv_layer_t layer;
|
||||
lv_canvas_init_layer(canvas, &layer);
|
||||
@ -253,9 +254,14 @@ static void canvas_draw(const char * name, void (*draw_cb)(lv_layer_t *))
|
||||
|
||||
#ifndef NON_AMD64_BUILD
|
||||
char fn_buf[64];
|
||||
lv_snprintf(fn_buf, sizeof(fn_buf), "draw/vector_%s.png", name);
|
||||
lv_snprintf(fn_buf, sizeof(fn_buf), "draw/vector_%s.lp64.png", name);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT(fn_buf);
|
||||
#else
|
||||
char fn_buf[64];
|
||||
lv_snprintf(fn_buf, sizeof(fn_buf), "draw/vector_%s.lp32.png", name);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT(fn_buf);
|
||||
#endif
|
||||
|
||||
lv_image_cache_drop(draw_buf);
|
||||
lv_draw_buf_destroy(draw_buf);
|
||||
lv_obj_delete(canvas);
|
||||
@ -300,7 +306,6 @@ void test_draw_shapes(void)
|
||||
canvas_draw("draw_shapes", draw_shapes);
|
||||
}
|
||||
|
||||
|
||||
static void event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_layer_t * layer = lv_event_get_layer(e);
|
||||
|