mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-09 20:27:41 +08:00
feat(vg_lite): added compatibility with NXP platforms (#8642)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_VG_LITE - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build docs / build-and-deploy (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
@@ -496,6 +496,16 @@ menu "LVGL configuration"
|
||||
default 8
|
||||
depends on LV_USE_DRAW_VG_LITE
|
||||
|
||||
config LV_VG_LITE_DISABLE_VLC_OP_CLOSE
|
||||
bool "Remove VLC_OP_CLOSE path instruction (Workaround for NXP)"
|
||||
default n
|
||||
depends on LV_USE_DRAW_VG_LITE
|
||||
|
||||
config LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT
|
||||
bool "Disable linear gradient extension for some older versions of drivers."
|
||||
default n
|
||||
depends on LV_USE_DRAW_VG_LITE
|
||||
|
||||
config LV_USE_VECTOR_GRAPHIC
|
||||
bool "Use Vector Graphic APIs"
|
||||
default n
|
||||
|
||||
@@ -340,6 +340,12 @@
|
||||
|
||||
/** VG-Lite stroke maximum cache number. */
|
||||
#define LV_VG_LITE_STROKE_CACHE_CNT 32
|
||||
|
||||
/** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/
|
||||
#define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0
|
||||
|
||||
/** Disable linear gradient extension for some older versions of drivers. */
|
||||
#define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0
|
||||
#endif
|
||||
|
||||
/** Accelerate blends, fills, etc. with STM32 DMA2D */
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
|
||||
static void init_handlers(lv_draw_buf_handlers_t * handlers);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -42,8 +42,9 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
|
||||
|
||||
void lv_draw_buf_vg_lite_init_handlers(void)
|
||||
{
|
||||
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
|
||||
handlers->width_to_stride_cb = width_to_stride;
|
||||
init_handlers(lv_draw_buf_get_handlers());
|
||||
init_handlers(lv_draw_buf_get_font_handlers());
|
||||
init_handlers(lv_draw_buf_get_image_handlers());
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -55,4 +56,10 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
|
||||
return lv_vg_lite_width_to_stride(w, lv_vg_lite_vg_fmt(color_format));
|
||||
}
|
||||
|
||||
static void init_handlers(lv_draw_buf_handlers_t * handlers)
|
||||
{
|
||||
LV_ASSERT_NULL(handlers);
|
||||
handlers->width_to_stride_cb = width_to_stride;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_DRAW_VG_LITE*/
|
||||
|
||||
@@ -139,7 +139,7 @@ static void draw_execute(lv_draw_vg_lite_unit_t * u)
|
||||
/* Crop out extra pixels drawn due to scaling accuracy issues */
|
||||
lv_area_t scissor_area = layer->phy_clip_area;
|
||||
lv_area_move(&scissor_area, -layer->buf_area.x1, -layer->buf_area.y1);
|
||||
lv_vg_lite_set_scissor_area(&scissor_area);
|
||||
lv_vg_lite_set_scissor_area(u, &scissor_area);
|
||||
}
|
||||
|
||||
switch(t->type) {
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
static void draw_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_dsc,
|
||||
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area);
|
||||
|
||||
static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * dsc);
|
||||
static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * dsc, vg_lite_buffer_t * src_buf);
|
||||
|
||||
static void bitmap_cache_release_cb(void * entry, void * user_data);
|
||||
|
||||
@@ -135,6 +135,27 @@ void lv_draw_vg_lite_label(lv_draw_task_t * t, const lv_draw_label_dsc_t * dsc,
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline bool init_buffer_from_glyph_dsc(vg_lite_buffer_t * buffer, lv_font_glyph_dsc_t * g_dsc)
|
||||
{
|
||||
const void * glyph_bitmap = lv_font_get_glyph_static_bitmap(g_dsc);
|
||||
if(!glyph_bitmap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!LV_VG_LITE_IS_ALIGNED(glyph_bitmap, 16)) {
|
||||
LV_LOG_WARN("Glyph data %p is not aligned to 16 bytes", glyph_bitmap);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!LV_VG_LITE_IS_ALIGNED(g_dsc->stride, 16)) {
|
||||
LV_LOG_WARN("Glyph stride %" LV_PRIu32 " is not aligned to 16 bytes", g_dsc->stride);
|
||||
return false;
|
||||
}
|
||||
|
||||
lv_vg_lite_buffer_init(buffer, glyph_bitmap, g_dsc->box_w, g_dsc->box_h, g_dsc->stride, VG_LITE_A8, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void draw_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_dsc,
|
||||
lv_draw_fill_dsc_t * fill_draw_dsc, const lv_area_t * fill_area)
|
||||
{
|
||||
@@ -146,12 +167,22 @@ static void draw_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_
|
||||
case LV_FONT_GLYPH_FORMAT_A3:
|
||||
case LV_FONT_GLYPH_FORMAT_A4:
|
||||
case LV_FONT_GLYPH_FORMAT_A8: {
|
||||
glyph_draw_dsc->glyph_data = lv_font_get_glyph_bitmap(glyph_draw_dsc->g, glyph_draw_dsc->_draw_buf);
|
||||
if(!glyph_draw_dsc->glyph_data) {
|
||||
return;
|
||||
vg_lite_buffer_t src_buf;
|
||||
if(lv_font_has_static_bitmap(glyph_draw_dsc->g->resolved_font)) {
|
||||
if(!init_buffer_from_glyph_dsc(&src_buf, glyph_draw_dsc->g)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
glyph_draw_dsc->glyph_data = lv_font_get_glyph_bitmap(glyph_draw_dsc->g, glyph_draw_dsc->_draw_buf);
|
||||
if(!glyph_draw_dsc->glyph_data) {
|
||||
return;
|
||||
}
|
||||
|
||||
lv_vg_lite_buffer_from_draw_buf(&src_buf, glyph_draw_dsc->glyph_data);
|
||||
}
|
||||
|
||||
draw_letter_bitmap(t, glyph_draw_dsc);
|
||||
draw_letter_bitmap(t, glyph_draw_dsc, &src_buf);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -213,7 +244,7 @@ static void draw_letter_cb(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_draw_
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * dsc)
|
||||
static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * dsc, vg_lite_buffer_t * src_buf)
|
||||
{
|
||||
lv_area_t clip_area;
|
||||
lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)t->draw_unit;
|
||||
@@ -238,59 +269,28 @@ static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * d
|
||||
vg_lite_translate(-dsc->pivot.x, -dsc->g->box_h - dsc->g->ofs_y, &matrix);
|
||||
}
|
||||
|
||||
vg_lite_buffer_t src_buf;
|
||||
const lv_draw_buf_t * draw_buf = dsc->glyph_data;
|
||||
lv_vg_lite_buffer_from_draw_buf(&src_buf, draw_buf);
|
||||
|
||||
const vg_lite_color_t color = lv_vg_lite_color(dsc->color, dsc->opa, true);
|
||||
|
||||
/* If clipping is not required, blit directly */
|
||||
if(lv_area_is_in(&image_area, &t->clip_area, false)) {
|
||||
/* rect is used to crop the pixel-aligned padding area */
|
||||
vg_lite_rectangle_t rect = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.width = lv_area_get_width(&image_area),
|
||||
.height = lv_area_get_height(&image_area)
|
||||
};
|
||||
vg_lite_rectangle_t rect = {
|
||||
.x = clip_area.x1 - image_area.x1,
|
||||
.y = clip_area.y1 - image_area.y1,
|
||||
.width = lv_area_get_width(&clip_area),
|
||||
.height = lv_area_get_height(&clip_area)
|
||||
};
|
||||
|
||||
lv_vg_lite_blit_rect(
|
||||
&u->target_buffer,
|
||||
&src_buf,
|
||||
&rect,
|
||||
&matrix,
|
||||
VG_LITE_BLEND_SRC_OVER,
|
||||
color,
|
||||
VG_LITE_FILTER_LINEAR);
|
||||
/* add offset for clipped area */
|
||||
if(rect.x || rect.y) {
|
||||
vg_lite_translate(rect.x, rect.y, &matrix);
|
||||
}
|
||||
else {
|
||||
lv_vg_lite_path_t * path = lv_vg_lite_path_get(u, VG_LITE_S16);
|
||||
lv_vg_lite_path_append_rect(
|
||||
path,
|
||||
clip_area.x1, clip_area.y1,
|
||||
lv_area_get_width(&clip_area), lv_area_get_height(&clip_area),
|
||||
0);
|
||||
lv_vg_lite_path_set_bounding_box_area(path, &clip_area);
|
||||
lv_vg_lite_path_end(path);
|
||||
|
||||
vg_lite_matrix_t path_matrix = u->global_matrix;
|
||||
if(is_rotated) vg_lite_rotate(dsc->rotation / 10.0f, &path_matrix);
|
||||
|
||||
lv_vg_lite_draw_pattern(
|
||||
&u->target_buffer,
|
||||
lv_vg_lite_path_get_path(path),
|
||||
VG_LITE_FILL_EVEN_ODD,
|
||||
&path_matrix,
|
||||
&src_buf,
|
||||
&matrix,
|
||||
VG_LITE_BLEND_SRC_OVER,
|
||||
VG_LITE_PATTERN_COLOR,
|
||||
0,
|
||||
color,
|
||||
VG_LITE_FILTER_LINEAR);
|
||||
|
||||
lv_vg_lite_path_drop(u, path);
|
||||
}
|
||||
lv_vg_lite_blit_rect(
|
||||
&u->target_buffer,
|
||||
src_buf,
|
||||
&rect,
|
||||
&matrix,
|
||||
VG_LITE_BLEND_SRC_OVER,
|
||||
color,
|
||||
VG_LITE_FILTER_LINEAR);
|
||||
|
||||
/* Check if the data has cache and add it to the pending list */
|
||||
if(dsc->g->entry) {
|
||||
@@ -298,8 +298,8 @@ static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * d
|
||||
lv_cache_entry_acquire_data(dsc->g->entry);
|
||||
lv_vg_lite_pending_add(u->bitmap_font_pending, dsc->g);
|
||||
}
|
||||
else {
|
||||
/* No caching, wait for GPU finish before releasing the data */
|
||||
else if(!lv_font_has_static_bitmap(dsc->g->resolved_font)) {
|
||||
/* If there is no caching or no static bitmap is used, wait for the GPU to finish before releasing the data. */
|
||||
lv_vg_lite_finish(u);
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ static void draw_letter_outline(lv_draw_task_t * t, const lv_draw_glyph_dsc_t *
|
||||
|
||||
if(vg_lite_query_feature(gcFEATURE_BIT_VG_SCISSOR)) {
|
||||
/* set scissor area */
|
||||
lv_vg_lite_set_scissor_area(&t->clip_area);
|
||||
lv_vg_lite_set_scissor_area(u, &t->clip_area);
|
||||
|
||||
/* no bounding box */
|
||||
lv_vg_lite_path_set_bounding_box(outline,
|
||||
|
||||
@@ -41,6 +41,7 @@ struct _lv_vg_lite_grad_ctx_t;
|
||||
struct _lv_draw_vg_lite_unit_t {
|
||||
lv_draw_unit_t base_unit;
|
||||
lv_draw_task_t * task_act;
|
||||
lv_area_t current_scissor_area;
|
||||
|
||||
struct _lv_vg_lite_pending_t * image_dsc_pending;
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
|
||||
|
||||
if(vg_lite_query_feature(gcFEATURE_BIT_VG_SCISSOR)) {
|
||||
/* set scissor area */
|
||||
lv_vg_lite_set_scissor_area(&scissor_area);
|
||||
lv_vg_lite_set_scissor_area(u, &scissor_area);
|
||||
LV_LOG_TRACE("Set scissor area: X1:%" LV_PRId32 ", Y1:%" LV_PRId32 ", X2:%" LV_PRId32 ", Y2:%" LV_PRId32,
|
||||
scissor_area.x1, scissor_area.y1, scissor_area.x2, scissor_area.y2);
|
||||
}
|
||||
|
||||
@@ -628,7 +628,11 @@ static bool radial_grad_create(grad_item_t * item, vg_lite_color_ramp_t * color_
|
||||
static grad_type_t lv_grad_style_to_type(lv_vector_gradient_style_t style)
|
||||
{
|
||||
if(style == LV_VECTOR_GRADIENT_STYLE_LINEAR) {
|
||||
#if LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT
|
||||
return GRAD_TYPE_LINEAR;
|
||||
#else
|
||||
return vg_lite_query_feature(gcFEATURE_BIT_VG_LINEAR_GRADIENT_EXT) ? GRAD_TYPE_LINEAR_EXT : GRAD_TYPE_LINEAR;
|
||||
#endif
|
||||
}
|
||||
|
||||
if(style == LV_VECTOR_GRADIENT_STYLE_RADIAL) {
|
||||
|
||||
@@ -398,8 +398,12 @@ void lv_vg_lite_path_cubic_to(lv_vg_lite_path_t * path,
|
||||
void lv_vg_lite_path_close(lv_vg_lite_path_t * path)
|
||||
{
|
||||
LV_ASSERT_NULL(path);
|
||||
#if LV_VG_LITE_DISABLE_VLC_OP_CLOSE
|
||||
LV_UNUSED(path);
|
||||
#else
|
||||
lv_vg_lite_path_reserve_space(path, 1 * path->format_len);
|
||||
lv_vg_lite_path_append_op(path, VLC_OP_CLOSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_vg_lite_path_end(lv_vg_lite_path_t * path)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "lv_vg_lite_pending.h"
|
||||
#include "lv_vg_lite_grad.h"
|
||||
#include "lv_draw_vg_lite_type.h"
|
||||
#include "../../misc/lv_area_private.h"
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -718,9 +719,6 @@ void lv_vg_lite_buffer_init(
|
||||
vg_lite_buffer_format_t format,
|
||||
bool tiled)
|
||||
{
|
||||
uint32_t mul;
|
||||
uint32_t div;
|
||||
uint32_t align;
|
||||
LV_ASSERT_NULL(buffer);
|
||||
LV_ASSERT_NULL(ptr);
|
||||
|
||||
@@ -733,13 +731,26 @@ void lv_vg_lite_buffer_init(
|
||||
else {
|
||||
buffer->tiled = VG_LITE_LINEAR;
|
||||
}
|
||||
buffer->image_mode = VG_LITE_NORMAL_IMAGE_MODE;
|
||||
|
||||
if(buffer->tiled) {
|
||||
LV_ASSERT_FORMAT_MSG(LV_VG_LITE_IS_ALIGNED(width, 4) &&
|
||||
LV_VG_LITE_IS_ALIGNED(height, 4),
|
||||
"width : %" LV_PRId32 ", height : %" LV_PRId32, width, height);
|
||||
}
|
||||
|
||||
/* Alpha image need to be multiplied by color */
|
||||
if(format == VG_LITE_A8 || format == VG_LITE_A4) {
|
||||
buffer->image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
}
|
||||
else {
|
||||
buffer->image_mode = VG_LITE_NORMAL_IMAGE_MODE;
|
||||
}
|
||||
|
||||
buffer->transparency_mode = VG_LITE_IMAGE_OPAQUE;
|
||||
buffer->width = width;
|
||||
buffer->height = height;
|
||||
if(stride == LV_STRIDE_AUTO) {
|
||||
lv_vg_lite_buffer_format_bytes(buffer->format, &mul, &div, &align);
|
||||
buffer->stride = LV_VG_LITE_ALIGN((buffer->width * mul / div), align);
|
||||
buffer->stride = lv_vg_lite_width_to_stride(width, buffer->format);
|
||||
}
|
||||
else {
|
||||
buffer->stride = stride;
|
||||
@@ -783,11 +794,6 @@ void lv_vg_lite_buffer_from_draw_buf(vg_lite_buffer_t * buffer, const lv_draw_bu
|
||||
lv_vg_lite_buffer_init(buffer, ptr,
|
||||
width, height, stride, format,
|
||||
lv_draw_buf_has_flag(draw_buf, LV_VG_LITE_IMAGE_FLAGS_TILED));
|
||||
|
||||
/* Alpha image need to be multiplied by color */
|
||||
if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(draw_buf->header.cf)) {
|
||||
buffer->image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc)
|
||||
@@ -1278,9 +1284,16 @@ lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * ma
|
||||
return p;
|
||||
}
|
||||
|
||||
void lv_vg_lite_set_scissor_area(const lv_area_t * area)
|
||||
void lv_vg_lite_set_scissor_area(struct _lv_draw_vg_lite_unit_t * u, const lv_area_t * area)
|
||||
{
|
||||
LV_PROFILER_DRAW_BEGIN;
|
||||
|
||||
/* Avoid setting the same scissor frequently */
|
||||
if(lv_area_is_equal(area, &u->current_scissor_area)) {
|
||||
LV_PROFILER_DRAW_END;
|
||||
return;
|
||||
}
|
||||
|
||||
#if VGLITE_RELEASE_VERSION <= VGLITE_MAKE_VERSION(4,0,57)
|
||||
/**
|
||||
* In the new version of VG-Lite, vg_lite_set_scissor no longer needs to call vg_lite_enable_scissor and
|
||||
@@ -1303,6 +1316,8 @@ void lv_vg_lite_set_scissor_area(const lv_area_t * area)
|
||||
LV_LOG_ERROR("area: %d, %d, %d, %d",
|
||||
(int)area->x1, (int)area->y1, (int)area->x2, (int)area->y2);
|
||||
});
|
||||
|
||||
u->current_scissor_area = *area;
|
||||
LV_PROFILER_DRAW_END;
|
||||
}
|
||||
|
||||
@@ -1379,6 +1394,9 @@ void lv_vg_lite_finish(struct _lv_draw_vg_lite_unit_t * u)
|
||||
/* Clear bitmap font dsc reference */
|
||||
lv_vg_lite_pending_remove_all(u->bitmap_font_pending);
|
||||
|
||||
/* Reset scissor area */
|
||||
lv_memzero(&u->current_scissor_area, sizeof(u->current_scissor_area));
|
||||
|
||||
u->flush_count = 0;
|
||||
u->letter_count = 0;
|
||||
LV_PROFILER_DRAW_END;
|
||||
|
||||
@@ -167,7 +167,7 @@ bool lv_vg_lite_matrix_inverse(vg_lite_matrix_t * result, const vg_lite_matrix_t
|
||||
|
||||
lv_point_precise_t lv_vg_lite_matrix_transform_point(const vg_lite_matrix_t * matrix, const lv_point_precise_t * point);
|
||||
|
||||
void lv_vg_lite_set_scissor_area(const lv_area_t * area);
|
||||
void lv_vg_lite_set_scissor_area(struct _lv_draw_vg_lite_unit_t * u, const lv_area_t * area);
|
||||
|
||||
void lv_vg_lite_disable_scissor(void);
|
||||
|
||||
|
||||
@@ -959,6 +959,24 @@
|
||||
#define LV_VG_LITE_STROKE_CACHE_CNT 32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/
|
||||
#ifndef LV_VG_LITE_DISABLE_VLC_OP_CLOSE
|
||||
#ifdef CONFIG_LV_VG_LITE_DISABLE_VLC_OP_CLOSE
|
||||
#define LV_VG_LITE_DISABLE_VLC_OP_CLOSE CONFIG_LV_VG_LITE_DISABLE_VLC_OP_CLOSE
|
||||
#else
|
||||
#define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Disable linear gradient extension for some older versions of drivers. */
|
||||
#ifndef LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT
|
||||
#ifdef CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT
|
||||
#define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT
|
||||
#else
|
||||
#define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** Accelerate blends, fills, etc. with STM32 DMA2D */
|
||||
|
||||
@@ -664,13 +664,19 @@ extern "C" {
|
||||
auto ctx = vg_lite_ctx::get_instance();
|
||||
TVG_CHECK_RETURN_VG_ERROR(canvas_set_target(ctx, target));
|
||||
|
||||
vg_lite_matrix_t new_matrix = *matrix;
|
||||
if(rect->x || rect->y) {
|
||||
/* simulate hardware device clipping behavior */
|
||||
vg_lite_translate(-rect->x, -rect->y, &new_matrix);
|
||||
}
|
||||
|
||||
auto shape = Shape::gen();
|
||||
TVG_CHECK_RETURN_VG_ERROR(shape_append_rect(shape, target, rect));
|
||||
TVG_CHECK_RETURN_VG_ERROR(shape->transform(matrix_conv(matrix)));
|
||||
TVG_CHECK_RETURN_VG_ERROR(shape->transform(matrix_conv(&new_matrix)));
|
||||
|
||||
auto picture = tvg::Picture::gen();
|
||||
TVG_CHECK_RETURN_VG_ERROR(picture_load(ctx, picture, source, color));
|
||||
TVG_CHECK_RETURN_VG_ERROR(picture->transform(matrix_conv(matrix)));
|
||||
TVG_CHECK_RETURN_VG_ERROR(picture->transform(matrix_conv(&new_matrix)));
|
||||
TVG_CHECK_RETURN_VG_ERROR(picture->blend(blend_method_conv(blend)));
|
||||
TVG_CHECK_RETURN_VG_ERROR(picture->composite(std::move(shape), CompositeMethod::ClipPath));
|
||||
TVG_CHECK_RETURN_VG_ERROR(ctx->canvas->push(std::move(picture)));
|
||||
@@ -2611,7 +2617,9 @@ static Result picture_load(vg_lite_ctx * ctx, std::unique_ptr<Picture> & picture
|
||||
vg_lite_color_t color)
|
||||
{
|
||||
vg_lite_uint32_t * image_buffer;
|
||||
LV_ASSERT(VG_LITE_IS_ALIGNED(source->memory, LV_VG_LITE_THORVG_BUF_ADDR_ALIGN));
|
||||
|
||||
/* At least 8-byte alignment */
|
||||
LV_ASSERT(VG_LITE_IS_ALIGNED(source->memory, 8));
|
||||
|
||||
/**
|
||||
* Since ThorVG's picture->load does not support stride,
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 94 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 92 KiB After Width: | Height: | Size: 94 KiB |
Reference in New Issue
Block a user