Compare commits
97 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74d0a816a4 | ||
|
|
8194d83226 | ||
|
|
1840decb41 | ||
|
|
ef76206c75 | ||
|
|
4fdc4c20b7 | ||
|
|
85776aeec3 | ||
|
|
d20bd1ca39 | ||
|
|
c16bfdc227 | ||
|
|
3b6f98a938 | ||
|
|
6c86969ee0 | ||
|
|
fdfff5c0b8 | ||
|
|
2791d5739f | ||
|
|
68d380eb90 | ||
|
|
20b6199ba9 | ||
|
|
7efcea6d08 | ||
|
|
7f894cf755 | ||
|
|
fa40b05191 | ||
|
|
17c580fad6 | ||
|
|
454e45429c | ||
|
|
9fbac7570b | ||
|
|
1e381f11bf | ||
|
|
d22cda3cdb | ||
|
|
869cc63003 | ||
|
|
73fa50afa0 | ||
|
|
7a8fcbfd34 | ||
|
|
7568df77d1 | ||
|
|
9a673e447d | ||
|
|
3b2d75be02 | ||
|
|
87ff746e21 | ||
|
|
14e21d27fb | ||
|
|
ff4f3f9769 | ||
|
|
a7a9d278c4 | ||
|
|
06e229cc76 | ||
|
|
9e388055ec | ||
|
|
eb87767cc6 | ||
|
|
01cd1fed9d | ||
|
|
28094404ad | ||
|
|
e2b19eb4ac | ||
|
|
bff1f22970 | ||
|
|
9787d47d0b | ||
|
|
6548ea0f29 | ||
|
|
1375ea85a1 | ||
|
|
a296456591 | ||
|
|
336f24127a | ||
|
|
1c5df6c665 | ||
|
|
7d314aab62 | ||
|
|
fd21ed0eb8 | ||
|
|
5fc488a088 | ||
|
|
f174589240 | ||
|
|
bcebafe4fb | ||
|
|
8063fac793 | ||
|
|
9ec3b8706b | ||
|
|
bdf5bfb88c | ||
|
|
4f102d7b6b | ||
|
|
810852b41b | ||
|
|
21e95bc1b3 | ||
|
|
dbcf56288e | ||
|
|
eee2dd1864 | ||
|
|
141f4b8ab3 | ||
|
|
f9ffcc9d8e | ||
|
|
385d999a4a | ||
|
|
29ed7c5717 | ||
|
|
65f1c9305e | ||
|
|
b1bbb95ceb | ||
|
|
223dc1cf9d | ||
|
|
416b26771b | ||
|
|
645006e351 | ||
|
|
375b3b5d3e | ||
|
|
1c5d4b02d7 | ||
|
|
e6d7be00bf | ||
|
|
15433d69b9 | ||
|
|
91038a99e8 | ||
|
|
9491c3ff6d | ||
|
|
3de61c76af | ||
|
|
09cc0de573 | ||
|
|
227ac02341 | ||
|
|
8b83fe7ea5 | ||
|
|
edd5ad28ad | ||
|
|
07bce7466d | ||
|
|
1713cd3fd8 | ||
|
|
cb602ea778 | ||
|
|
caf29ef0c5 | ||
|
|
a3199514ab | ||
|
|
78cbdfc151 | ||
|
|
75e6ef4e1d | ||
|
|
2376c57860 | ||
|
|
e3659c46b1 | ||
|
|
df96b57f4e | ||
|
|
67b3011f83 | ||
|
|
d87737612a | ||
|
|
6a89bd2d74 | ||
|
|
6843c191b7 | ||
|
|
1caafc55dd | ||
|
|
5ba90a5c41 | ||
|
|
630da9c6ca | ||
|
|
ee95e7dc25 | ||
|
|
45b13c378f |
28
Kconfig
28
Kconfig
@@ -228,6 +228,16 @@ menu "LVGL configuration"
|
||||
Must be defined to include path of CMSIS header of target processor
|
||||
e.g. "stm32f769xx.h" or "stm32f429xx.h"
|
||||
|
||||
config LV_USE_GPU_RA6M3_G2D
|
||||
bool "Enable RA6M3 G2D GPU."
|
||||
config LV_GPU_RA6M3_G2D_INCLUDE
|
||||
string "include path of target processor"
|
||||
depends on LV_USE_GPU_RA6M3_G2D
|
||||
default "hal_data.h"
|
||||
help
|
||||
Must be defined to include path of target processor
|
||||
e.g. "hal_data.h"
|
||||
|
||||
config LV_USE_GPU_SWM341_DMA2D
|
||||
bool "Enable SWM341 DMA2D GPU."
|
||||
config LV_GPU_SWM341_DMA2D_INCLUDE
|
||||
@@ -954,6 +964,17 @@ menu "LVGL configuration"
|
||||
default 0
|
||||
depends on LV_USE_FS_FATFS
|
||||
|
||||
config LV_USE_FS_LITTLEFS
|
||||
bool "File system on top of LittleFS"
|
||||
config LV_FS_LITTLEFS_LETTER
|
||||
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
|
||||
default 0
|
||||
depends on LV_USE_FS_LITTLEFS
|
||||
config LV_FS_LITTLEFS_CACHE_SIZE
|
||||
int ">0 to cache this number of bytes in lv_fs_read()"
|
||||
default 0
|
||||
depends on LV_USE_FS_LITTLEFS
|
||||
|
||||
config LV_USE_PNG
|
||||
bool "PNG decoder library"
|
||||
|
||||
@@ -990,6 +1011,13 @@ menu "LVGL configuration"
|
||||
endmenu
|
||||
endif
|
||||
|
||||
config LV_USE_TINY_TTF
|
||||
bool "Tiny TTF library"
|
||||
config LV_TINY_TTF_FILE_SUPPORT
|
||||
bool "Load TTF data from files"
|
||||
depends on LV_USE_TINY_TTF
|
||||
default n
|
||||
|
||||
config LV_USE_RLOTTIE
|
||||
bool "Lottie library"
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ LV_FONT_DECLARE(lv_font_benchmark_montserrat_16_compr_az);
|
||||
LV_FONT_DECLARE(lv_font_benchmark_montserrat_28_compr_az);
|
||||
|
||||
static void monitor_cb(lv_disp_drv_t * drv, uint32_t time, uint32_t px);
|
||||
static void scene_next_task_cb(lv_timer_t * timer);
|
||||
static void next_scene_timer_cb(lv_timer_t * timer);
|
||||
static void rect_create(lv_style_t * style);
|
||||
static void img_create(lv_style_t * style, const void * src, bool rotate, bool zoom, bool aa);
|
||||
static void txt_create(lv_style_t * style);
|
||||
@@ -636,7 +636,7 @@ static lv_obj_t * scene_bg;
|
||||
static lv_obj_t * title;
|
||||
static lv_obj_t * subtitle;
|
||||
static uint32_t rnd_act;
|
||||
|
||||
static lv_timer_t * next_scene_timer;
|
||||
|
||||
static const uint32_t rnd_map[] = {
|
||||
0xbd13204f, 0x67d8167f, 0x20211c99, 0xb0a7cc05,
|
||||
@@ -708,9 +708,21 @@ void lv_demo_benchmark(void)
|
||||
benchmark_init();
|
||||
|
||||
/*Manually start scenes*/
|
||||
scene_next_task_cb(NULL);
|
||||
next_scene_timer_cb(NULL);
|
||||
}
|
||||
|
||||
void lv_demo_benchmark_close(void)
|
||||
{
|
||||
if(next_scene_timer) lv_timer_del(next_scene_timer);
|
||||
next_scene_timer = NULL;
|
||||
|
||||
lv_anim_del(NULL, NULL);
|
||||
|
||||
lv_style_reset(&style_common);
|
||||
|
||||
lv_obj_clean(lv_scr_act());
|
||||
|
||||
}
|
||||
|
||||
void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
||||
{
|
||||
@@ -973,11 +985,13 @@ static void report_cb(lv_timer_t * timer)
|
||||
}
|
||||
}
|
||||
|
||||
static void scene_next_task_cb(lv_timer_t * timer)
|
||||
static void next_scene_timer_cb(lv_timer_t * timer)
|
||||
{
|
||||
LV_UNUSED(timer);
|
||||
lv_obj_clean(scene_bg);
|
||||
|
||||
next_scene_timer = NULL;
|
||||
|
||||
if(opa_mode) {
|
||||
if(scene_act >= 0) {
|
||||
if(scenes[scene_act].time_sum_opa == 0) scenes[scene_act].time_sum_opa = 1;
|
||||
@@ -1014,8 +1028,8 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
||||
|
||||
rnd_reset();
|
||||
scenes[scene_act].create_cb();
|
||||
lv_timer_t * t = lv_timer_create(scene_next_task_cb, SCENE_TIME, NULL);
|
||||
lv_timer_set_repeat_count(t, 1);
|
||||
next_scene_timer = lv_timer_create(next_scene_timer_cb, SCENE_TIME, NULL);
|
||||
lv_timer_set_repeat_count(next_scene_timer, 1);
|
||||
|
||||
}
|
||||
/*Ready*/
|
||||
|
||||
@@ -30,6 +30,8 @@ typedef void finished_cb_t(void);
|
||||
**********************/
|
||||
void lv_demo_benchmark(void);
|
||||
|
||||
void lv_demo_benchmark_close(void);
|
||||
|
||||
void lv_demo_benchmark_run_scene(int_fast16_t scene_no);
|
||||
|
||||
void lv_demo_benchmark_set_finished_cb(finished_cb_t * finished_cb);
|
||||
|
||||
@@ -46,8 +46,11 @@ static lv_obj_t * t2;
|
||||
|
||||
void lv_demo_keypad_encoder(void)
|
||||
{
|
||||
g = lv_group_create();
|
||||
lv_group_set_default(g);
|
||||
g = lv_group_get_default();
|
||||
if(g == NULL) {
|
||||
g = lv_group_create();
|
||||
lv_group_set_default(g);
|
||||
}
|
||||
|
||||
lv_indev_t * cur_drv = NULL;
|
||||
for(;;) {
|
||||
@@ -76,6 +79,12 @@ void lv_demo_keypad_encoder(void)
|
||||
msgbox_create();
|
||||
}
|
||||
|
||||
void lv_demo_keypad_encoder_close(void)
|
||||
{
|
||||
lv_obj_clean(lv_scr_act());
|
||||
lv_obj_clean(lv_layer_top());
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -27,6 +27,7 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_demo_keypad_encoder(void);
|
||||
void lv_demo_keypad_encoder_close(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -103,6 +103,12 @@ static const uint32_t time_list[] = {
|
||||
2 * 60 + 19,
|
||||
};
|
||||
|
||||
#if LV_DEMO_MUSIC_AUTO_PLAY
|
||||
static lv_timer_t * auto_step_timer;
|
||||
#endif
|
||||
|
||||
static lv_color_t original_screen_bg_color;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -113,16 +119,33 @@ static const uint32_t time_list[] = {
|
||||
|
||||
void lv_demo_music(void)
|
||||
{
|
||||
original_screen_bg_color = lv_obj_get_style_bg_color(lv_scr_act(), 0);
|
||||
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x343247), 0);
|
||||
|
||||
list = _lv_demo_music_list_create(lv_scr_act());
|
||||
ctrl = _lv_demo_music_main_create(lv_scr_act());
|
||||
|
||||
#if LV_DEMO_MUSIC_AUTO_PLAY
|
||||
lv_timer_create(auto_step_cb, 1000, NULL);
|
||||
auto_step_timer = lv_timer_create(auto_step_cb, 1000, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_demo_music_close(void)
|
||||
{
|
||||
/*Delete all aniamtions*/
|
||||
lv_anim_del(NULL, NULL);
|
||||
|
||||
#if LV_DEMO_MUSIC_AUTO_PLAY
|
||||
lv_timer_del(auto_step_timer);
|
||||
#endif
|
||||
_lv_demo_music_list_close();
|
||||
_lv_demo_music_main_close();
|
||||
|
||||
lv_obj_clean(lv_scr_act());
|
||||
|
||||
lv_obj_set_style_bg_color(lv_scr_act(), original_screen_bg_color, 0);
|
||||
}
|
||||
|
||||
const char * _lv_demo_music_get_title(uint32_t track_id)
|
||||
{
|
||||
if(track_id >= sizeof(title_list) / sizeof(title_list[0])) return NULL;
|
||||
|
||||
@@ -36,6 +36,8 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
void lv_demo_music(void);
|
||||
void lv_demo_music_close(void);
|
||||
|
||||
const char * _lv_demo_music_get_title(uint32_t track_id);
|
||||
const char * _lv_demo_music_get_artist(uint32_t track_id);
|
||||
const char * _lv_demo_music_get_genre(uint32_t track_id);
|
||||
|
||||
@@ -130,6 +130,19 @@ lv_obj_t * _lv_demo_music_list_create(lv_obj_t * parent)
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
void _lv_demo_music_list_close(void)
|
||||
{
|
||||
lv_style_reset(&style_scrollbar);
|
||||
lv_style_reset(&style_btn);
|
||||
lv_style_reset(&style_btn_pr);
|
||||
lv_style_reset(&style_btn_chk);
|
||||
lv_style_reset(&style_btn_dis);
|
||||
lv_style_reset(&style_title);
|
||||
lv_style_reset(&style_artist);
|
||||
lv_style_reset(&style_time);
|
||||
}
|
||||
|
||||
void _lv_demo_music_list_btn_check(uint32_t track_id, bool state)
|
||||
{
|
||||
lv_obj_t * btn = lv_obj_get_child(list, track_id);
|
||||
|
||||
@@ -28,6 +28,8 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
lv_obj_t * _lv_demo_music_list_create(lv_obj_t * parent);
|
||||
void _lv_demo_music_list_close(void);
|
||||
|
||||
void _lv_demo_music_list_btn_check(uint32_t track_id, bool state);
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -60,7 +60,7 @@ static void prev_click_event_cb(lv_event_t * e);
|
||||
static void next_click_event_cb(lv_event_t * e);
|
||||
static void timer_cb(lv_timer_t * t);
|
||||
static void track_load(uint32_t id);
|
||||
static void stop_start_anim(lv_timer_t * t);
|
||||
static void stop_start_anim_timer_cb(lv_timer_t * t);
|
||||
static void spectrum_end_cb(lv_anim_t * a);
|
||||
static void album_fade_anim_cb(void * var, int32_t v);
|
||||
static int32_t get_cos(int32_t deg, int32_t a);
|
||||
@@ -84,6 +84,7 @@ static uint32_t spectrum_lane_ofs_start = 0;
|
||||
static uint32_t bar_rot = 0;
|
||||
static uint32_t time_act;
|
||||
static lv_timer_t * sec_counter_timer;
|
||||
static lv_timer_t * stop_start_anim_timer;
|
||||
static const lv_font_t * font_small;
|
||||
static const lv_font_t * font_large;
|
||||
static uint32_t track_id;
|
||||
@@ -232,8 +233,8 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
||||
|
||||
start_anim = true;
|
||||
|
||||
lv_timer_t * timer = lv_timer_create(stop_start_anim, INTRO_TIME + 6000, NULL);
|
||||
lv_timer_set_repeat_count(timer, 1);
|
||||
stop_start_anim_timer = lv_timer_create(stop_start_anim_timer_cb, INTRO_TIME + 6000, NULL);
|
||||
lv_timer_set_repeat_count(stop_start_anim_timer, 1);
|
||||
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_bounce);
|
||||
@@ -292,6 +293,12 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
|
||||
return main_cont;
|
||||
}
|
||||
|
||||
void _lv_demo_music_main_close(void)
|
||||
{
|
||||
if(stop_start_anim_timer) lv_timer_del(stop_start_anim_timer);
|
||||
lv_timer_del(sec_counter_timer);
|
||||
}
|
||||
|
||||
void _lv_demo_music_album_next(bool next)
|
||||
{
|
||||
uint32_t id = track_id;
|
||||
@@ -762,7 +769,7 @@ static void spectrum_draw_event_cb(lv_event_t * e)
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_draw_ctx_t * draw_ctx = lv_event_get_draw_ctx(e);
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, LV_PART_MAIN);
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN);
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
|
||||
lv_point_t poly[4];
|
||||
@@ -990,10 +997,11 @@ static void spectrum_end_cb(lv_anim_t * a)
|
||||
}
|
||||
|
||||
|
||||
static void stop_start_anim(lv_timer_t * t)
|
||||
static void stop_start_anim_timer_cb(lv_timer_t * t)
|
||||
{
|
||||
LV_UNUSED(t);
|
||||
start_anim = false;
|
||||
stop_start_anim_timer = NULL;
|
||||
lv_obj_refresh_ext_draw_size(spectrum_obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent);
|
||||
void _lv_demo_music_main_close(void);
|
||||
|
||||
void _lv_demo_music_play(uint32_t id);
|
||||
void _lv_demo_music_resume(void);
|
||||
void _lv_demo_music_pause(void);
|
||||
|
||||
@@ -25,7 +25,7 @@ static void msgbox_del(lv_timer_t * tmr);
|
||||
static void set_y_anim(void * obj, int32_t v);
|
||||
static void set_width_anim(void * obj, int32_t v);
|
||||
static void arc_set_end_angle_anim(void * obj, int32_t v);
|
||||
static void obj_test_task_cb(lv_timer_t * tmr);
|
||||
static void obj_test_timer_cb(lv_timer_t * tmr);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -34,6 +34,10 @@ static lv_obj_t * main_page;
|
||||
static lv_obj_t * ta;
|
||||
static const char * mbox_btns[] = {"Ok", "Cancel", ""};
|
||||
static uint32_t mem_free_start = 0;
|
||||
static lv_timer_t * obj_test_timer;
|
||||
static int16_t state;
|
||||
static lv_timer_t * msgbox_tmr;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -45,23 +49,34 @@ static uint32_t mem_free_start = 0;
|
||||
void lv_demo_stress(void)
|
||||
{
|
||||
LV_LOG_USER("Starting stress test. (< 100 bytes permanent memory leak is normal due to fragmentation)");
|
||||
lv_timer_create(obj_test_task_cb, LV_DEMO_STRESS_TIME_STEP, NULL);
|
||||
obj_test_timer = lv_timer_create(obj_test_timer_cb, LV_DEMO_STRESS_TIME_STEP, NULL);
|
||||
state = -1;
|
||||
}
|
||||
|
||||
void lv_demo_stress_close(void)
|
||||
{
|
||||
lv_timer_del(obj_test_timer);
|
||||
obj_test_timer = NULL;
|
||||
if(msgbox_tmr) {
|
||||
lv_timer_del(msgbox_tmr);
|
||||
msgbox_tmr = NULL;
|
||||
}
|
||||
|
||||
lv_obj_clean(lv_scr_act());
|
||||
lv_obj_clean(lv_layer_top());
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
static void obj_test_timer_cb(lv_timer_t * tmr)
|
||||
{
|
||||
(void) tmr; /*Unused*/
|
||||
static int16_t state = -1;
|
||||
|
||||
lv_anim_t a;
|
||||
lv_obj_t * obj;
|
||||
|
||||
// printf("step start: %d\n", state);
|
||||
|
||||
switch(state) {
|
||||
case -1: {
|
||||
lv_res_t res = lv_mem_test();
|
||||
@@ -246,8 +261,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
|
||||
case 14:
|
||||
obj = lv_msgbox_create(NULL, "Title", "Some text on the message box with average length", mbox_btns, true);
|
||||
|
||||
lv_timer_t * msgbox_tmr = lv_timer_create(msgbox_del, LV_DEMO_STRESS_TIME_STEP * 5 + 30, obj);
|
||||
msgbox_tmr = lv_timer_create(msgbox_del, LV_DEMO_STRESS_TIME_STEP * 5 + 30, obj);
|
||||
lv_timer_set_repeat_count(msgbox_tmr, 1);
|
||||
lv_obj_align(obj, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
break;
|
||||
@@ -439,6 +453,7 @@ static void auto_del(lv_obj_t * obj, uint32_t delay)
|
||||
|
||||
static void msgbox_del(lv_timer_t * tmr)
|
||||
{
|
||||
msgbox_tmr = NULL;
|
||||
lv_msgbox_close(tmr->user_data);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ extern "C" {
|
||||
**********************/
|
||||
void lv_demo_stress(void);
|
||||
|
||||
void lv_demo_stress_close(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -86,6 +86,8 @@ static uint32_t session_desktop = 1000;
|
||||
static uint32_t session_tablet = 1000;
|
||||
static uint32_t session_mobile = 1000;
|
||||
|
||||
static lv_timer_t * meter2_timer;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -196,6 +198,22 @@ void lv_demo_widgets(void)
|
||||
color_changer_create(tv);
|
||||
}
|
||||
|
||||
void lv_demo_widgets_close(void)
|
||||
{
|
||||
/*Delete all animation*/
|
||||
lv_anim_del(NULL, NULL);
|
||||
|
||||
lv_timer_del(meter2_timer);
|
||||
meter2_timer = NULL;
|
||||
|
||||
lv_obj_clean(lv_scr_act());
|
||||
|
||||
lv_style_reset(&style_text_muted);
|
||||
lv_style_reset(&style_title);
|
||||
lv_style_reset(&style_icon);
|
||||
lv_style_reset(&style_bullet);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -205,6 +223,7 @@ static void profile_create(lv_obj_t * parent)
|
||||
lv_obj_t * panel1 = lv_obj_create(parent);
|
||||
lv_obj_set_height(panel1, LV_SIZE_CONTENT);
|
||||
|
||||
|
||||
LV_IMG_DECLARE(img_demo_widgets_avatar);
|
||||
lv_obj_t * avatar = lv_img_create(panel1);
|
||||
lv_img_set_src(avatar, &img_demo_widgets_avatar);
|
||||
@@ -698,7 +717,7 @@ static void analytics_create(lv_obj_t * parent)
|
||||
lv_meter_set_indicator_start_value(meter2, meter2_indic[2], 70);
|
||||
lv_meter_set_indicator_end_value(meter2, meter2_indic[2], 99);
|
||||
|
||||
lv_timer_create(meter2_timer_cb, 100, meter2_indic);
|
||||
meter2_timer = lv_timer_create(meter2_timer_cb, 100, meter2_indic);
|
||||
|
||||
meter3 = create_meter_box(parent, "Network Speed", "Low speed", "Normal Speed", "High Speed");
|
||||
if(disp_size < DISP_LARGE) lv_obj_add_flag(lv_obj_get_parent(meter3), LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
|
||||
|
||||
@@ -27,6 +27,7 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_demo_widgets(void);
|
||||
void lv_demo_widgets_close(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -1,5 +1,170 @@
|
||||
# Changelog
|
||||
|
||||
## [v8.3.11](https://github.com/lvgl/lvgl/compare/v8.3.11...v8.3.10) 6 December 2023
|
||||
|
||||
### New Features
|
||||
|
||||
- feat(table): add user_data to table cells [`4767`](https://github.com/lvgl/lvgl/pull/4767)
|
||||
- feat(tiny_ttf): backport Tiny TTF to lvgl 8 [`4727`](https://github.com/lvgl/lvgl/pull/4727)
|
||||
- feat(littlefs): add lv_fs_littlefs system as a driver [`4677`](https://github.com/lvgl/lvgl/pull/4677)
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix(obj): readjust scroll after layout when child removed [`4921`](https://github.com/lvgl/lvgl/pull/4921)
|
||||
- fix(rt-thread): fix create lvgl thread problem [`4862`](https://github.com/lvgl/lvgl/pull/4862)
|
||||
- fix(obj): fix arduino compile warnings [`4807`](https://github.com/lvgl/lvgl/pull/4807)
|
||||
- fix(table):fix issue with abnormal string output of 'lv_table_set_cell_value_fmt' [`4804`](https://github.com/lvgl/lvgl/pull/4804)
|
||||
- fix(table) user data API functions renamed [`4769`](https://github.com/lvgl/lvgl/pull/4769)
|
||||
- fix(ime_pinyin): keep cursor in the textarea when a candidate is pressed [`4731`](https://github.com/lvgl/lvgl/pull/4731)
|
||||
- fix(draw_needles): changed needle line draw start point from scale ce… [`4682`](https://github.com/lvgl/lvgl/pull/4682)
|
||||
- fix(arc): handle click outside background angle range (#4586) [`4667`](https://github.com/lvgl/lvgl/pull/4667)
|
||||
- fix(meter): fix minor issues [`4657`](https://github.com/lvgl/lvgl/pull/4657)
|
||||
- fix(draw): fix compiler error in lv_draw_sw_transform.c #2 [`4612`](https://github.com/lvgl/lvgl/pull/4612)
|
||||
- fix(dropdown): avoid partial match in lv_dropdown_get_option_index [`4598`](https://github.com/lvgl/lvgl/pull/4598)
|
||||
- fix(dropdown): reset char_i = 0, avoid access overflow [`4589`](https://github.com/lvgl/lvgl/pull/4589)
|
||||
- fix(btnmatrix): set LV_BTNMATRIX_BTN_NONE when clicking of disabled button (#4571) [`4578`](https://github.com/lvgl/lvgl/pull/4578)
|
||||
- fix(qrcode): use LV_ASSERT instead of assert [`1840dec`](https://github.com/lvgl/lvgl/commit/1840decb4136ba01552fcb7cedb0ff759824e2fd)
|
||||
- fix: fix warning in lv_draw_sw_letter.c [`d22cda3`](https://github.com/lvgl/lvgl/commit/d22cda3cdb15cee95763491db95753980846d9f9)
|
||||
- fix(arc): fix setting value by click [`20b6199`](https://github.com/lvgl/lvgl/commit/20b6199ba90319942c3cd91f2c727da6cd40cd2d)
|
||||
- fix(disp): fix infinite recursive SCREEN_LOADED events [`ef76206`](https://github.com/lvgl/lvgl/commit/ef76206c75ea9de26407534a9ce1079dc8e750e3)
|
||||
- fix(keyboard): add '&' character [`d20bd1c`](https://github.com/lvgl/lvgl/commit/d20bd1ca397ff954167dd496cf1a78da8814f602)
|
||||
- fix(draw): fix scaling rectangle parts with opa [`7a8fcbf`](https://github.com/lvgl/lvgl/commit/7a8fcbfd3458739cbe64b29767a969ece9542039)
|
||||
|
||||
### Docs
|
||||
|
||||
- docs(obj): fix wording [`4625`](https://github.com/lvgl/lvgl/pull/4625)
|
||||
- docs(label): update text for recoloring [`4606`](https://github.com/lvgl/lvgl/pull/4606)
|
||||
- docs: fix typo [`9fbac75`](https://github.com/lvgl/lvgl/commit/9fbac7570bdec18ddbb157b59f5e26a2ebdf5daf)
|
||||
|
||||
### Others
|
||||
|
||||
- chore(cmsis-pack): prepare for v8.3.11 [`4936`](https://github.com/lvgl/lvgl/pull/4936)
|
||||
- chore(cmake): add support for user-specified lv_conf.h path [`4689`](https://github.com/lvgl/lvgl/pull/4689)
|
||||
- STM32U5 DMA2D support (8.3) [`4643`](https://github.com/lvgl/lvgl/pull/4643)
|
||||
- backport: fix(lv_disp): fix lv_scr_load_anim being called twice quickly [`4629`](https://github.com/lvgl/lvgl/pull/4629)
|
||||
- chore(lv_draw_sw_letter.c): Fix print format [`4615`](https://github.com/lvgl/lvgl/pull/4615)
|
||||
- chore: fix compile error [`7568df7`](https://github.com/lvgl/lvgl/commit/7568df77d16ecbf2242b2bc290dc8fc0eb29cf5a)
|
||||
|
||||
## [v8.3.10](https://github.com/lvgl/lvgl/compare/v8.3.10...v8.3.9) 20 September 2023
|
||||
|
||||
### New Features
|
||||
|
||||
- feat(disp): add double buffered direct-mode efficient sync algorithm (v8.3) [`4497`](https://github.com/lvgl/lvgl/pull/4497)
|
||||
- feat(style): backport opa_layered [`6548ea0`](https://github.com/lvgl/lvgl/commit/6548ea0f291be8a97afb3c4d7dcabbe465ae5a04)
|
||||
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix: build on Windows (MinGW environment) [`4538`](https://github.com/lvgl/lvgl/pull/4538)
|
||||
- fix(docs): dropdown: fix function name in description of static options [`4535`](https://github.com/lvgl/lvgl/pull/4535)
|
||||
- fix: do not copy invalid areas if not double buffered mode [`4526`](https://github.com/lvgl/lvgl/pull/4526)
|
||||
- fix(sdl): add missing parameter in lv_draw_sdl_composite_texture_obtain [`4490`](https://github.com/lvgl/lvgl/pull/4490)
|
||||
- fix(dropdown): position to the selected item in lv_dropdown_set_selected [`f174589`](https://github.com/lvgl/lvgl/commit/f174589240b099a349e54ba09aa9b39c2b347341)
|
||||
- fix(vglite): be sure end_angle > start_angle in arc drawing [`01cd1fe`](https://github.com/lvgl/lvgl/commit/01cd1fed9db974aa616a6289a29171b7a971cd89)
|
||||
- fix(btnmatrix): fix tapping just outside a button in a buttonmatrix [`8063fac`](https://github.com/lvgl/lvgl/commit/8063fac793b0a09add1e57c1115b734659274e6f)
|
||||
|
||||
|
||||
### Docs
|
||||
|
||||
- docs(calendar): update according to v8.2 changes [`a296456`](https://github.com/lvgl/lvgl/commit/a296456591f6ff0e3b3ae6cdcdd9ec5b1711c357)
|
||||
- docs(simulator): remove SDL support from the Visual Studio project [`bcebafe`](https://github.com/lvgl/lvgl/commit/bcebafe4fb72e336b7dedca89c07e334427eef8d)
|
||||
|
||||
### CI and tests
|
||||
|
||||
- ci: update screenshot compare from v9 to automatically create missing reference images [`fd21ed0`](https://github.com/lvgl/lvgl/commit/fd21ed0eb82bacb1e482180ab0aaed6a667f000d)
|
||||
- ci(dropdown): fix test [`5fc488a`](https://github.com/lvgl/lvgl/commit/5fc488a088639dbfb5eb44f65b05e13b6ba881bf)
|
||||
|
||||
### Others
|
||||
|
||||
- chore(cmsis-pack): create cmsis-pack for v8.3.10 [`4572`](https://github.com/lvgl/lvgl/pull/4572)
|
||||
- Update screen object opacity function documentation [`4505`](https://github.com/lvgl/lvgl/pull/4505)
|
||||
- demo(sress): fix issues when the stress test is opened/clsoed multiple times [`1c5df6c`](https://github.com/lvgl/lvgl/commit/1c5df6c665b0d5f6f346d45b13109ff1f6ea78a6)
|
||||
- chore: code formatting [`eb87767`](https://github.com/lvgl/lvgl/commit/eb87767cc65fec93f9cc4f87a1f8fb5b32f7e41d)
|
||||
|
||||
|
||||
## [v8.3.9](https://github.com/lvgl/lvgl/compare/v8.3.9...v8.3.8) 6 August 2023
|
||||
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix(decoder): fix LV_IMG_CF_ALPHA_8BIT bin file decoder [`4406`](https://github.com/lvgl/lvgl/pull/4406)
|
||||
- fix(config): fix typo in LV_USE_PERF_MONITOR and LV_USE_MEM_MONITOR [`4403`](https://github.com/lvgl/lvgl/pull/4403)
|
||||
- fix(attr): refactor LV_ATTRIBUTE_* for function attributes [`4404`](https://github.com/lvgl/lvgl/pull/4404)
|
||||
- fix(font): fix optimizer issue in lv_font_fmt_txt.c [`4385`](https://github.com/lvgl/lvgl/pull/4385)
|
||||
- fix(btnmatrix): Hide button matrix when all buttons hidden [`65f1c93`](https://github.com/lvgl/lvgl/commit/65f1c9305e1b13356010524da4764fe20fe93030)
|
||||
- fix(obj) prevent hidden objects keeping focus [`375b3b5`](https://github.com/lvgl/lvgl/commit/375b3b5d3ef2ea8c52f971a1bf20998be7940d5e)
|
||||
- fix(btnmatrix): Fix typo in previous commit! [`29ed7c5`](https://github.com/lvgl/lvgl/commit/29ed7c5717f6cfbca5ce888bf4497221525aae85)
|
||||
- fix(tabview): fix warning [`223dc1c`](https://github.com/lvgl/lvgl/commit/223dc1cf9d1cad0f40caf244eb435af0871f4153)
|
||||
- fix(indev): fix warnings when loggin coordinates is enabled [`645006e`](https://github.com/lvgl/lvgl/commit/645006e35195cab3354f34a1a8cbc8c5ed0fdfad)
|
||||
- fix: use const lv_img_dsc_t * dsc function parameter in lv_img_buf.h/ [`4f102d7`](https://github.com/lvgl/lvgl/commit/4f102d7b6b2e9f9fa68ab7b976d93762107549a4)
|
||||
- fix(chart): fix lv_chart_get_point_pos_by_id [`f9ffcc9`](https://github.com/lvgl/lvgl/commit/f9ffcc9d8e11beb369dcbab0945ca85eab8f77b2)
|
||||
- fix(imgbtn): support LV_OBJ_FLAG_CHECKABLE [`385d999`](https://github.com/lvgl/lvgl/commit/385d999a4a8164fcde6ae05f6a5daa5d5c209dd3)
|
||||
|
||||
|
||||
### Docs
|
||||
|
||||
- docs(disp): metined that rotation rotates the touch coordinates too [`810852b`](https://github.com/lvgl/lvgl/commit/810852b41be5df66fd7b80f8af69f8b579d142ea)
|
||||
|
||||
|
||||
### Others
|
||||
|
||||
- demos: add lv_demo_..._close() functions for each demo [`91038a9`](https://github.com/lvgl/lvgl/commit/91038a99e82a2522f693c7cdc77e9e7a672ee9ed)
|
||||
|
||||
|
||||
## [v8.3.8](https://github.com/lvgl/lvgl/compare/v8.3.8...v8.3.7) 5 July 2023
|
||||
|
||||
### New Features
|
||||
|
||||
- feat(rt-thread): make the rt-thread env recursively glob the UI files [`8b83fe7`](https://github.com/lvgl/lvgl/commit/8b83fe7ea53a597cdbae8204d0aa9be8ad3d2b89)
|
||||
|
||||
### Performance
|
||||
|
||||
- perf(pxp, vglite): improve performance and add more features [`4222`](https://github.com/lvgl/lvgl/pull/4222)
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix(stm32): static function prototypes moved from .h to .c [`4276`](https://github.com/lvgl/lvgl/pull/4276)
|
||||
- fix(png): fix decode image size and some warnings [`4248`](https://github.com/lvgl/lvgl/pull/4248)
|
||||
- fix(bidi): add more Hebrew checks to RTL characters set (#4171) [`4239`](https://github.com/lvgl/lvgl/pull/4239)
|
||||
- fix(img): fix getting the image type on big endian systems [`4215`](https://github.com/lvgl/lvgl/pull/4215)
|
||||
- fix(sdl): destroy texture after use if not stored in cache [`4173`](https://github.com/lvgl/lvgl/pull/4173)
|
||||
|
||||
- fix:(BtnMatrix) Backport https://github.com/lvgl/lvgl/pull/4185 [`cb602ea`](https://github.com/lvgl/lvgl/commit/cb602ea7785de21a187ef5ee5f7de4e3aa3f7e0e)
|
||||
- fix(arduino): fix messed up variable types [`e3659c4`](https://github.com/lvgl/lvgl/commit/e3659c46b128b2b715b196c3ccfb94b3de4c89f8)
|
||||
- fix:(BtnMatrix) Backport https://github.com/lvgl/lvgl/pull/4185 [`07bce74`](https://github.com/lvgl/lvgl/commit/07bce7466d471a15ba241a9db3239f7a116b0b46)
|
||||
- fix(chart): fix division by zero if there are no ticks [`67b3011`](https://github.com/lvgl/lvgl/commit/67b3011f835b08c77ff60ae2d1e6592a710ca2b1)
|
||||
- fix(msgbox): fix typo [`6a89bd2`](https://github.com/lvgl/lvgl/commit/6a89bd2d7409ac4d49ad32da73ba50a84f7c8990)
|
||||
- fix(tabview): remove the animation if the tab is selected by clicking the button on the header [`3de61c7`](https://github.com/lvgl/lvgl/commit/3de61c76af0aed1665e9d61e47b4dd50b9e8bdf1)
|
||||
- fix(btnmatrix): fix array out of bounds addressing with groups and no buttons [`edd5ad2`](https://github.com/lvgl/lvgl/commit/edd5ad28ad74d1025db0b442cfa390d8c01ae006)
|
||||
- fix(btnmatrix): fix using > 7 as button width [`75e6ef4`](https://github.com/lvgl/lvgl/commit/75e6ef4e1d66a85d68160b97ef931b0717e77212)
|
||||
- fix(draw): typo with LV_COLOR_DEPTH 8 [`45b13c3`](https://github.com/lvgl/lvgl/commit/45b13c378f6fc1728ddf1547c25daa61d62c9f76)
|
||||
- fix(disp): fix memory leak lv_scr_load_anim with auto_del and time=0 [`1caafc5`](https://github.com/lvgl/lvgl/commit/1caafc55dde46e1b7e3d17d8c5349fbf7cccba9f)
|
||||
|
||||
- fix(msgbox): add missing lv_obj_class_init_obj [`6843c19`](https://github.com/lvgl/lvgl/commit/6843c191b792f66829477827279adbbc763541c1)
|
||||
- fix(flex): register LV_STYLE_FLEX_GROW [`5ba90a5`](https://github.com/lvgl/lvgl/commit/5ba90a5c41f584a8eb3a4fc8e2f466729652ddb3)
|
||||
|
||||
### Examples
|
||||
|
||||
- example(tabview): fix tabview disable scrollig example [`9491c3f`](https://github.com/lvgl/lvgl/commit/9491c3ff6d2f8e56b13d8fb493d4b3ee98ef1a4b)
|
||||
|
||||
### Docs
|
||||
|
||||
- docs: mention incompatibility between software rotation and `direct_mode` or `full_refresh` [`4308`](https://github.com/lvgl/lvgl/pull/4308)
|
||||
- docs(faq): don't say 24 bit is support as LVGL can't render in RGB888 directly [`227ac02`](https://github.com/lvgl/lvgl/commit/227ac023419eeb253892b1c36113059f12b1f9f2)
|
||||
|
||||
### CI and tests
|
||||
|
||||
### Others
|
||||
|
||||
- chore(cmsis-pack): update cmsis-pack for v8.3.8 [`4340`](https://github.com/lvgl/lvgl/pull/4340)
|
||||
- add(docs): add renesas-ra6m3 get-started document [`4278`](https://github.com/lvgl/lvgl/pull/4278)
|
||||
- add(gpu): add renesas-ra6m3 gpu adaptation [`4270`](https://github.com/lvgl/lvgl/pull/4270)
|
||||
|
||||
- Revert "fix:(BtnMatrix) Backport https://github.com/lvgl/lvgl/pull/4185" [`1713cd3`](https://github.com/lvgl/lvgl/commit/1713cd3fd8f93aa575fbcf0e34b8626b6ee69ded)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v8.3.7](https://github.com/lvgl/lvgl/compare/v8.3.7...v8.3.6) 3 May 2023
|
||||
|
||||
### New Features
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
nxp
|
||||
stm32
|
||||
espressif
|
||||
renesas
|
||||
arduino
|
||||
tasmota-berry
|
||||
cmake
|
||||
|
||||
@@ -23,6 +23,7 @@ Supported draw callbacks are available in "src/draw/nxp/pxp/lv_draw_pxp.c":
|
||||
pxp_draw_ctx->base_draw.draw_img_decoded = lv_draw_pxp_img_decoded;
|
||||
pxp_draw_ctx->blend = lv_draw_pxp_blend;
|
||||
pxp_draw_ctx->base_draw.wait_for_finish = lv_draw_pxp_wait_for_finish;
|
||||
pxp_draw_ctx->base_draw.buffer_copy = lv_draw_pxp_buffer_copy;
|
||||
```
|
||||
|
||||
#### Features supported:
|
||||
@@ -35,6 +36,7 @@ Supported draw callbacks are available in "src/draw/nxp/pxp/lv_draw_pxp.c":
|
||||
- Color keying
|
||||
- Recoloring (color tint)
|
||||
- Image Rotation (90, 180, 270 degree)
|
||||
- Buffer copy
|
||||
- RTOS integration layer
|
||||
- Default FreeRTOS and bare metal code provided
|
||||
|
||||
@@ -114,6 +116,7 @@ Supported draw callbacks are available in "src/draw/nxp/vglite/lv_draw_vglite.c"
|
||||
vglite_draw_ctx->base_draw.draw_img_decoded = lv_draw_vglite_img_decoded;
|
||||
vglite_draw_ctx->blend = lv_draw_vglite_blend;
|
||||
vglite_draw_ctx->base_draw.wait_for_finish = lv_draw_vglite_wait_for_finish;
|
||||
vglite_draw_ctx->base_draw.buffer_copy = lv_draw_vglite_buffer_copy;
|
||||
```
|
||||
|
||||
#### Features supported:
|
||||
@@ -129,6 +132,7 @@ Supported draw callbacks are available in "src/draw/nxp/vglite/lv_draw_vglite.c"
|
||||
- Draw rectangle border/outline with optional rounded corners
|
||||
- Draw arc with optional rounded ending
|
||||
- Draw line or dashed line with optional rounded ending
|
||||
- Buffer copy
|
||||
|
||||
#### Known limitations:
|
||||
- Source image alignment:
|
||||
|
||||
@@ -15,7 +15,7 @@ The simulator is ported to various IDEs (Integrated Development Environments). C
|
||||
|
||||
- [Eclipse with SDL driver](https://github.com/lvgl/lv_sim_eclipse_sdl): Recommended on Linux and Mac
|
||||
- [CodeBlocks](https://github.com/lvgl/lv_sim_codeblocks_win): Recommended on Windows
|
||||
- [VisualStudio with SDL driver](https://github.com/lvgl/lv_sim_visual_studio_sdl): For Windows
|
||||
- [VisualStudio](https://github.com/lvgl/lv_sim_visual_studio_sdl): For Windows
|
||||
- [VSCode with SDL driver](https://github.com/lvgl/lv_sim_vscode_sdl): Recommended on Linux and Mac
|
||||
- [PlatformIO with SDL driver](https://github.com/lvgl/lv_platformio): Recommended on Linux and Mac
|
||||
- [MDK with FastModel](https://github.com/lvgl/lv_port_an547_cm55_sim): For Windows
|
||||
|
||||
129
docs/get-started/platforms/renesas.md
Normal file
129
docs/get-started/platforms/renesas.md
Normal file
@@ -0,0 +1,129 @@
|
||||
# Renesas
|
||||
The [HMI-Board](https://bit.ly/3I9nfUo) development board SDK now comes with LVGL integration for quick evaluation. Simply download the [SDK](https://github.com/RT-Thread-Studio/sdk-bsp-ra6m3-hmi-board/tree/main/projects/hmi-board-lvgl) for the supported motherboard and you’ll be on your way to creating your next GUI application in no time. For more information, check out the [Software design description](https://github.com/RT-Thread-Studio/sdk-bsp-ra6m3-hmi-board/blob/main/projects/hmi-board-lvgl/README.md).
|
||||
|
||||
## Creating new project with LVGL
|
||||
It is recommended to start your project by downloading the HMI-Board SDK example project. It comes fully equipped with LVGL and dave-2d support (if the modules are present), so you won’t need to do any additional integration work.
|
||||
|
||||
## HW acceleration for Renesas RA6M3 platforms
|
||||
For RA6M3 platforms, hardware acceleration can be achieved using the dave-2d GPU, depending on the platform used. Each accelerator has its own context, allowing them to be used individually or simultaneously in LVGL’s multithreading mode.
|
||||
|
||||
### Dave-2d accelerator
|
||||
LVGL can offload several drawing features to the dave-2d engine, freeing up the CPU for other operations while dave-2d runs. An RTOS is required to block the LVGL drawing thread and switch to another task or suspend the CPU for power savings. Supported draw callbacks can be found in “src/draw/renesas/lv_gpu_d2_ra6m3.c”.
|
||||
|
||||
LVGL can offload several drawing features to the dave-2d engine, freeing up the CPU for other operations while dave-2d runs. An RTOS is required to block the LVGL drawing thread and switch to another task or suspend the CPU for power savings. Supported draw callbacks can be found in “src/draw/renesas/lv_gpu_d2_ra6m3.c”.
|
||||
|
||||
```c
|
||||
ra_2d_draw_ctx->blend = lv_draw_ra6m3_2d_blend;
|
||||
ra_2d_draw_ctx->base_draw.draw_img_decoded = lv_port_gpu_img_decoded;
|
||||
ra_2d_draw_ctx->base_draw.wait_for_finish = lv_port_gpu_wait;
|
||||
ra_2d_draw_ctx->base_draw.draw_letter = lv_draw_gpu_letter;
|
||||
```
|
||||
|
||||
### Features supported:
|
||||
All operations can be used in conjunction with optional transparency.
|
||||
|
||||
- RGB565 and ARGB8888 color formats
|
||||
- Area fill with color
|
||||
- BLIT (BLock Image Transfer)
|
||||
- Color conversion
|
||||
- Rotate and scale
|
||||
- Alpha blending
|
||||
- Bilinear filtering
|
||||
- RTOS integration layer
|
||||
- Default RT-Thread code provided
|
||||
- Subpixel exact placement
|
||||
|
||||
### Basic configuration:
|
||||
- Select Renesas dave-2d engine in lv_conf.h: Set `LV_USE_GPU_RA6M3_G2D` to 1
|
||||
- Set referenced header file in lv_conf.h: `#define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h"`
|
||||
|
||||
### RT-Thread Example:
|
||||
|
||||
```c
|
||||
#define COLOR_BUFFER (LV_HOR_RES_MAX * LV_VER_RES_MAX)
|
||||
|
||||
static lv_disp_drv_t disp_drv;
|
||||
|
||||
/*A static or global variable to store the buffers*/
|
||||
static lv_color_t buf_1[COLOR_BUFFER];
|
||||
```
|
||||
|
||||
- After initializing your peripherals (such as SPI, GPIOs, and LCD) in the `lv_port_disp_init()` function, you can initialize LVGL using [`lv_init()`.](https://docs.lvgl.io/master/API/core/lv_obj.html#_CPPv47lv_initv) Next, register the frame buffers using `lv_disp_draw_buf_init()` and create a new display driver using `lv_disp_drv_init()`.
|
||||
|
||||
```c
|
||||
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
|
||||
lv_disp_draw_buf_init(&disp_buf, buf_1, RT_NULL, COLOR_BUFFER);
|
||||
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
|
||||
|
||||
/*Set the resolution of the display*/
|
||||
disp_drv.hor_res = LV_HOR_RES_MAX;
|
||||
disp_drv.ver_res = LV_VER_RES_MAX;
|
||||
|
||||
/*Set a display buffer*/
|
||||
disp_drv.draw_buf = &disp_buf;
|
||||
|
||||
/*Used to copy the buffer's content to the display*/
|
||||
disp_drv.flush_cb = disp_flush;
|
||||
|
||||
/* Initialize GPU module */
|
||||
lv_port_gpu_hw_init();
|
||||
|
||||
/*Finally register the driver*/
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
```
|
||||
|
||||
* To run LVGL, you’ll need to create a thread. You can find examples of how to do this using RT-Thread in the `env_support/rt-thread/lv_rt_thread_port.c` file.
|
||||
|
||||
```c
|
||||
static void lvgl_thread_entry(void *parameter)
|
||||
{
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(lv_rt_log);
|
||||
#endif /* LV_USE_LOG */
|
||||
lv_init();
|
||||
lv_port_disp_init();
|
||||
lv_port_indev_init();
|
||||
lv_user_gui_init();
|
||||
|
||||
/* handle the tasks of LVGL */
|
||||
while(1)
|
||||
{
|
||||
lv_task_handler();
|
||||
rt_thread_mdelay(LV_DISP_DEF_REFR_PERIOD);
|
||||
}
|
||||
}
|
||||
|
||||
static int lvgl_thread_init(void)
|
||||
{
|
||||
rt_err_t err;
|
||||
|
||||
/* create lvgl thread */
|
||||
err = rt_thread_init(&lvgl_thread, "LVGL", lvgl_thread_entry, RT_NULL,
|
||||
&lvgl_thread_stack[0], sizeof(lvgl_thread_stack), PKG_LVGL_THREAD_PRIO, 10);
|
||||
if(err != RT_EOK)
|
||||
{
|
||||
LOG_E("Failed to create LVGL thread");
|
||||
return -1;
|
||||
}
|
||||
rt_thread_startup(&lvgl_thread);
|
||||
|
||||
return 0;
|
||||
}
|
||||
INIT_ENV_EXPORT(lvgl_thread_init);
|
||||
```
|
||||
|
||||
- The last step is to create a function to output the frame buffer to your LCD. The specifics of this function will depend on the features of your MCU. Here’s an example for a typical MCU interface: `my_flush_cb`.
|
||||
|
||||
```c
|
||||
static void my_flush_cb(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
#ifdef PKG_USING_ILI9341
|
||||
lcd_fill_array_spi(area->x1, area->y1, area->x2, area->y2, color_p);
|
||||
#elif LV_USE_GPU_RA6M3_G2D
|
||||
lv_port_gpu_blit(area->x1, area->y1, color_p, area);
|
||||
#else
|
||||
......
|
||||
#endif
|
||||
lv_disp_flush_ready(disp_drv);
|
||||
}
|
||||
```
|
||||
@@ -132,7 +132,7 @@ LVGL needs just one simple driver function to copy an array of pixels into a giv
|
||||
If you can do this with your display then you can use it with LVGL.
|
||||
|
||||
Some examples of the supported display types:
|
||||
- TFTs with 16 or 24 bit color depth
|
||||
- TFTs with 16 or 32 bit color depth
|
||||
- Monitors with an HDMI port
|
||||
- Small monochrome displays
|
||||
- Gray-scale displays
|
||||
|
||||
@@ -2,14 +2,38 @@
|
||||
# File System Interfaces
|
||||
|
||||
LVGL has a [File system](https://docs.lvgl.io/master/overview/file-system.html) module to provide an abstraction layer for various file system drivers.
|
||||
You still need to provide the drivers and libraries, this extension provides only the bridge between FATFS, LittleFS, STDIO, POSIX, WIN32 and LVGL.
|
||||
|
||||
LVG has built in support for:
|
||||
- [FATFS](http://elm-chan.org/fsw/ff/00index_e.html)
|
||||
- STDIO (Linux and Windows using C standard function .e.g fopen, fread)
|
||||
- POSIX (Linux and Windows using POSIX function .e.g open, read)
|
||||
- WIN32 (Windows using Win32 API function .e.g CreateFileA, ReadFile)
|
||||
## Built in wrappers
|
||||
|
||||
You still need to provide the drivers and libraries, this extension provides only the bridge between FATFS, STDIO, POSIX, WIN32 and LVGL.
|
||||
### FATFS
|
||||
|
||||
Bridge for [FatFS](http://elm-chan.org/fsw/ff/00index_e.html). FatFS itself is not part of LVGL, but can be added and initialized externally.
|
||||
|
||||
|
||||
### LittleFS
|
||||
|
||||
Though `lv_fs_littlefs` uses [LittleFS]((https://github.com/littlefs-project/littlefs)) API, the LittleFS library needs other external libraries that handle the mounting of partitions and low-level accesses, according to the given architecture. The functions for the latter are given to the lfs_t structure as pointers by an external low-level library.
|
||||
|
||||
There's a convenience function called `lv_fs_littlefs_set_driver(LV_FS_LITTLEFS_LETTER, my_lfs)`, specific to `lv_fs_littlefs`, to attach a `lfs_t` object's pointer to a registered driver-letter. See its comments for more info.
|
||||
|
||||
|
||||
[esp_littlefs](https://components.espressif.com/components/joltwallet/littlefs) is a wrapper for LittleFS to be used in Espressif ESP-devices. It handles the mounting and has the low-level `littlefs_api` functions to read/write/erase blocks that LittleFS library needs. On mounting by `esp_littlefs` the `lfs_t` structures are created. You need to get a handle to these to use ESP with `lv_fs_littlefs`, as all functions use that `lfs_t` in LittleFS to identify the mounted partition.
|
||||
|
||||
|
||||
In case you don't find a special function in the `lv_fs_littlefs` wrapper, you can look for it in the `esp_littlefs` API and use it directly, as `lv_fs_littlefs` and the `esp_littlefs` APIs can be used side-by-side.
|
||||
|
||||
### STDIO
|
||||
|
||||
Bride to C standard functions on Linux and Windows. For example `fopen`, `fread`, etc.
|
||||
|
||||
### POSIX
|
||||
|
||||
Bride to POSIX functions on Linux and Windows. For example `open`, `read`, etc.
|
||||
|
||||
### WIN32
|
||||
|
||||
Bride to Win32 API function. For example `CreateFileA`, `ReadFile`, etc.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
png
|
||||
gif
|
||||
freetype
|
||||
tiny_ttf
|
||||
qrcode
|
||||
rlottie
|
||||
ffmpeg
|
||||
|
||||
35
docs/libs/tiny_ttf.md
Normal file
35
docs/libs/tiny_ttf.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Tiny TTF font engine
|
||||
|
||||
## Usage
|
||||
|
||||
Use https://github.com/nothings/stb to render TrueType fonts in LVGL.
|
||||
|
||||
When enabled in `lv_conf.h` with `LV_USE_TINY_TTF`
|
||||
`lv_tiny_ttf_create_data(data, data_size, font_size)` can be used to
|
||||
create a TTF font instance at the specified font size. You can then
|
||||
use that font anywhere `lv_font_t` is accepted.
|
||||
|
||||
By default, the TTF or OTF file must be embedded as an array, either in
|
||||
a header, or loaded into RAM in order to function.
|
||||
|
||||
However, if `LV_TINY_TTF_FILE_SUPPORT` is enabled,
|
||||
`lv_tiny_ttf_create_file(path, font_size)` will also be available,
|
||||
allowing tiny_ttf to stream from a file. The file must remain open the
|
||||
entire time the font is being used, and streaming on demand may be
|
||||
considerably slower.
|
||||
|
||||
After a font is created, you can change the font size in pixels by using
|
||||
`lv_tiny_ttf_set_size(font, font_size)`.
|
||||
|
||||
By default, a font will use up to 4KB of cache to speed up rendering
|
||||
glyphs. This maximum can be changed by using
|
||||
`lv_tiny_ttf_create_data_ex(data, data_size, font_size, cache_size)`
|
||||
or `lv_tiny_ttf_create_file_ex(path, font_size, cache_size)` (when
|
||||
available). The cache size is indicated in bytes.
|
||||
|
||||
## API
|
||||
|
||||
```eval_rst
|
||||
.. doxygenfile:: lv_tiny_ttf.h
|
||||
:project: lvgl
|
||||
```
|
||||
@@ -67,7 +67,7 @@ The Alpha channel of 32-bit colors will be 0 where there are no objects and 255
|
||||
|
||||
In summary, to enable transparent screens and displays for OSD menu-like UIs:
|
||||
- Enable `LV_COLOR_SCREEN_TRANSP` in `lv_conf.h`
|
||||
- Set the screen's opacity to `LV_OPA_TRANSP` e.g. with `lv_obj_set_style_local_bg_opa(lv_scr_act(), LV_OBJMASK_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP)`
|
||||
- Set the screen's opacity to `LV_OPA_TRANSP` e.g. with `lv_obj_set_style_bg_opa(lv_scr_act(), LV_OPA_TRANSP, LV_PART_MAIN)`
|
||||
- Set the display opacity to `LV_OPA_TRANSP` with `lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);`
|
||||
|
||||
## Features of displays
|
||||
|
||||
@@ -173,7 +173,7 @@ All inputs are disabled during the screen animation.
|
||||
Screens are created on the currently selected *default display*.
|
||||
The *default display* is the last registered display with `lv_disp_drv_register`. You can also explicitly select a new default display using `lv_disp_set_default(disp)`.
|
||||
|
||||
`lv_scr_act()`, `lv_scr_load()` and `lv_scr_load_anim()` operate on the default screen.
|
||||
`lv_scr_act()`, `lv_scr_load()` and `lv_scr_load_anim()` operate on the default display.
|
||||
|
||||
Visit [Multi-display support](/overview/display) to learn more.
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ Set the opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means full
|
||||
</ul>
|
||||
|
||||
### border_width
|
||||
Set hte width of the border. Only pixel values can be used.
|
||||
Set the width of the border. Only pixel values can be used.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
@@ -708,6 +708,15 @@ Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0`
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
|
||||
</ul>
|
||||
|
||||
### opa_layered
|
||||
First draw the object on the layer, then scale down layer opacity factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_COVER`</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> Yes</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Layout</strong> No</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
|
||||
</ul>
|
||||
|
||||
### color_filter_dsc
|
||||
Mix a color to all colors of the object.
|
||||
<ul>
|
||||
@@ -772,7 +781,7 @@ Describes how to blend the colors to the background. The possible values are `LV
|
||||
</ul>
|
||||
|
||||
### layout
|
||||
Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts.
|
||||
Set the layout of the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts.
|
||||
<ul>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> 0</li>
|
||||
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
|
||||
|
||||
@@ -204,6 +204,10 @@ The default rotation of your display when it is initialized can be set using the
|
||||
|
||||
Display rotation can also be changed at runtime using the `lv_disp_set_rotation(disp, rot)` API.
|
||||
|
||||
If you enable rotation the coordinates of the pointer input devices (e.g. touchpad) will be rotated too.
|
||||
|
||||
Note that when using software rotation, you cannot use neither `direct_mode` nor `full_refresh` in the driver. When using either of these, you will have to rotate the pixels yourself e.g. in the `flush_cb`.
|
||||
|
||||
Support for software rotation is a new feature, so there may be some glitches/bugs depending on your configuration. If you encounter a problem please open an issue on [GitHub](https://github.com/lvgl/lvgl/issues).
|
||||
|
||||
### Decoupling the display refresh timer
|
||||
|
||||
@@ -43,7 +43,7 @@ Options are passed to the drop-down list as a string with `lv_dropdown_set_optio
|
||||
|
||||
The `lv_dropdown_add_option(dropdown, "New option", pos)` function inserts a new option to `pos` index.
|
||||
|
||||
To save memory the options can set from a static(constant) string too with `lv_dropdown_set_static_options(dropdown, options)`.
|
||||
To save memory the options can set from a static(constant) string too with `lv_dropdown_set_options_static(dropdown, options)`.
|
||||
In this case the options string should be alive while the drop-down list exists and `lv_dropdown_add_option` can't be used
|
||||
|
||||
You can select an option manually with `lv_dropdown_set_selected(dropdown, id)`, where `id` is the index of an option.
|
||||
|
||||
@@ -44,7 +44,9 @@ This is not the case with `lv_label_set_text_static`. The buffer you pass to `lv
|
||||
|
||||
### Text recolor
|
||||
In the text, you can use commands to recolor parts of the text. For example: `"Write a #ff0000 red# word"`.
|
||||
This feature can be enabled individually for each label by `lv_label_set_recolor()` function.
|
||||
This feature can be enabled individually for each label by `lv_label_set_recolor()` function,
|
||||
recoloring is only supported when the text wrapped with `##ff0000 ... #`sintax is in one line,
|
||||
it is not supported in wrapped text, see example `Line wrap, recoloring and scrolling`.
|
||||
|
||||
### Text selection
|
||||
If enabled by `LV_LABEL_TEXT_SELECTION` part of the text can be selected. It's similar to when you use your mouse on a PC to select a text.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Calendar (lv_calendar)
|
||||
|
||||
**From v8.1 the header is added directly into the Calendar widget and the API of the headers has been changed.**
|
||||
|
||||
## Overview
|
||||
|
||||
The Calendar object is a classic calendar which can:
|
||||
@@ -13,13 +15,16 @@ The Calendar is added to the default group (if it is set). Calendar is an editab
|
||||
To make the Calendar flexible, by default it doesn't show the current year or month. Instead, there are optional "headers" that can be attached to the calendar.
|
||||
|
||||
## Parts and Styles
|
||||
The calendar object uses the [Button matrix](/widgets/core/btnmatrix) object under the hood to arrange the days into a matrix.
|
||||
- `LV_PART_MAIN` The background of the calendar. Uses all the background related style properties.
|
||||
- `LV_PART_ITEMS` Refers to the dates and day names. Button matrix control flags are set to differentiate the buttons and a custom drawer event is added modify the properties of the buttons as follows:
|
||||
- day names have no border, no background and drawn with a gray color
|
||||
- days of the previous and next month have `LV_BTNMATRIX_CTRL_DISABLED` flag
|
||||
- today has a thicker border with the theme's primary color
|
||||
- highlighted days have some opacity with the theme's primary color.
|
||||
The Calendar is composed of 3 widegets
|
||||
- Container: A rectangle which is a container for the *Header* and the *Days*. Uses only `LV_PART_MAIN` where all the background related style properties are working.
|
||||
- Days: It's a [Button matrix](/widgets/core/btnmatrix) object under the hood to arrange the days into a matrix. `lv_calendar_get_btnmatrix(calendar)` can be used to get it.
|
||||
- `LV_PART_MAIN` The background of the calendar. Uses all the background related style properties.
|
||||
- `LV_PART_ITEMS` Refers to the dates and day names. Button matrix control flags are set to differentiate the buttons and a custom drawer event is added modify the properties of the buttons as follows:
|
||||
- day names have no border, no background and drawn with a gray color
|
||||
- days of the previous and next month have `LV_BTNMATRIX_CTRL_DISABLED` flag
|
||||
- today has a thicker border with the theme's primary color
|
||||
- highlighted days have some opacity with the theme's primary color.
|
||||
- Header: Not created by default, the details are up to the given header.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -53,8 +58,6 @@ Learn more about [Keys](/overview/indev).
|
||||
|
||||
## Headers
|
||||
|
||||
**From v8.1 the header is added directly into the Calendar widget and the API of the headers has been changed.**
|
||||
|
||||
### Arrow buttons
|
||||
|
||||
`lv_calendar_header_arrow_create(calendar)` creates a header that contains a left and right arrow on the sides and a text with the current year and month between them.
|
||||
|
||||
@@ -63,6 +63,12 @@ install(
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h")
|
||||
|
||||
install(
|
||||
FILES "${LV_CONF_PATH}"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/${INC_INSTALL_DIR}/../"
|
||||
RENAME "lv_conf.h"
|
||||
OPTIONAL)
|
||||
|
||||
set_target_properties(
|
||||
lvgl
|
||||
PROPERTIES OUTPUT_NAME lvgl
|
||||
|
||||
Binary file not shown.
@@ -20,7 +20,7 @@
|
||||
-->
|
||||
|
||||
|
||||
<package schemaVersion="1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="PACK.xsd">
|
||||
<package schemaVersion="1.4" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="https://raw.githubusercontent.com/Open-CMSIS-Pack/Open-CMSIS-Pack-Spec/v1.7.7/schema/PACK.xsd">
|
||||
<vendor>LVGL</vendor>
|
||||
<name>lvgl</name>
|
||||
<description>LVGL (Light and Versatile Graphics Library) is a free and open-source graphics library providing everything you need to create an embedded GUI with easy-to-use graphical elements, beautiful visual effects and a low memory footprint.</description>
|
||||
@@ -36,11 +36,33 @@
|
||||
<repository type="git">https://github.com/lvgl/lvgl.git</repository>
|
||||
|
||||
<releases>
|
||||
<release date="2023-04-28" version="8.3.7" url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/LVGL.lvgl.8.3.7.pack">
|
||||
<release date="2023-12-05" version="8.3.11" url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/LVGL.lvgl.8.3.11.pack">
|
||||
- LVGL 8.3.11
|
||||
- Add LittleFS Library to LVGL8
|
||||
- Backport Tiny TTF to LVGL8
|
||||
- Some minor fixes
|
||||
</release>
|
||||
<release date="2023-09-19" version="8.3.10" url="https://github.com/lvgl/lvgl/raw/9e388055ec0bcad5179461e66d6dac6823129eee/env_support/cmsis-pack/LVGL.lvgl.8.3.10.pack">
|
||||
- LVGL 8.3.10
|
||||
- Some minor fixes
|
||||
</release>
|
||||
|
||||
<release date="2023-08-04" version="8.3.9" url="https://github.com/lvgl/lvgl/raw/bdf5bfb88ce107f16cf9128cf75e61394b3219d0/env_support/cmsis-pack/LVGL.lvgl.8.3.9.pack">
|
||||
- LVGL 8.3.10
|
||||
- Add snapshot, fragment, imgfont, gridnav, msg and monkey
|
||||
- Other minor fixes
|
||||
</release>
|
||||
<release date="2023-07-04" version="8.3.8" url="https://github.com/lvgl/lvgl/raw/15433d69b9d8ae6aa74f49946874af81a0cc5921/env_support/cmsis-pack/LVGL.lvgl.8.3.8.pack">
|
||||
- LVGL 8.3.8
|
||||
- Add renesas-ra6m3 gpu adaptation
|
||||
- Improve performance and add more features for PXP and VGLite
|
||||
- Minor updates
|
||||
</release>
|
||||
<release date="2023-04-28" version="8.3.7" url="https://github.com/lvgl/lvgl/raw/2b56e04205481daa6575bd5f7ab5df59d11676eb/env_support/cmsis-pack/LVGL.lvgl.8.3.7.pack">
|
||||
- LVGL 8.3.7
|
||||
- Minor updates
|
||||
</release>
|
||||
<release date="2023-04-02" version="8.3.6" url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/LVGL.lvgl.8.3.6.pack">
|
||||
<release date="2023-04-02" version="8.3.6" url="https://github.com/lvgl/lvgl/raw/6b0092c0d91b2c7bfded48e04cc7b486ed3a72bd/env_support/cmsis-pack/LVGL.lvgl.8.3.6.pack">
|
||||
- LVGL 8.3.6 release
|
||||
- Various fixes, See CHANGELOG.md
|
||||
</release>
|
||||
@@ -181,6 +203,7 @@
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>
|
||||
</condition>
|
||||
|
||||
<condition id="LVGL-GPU-STM32-DMA2D">
|
||||
@@ -192,6 +215,7 @@
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>
|
||||
</condition>
|
||||
|
||||
<condition id="LVGL-GPU-SWM341-DMA2D">
|
||||
@@ -203,6 +227,7 @@
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>
|
||||
</condition>
|
||||
|
||||
<condition id="LVGL-GPU-NXP-PXP">
|
||||
@@ -214,6 +239,7 @@
|
||||
<!--<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>-->
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>
|
||||
</condition>
|
||||
|
||||
<condition id="LVGL-GPU-NXP-VGLite">
|
||||
@@ -225,6 +251,7 @@
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>
|
||||
<!--<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>-->
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>
|
||||
</condition>
|
||||
|
||||
<condition id="LVGL-GPU-GD32-IPA">
|
||||
@@ -236,6 +263,19 @@
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>
|
||||
<!--<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>-->
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>
|
||||
</condition>
|
||||
|
||||
<condition id="LVGL-GPU-RA6M3-G2D">
|
||||
<description>Enable LVGL Arm-2D GPU Support</description>
|
||||
<require Cclass="LVGL" Cgroup="lvgl" Csub="Essential"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU Arm-2D"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU STM32-DMA2D"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU SWM341-DMA2D"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-PXP"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU NXP-VGLite"/>
|
||||
<deny Cclass="LVGL" Cgroup="lvgl" Csub="GPU GD32-IPA"/>
|
||||
<!--<deny Cclass="LVGL" Cgroup="lvgl" Csub="LVGL-GPU-RA6M3-G2D"/>-->
|
||||
</condition>
|
||||
|
||||
</conditions>
|
||||
@@ -270,7 +310,7 @@
|
||||
-->
|
||||
|
||||
<components>
|
||||
<bundle Cbundle="LVGL" Cclass="LVGL" Cversion="8.3.7">
|
||||
<bundle Cbundle="LVGL" Cclass="LVGL" Cversion="8.3.11">
|
||||
<description>LVGL (Light and Versatile Graphics Library) is a free and open-source graphics library providing everything you need to create an embedded GUI with easy-to-use graphical elements, beautiful visual effects and a low memory footprint.</description>
|
||||
<doc></doc>
|
||||
<component Cgroup="lvgl" Csub="Essential" >
|
||||
@@ -403,7 +443,7 @@
|
||||
<file category="sourceC" name="src/widgets/lv_textarea.c" />
|
||||
|
||||
<!-- general -->
|
||||
<file category="preIncludeGlobal" name="lv_conf_cmsis.h" attr="config" version="1.0.3" />
|
||||
<file category="preIncludeGlobal" name="lv_conf_cmsis.h" attr="config" version="1.0.4" />
|
||||
<file category="sourceC" name="lv_cmsis_pack.c" attr="config" version="1.0.0" />
|
||||
<file category="header" name="lvgl.h" />
|
||||
<file category="doc" name="README.md"/>
|
||||
@@ -527,6 +567,22 @@
|
||||
|
||||
</component>
|
||||
|
||||
|
||||
<component Cgroup="lvgl" Csub="GPU RA6M3-G2D" condition="LVGL-GPU-RA6M3-G2D">
|
||||
<description>An hardware acceleration from Renesas RA6M3-G2D</description>
|
||||
<files>
|
||||
<file category="sourceC" name="src/draw/renesas/lv_gpu_d2_draw_label.c" />
|
||||
<file category="sourceC" name="src/draw/renesas/lv_gpu_d2_ra6m3.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable RA6M3-G2D */
|
||||
#define LV_USE_GPU_RA6M3_G2D 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Extra Themes" condition="LVGL-Essential">
|
||||
<description>Extra Themes, Widgets and Layouts</description>
|
||||
<files>
|
||||
@@ -672,9 +728,26 @@
|
||||
<file category="sourceC" name="src/extra/libs/fsdrv/lv_fs_fatfs.c" />
|
||||
<file category="sourceC" name="src/extra/libs/fsdrv/lv_fs_posix.c" />
|
||||
<file category="sourceC" name="src/extra/libs/fsdrv/lv_fs_stdio.c" />
|
||||
<file category="sourceC" name="src/extra/libs/fsdrv/lv_fs_littlefs.c" />
|
||||
</files>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Libs Tiny TTF" condition="LVGL-Essential">
|
||||
<description>Add Tiny TTF Library</description>
|
||||
<files>
|
||||
<!-- src/extra/libs/tiny_ttf -->
|
||||
<file category="sourceC" name="src/extra/libs/tiny_ttf/lv_tiny_ttf.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable Tiny TTF Library */
|
||||
#define LV_USE_TINY_TTF 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
|
||||
<component Cgroup="lvgl" Csub="Libs RLOTTIE" condition="LVGL-Essential">
|
||||
<description>Add RLOTTIE support, an extra librbary is required.</description>
|
||||
@@ -686,7 +759,7 @@
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable RLOTTIE support */
|
||||
#define LV_USE_RLOTTIE 1
|
||||
#define LV_USE_RLOTTIE 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
@@ -701,7 +774,7 @@
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable ffmpeg support */
|
||||
#define LV_USE_FFMPEG 1
|
||||
#define LV_USE_FFMPEG 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
@@ -716,7 +789,98 @@
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable ffmpeg support */
|
||||
#define LV_USE_IME_PINYIN 1
|
||||
#define LV_USE_IME_PINYIN 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Snapshot" condition="LVGL-Essential">
|
||||
<description>Add the Snapshot service</description>
|
||||
<files>
|
||||
<!-- src/extra/others/snapshot -->
|
||||
<file category="sourceC" name="src/extra/others/snapshot/lv_snapshot.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable snapshot support */
|
||||
#define LV_USE_SNAPSHOT 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Fragment" condition="LVGL-Essential">
|
||||
<description>Add the Fragment service</description>
|
||||
<files>
|
||||
<!-- src/extra/others/fragment -->
|
||||
<file category="sourceC" name="src/extra/others/fragment/lv_fragment.c" />
|
||||
<file category="sourceC" name="src/extra/others/fragment/lv_fragment_manager.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable fragment support */
|
||||
#define LV_USE_FRAGMENT 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Grid Navigation" condition="LVGL-Essential">
|
||||
<description>Add the Grid Navigation service</description>
|
||||
<files>
|
||||
<!-- src/extra/others/gridnav -->
|
||||
<file category="sourceC" name="src/extra/others/gridnav/lv_gridnav.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable the Grid Navigation support*/
|
||||
#define LV_USE_GRIDNAV 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Image Font" condition="LVGL-Essential">
|
||||
<description>Add the Image Font service</description>
|
||||
<files>
|
||||
<!-- src/extra/others/imgfont -->
|
||||
<file category="sourceC" name="src/extra/others/imgfont/lv_imgfont.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable the image font support*/
|
||||
#define LV_USE_IMGFONT 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Monkey" condition="LVGL-Essential">
|
||||
<description>Add the Monkey service</description>
|
||||
<files>
|
||||
<!-- src/extra/others/monkey -->
|
||||
<file category="sourceC" name="src/extra/others/monkey/lv_monkey.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable the monkey service support*/
|
||||
#define LV_USE_MONKEY 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
<component Cgroup="lvgl" Csub="Message" condition="LVGL-Essential">
|
||||
<description>Add the Message service</description>
|
||||
<files>
|
||||
<!-- src/extra/others/msg -->
|
||||
<file category="sourceC" name="src/extra/others/msg/lv_msg.c" />
|
||||
</files>
|
||||
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable the message service support*/
|
||||
#define LV_USE_MSG 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
@@ -745,7 +909,7 @@
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable demo:bencharmk */
|
||||
#define LV_USE_DEMO_BENCHMARK 1
|
||||
#define LV_USE_DEMO_BENCHMARK 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
@@ -765,7 +929,7 @@
|
||||
<RTE_Components_h>
|
||||
|
||||
/*! \brief enable demo:widgets support */
|
||||
#define LV_USE_DEMO_WIDGETS 1
|
||||
#define LV_USE_DEMO_WIDGETS 1
|
||||
</RTE_Components_h>
|
||||
|
||||
</component>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<index schemaVersion="1.0.0" xs:noNamespaceSchemaLocation="PackIndex.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<vendor>LVGL</vendor>
|
||||
<url>https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/</url>
|
||||
<timestamp>2023-05-03</timestamp>
|
||||
<timestamp>2023-12-09</timestamp>
|
||||
<pindex>
|
||||
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/release/v8.3/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="8.3.7"/>
|
||||
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/release/v8.3/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="8.3.11"/>
|
||||
</pindex>
|
||||
</index>
|
||||
@@ -46,12 +46,33 @@ remove the misleading guide above this code segment.
|
||||
- LV_USE_GPU_SWM341_DMA2D
|
||||
- LV_USE_GPU_ARM2D
|
||||
- LV_USE_IME_PINYIN
|
||||
- LV_USE_PNG
|
||||
- LV_USE_BMP
|
||||
- LV_USE_SJPG
|
||||
- LV_USE_GIF
|
||||
- LV_USE_QRCODE
|
||||
- LV_USE_FREETYPE
|
||||
- LV_USE_TINY_TTF
|
||||
- LV_USE_RLOTTIE
|
||||
- LV_USE_FFMPEG
|
||||
- LV_USE_SNAPSHOT
|
||||
- LV_USE_MONKEY
|
||||
- LV_USE_GRIDNAV
|
||||
- LV_USE_FRAGMENT
|
||||
- LV_USE_IMGFONT
|
||||
- LV_USE_MSG
|
||||
- LV_USE_IME_PINYIN
|
||||
5. Update macro `LV_ATTRIBUTE_MEM_ALIGN` and `LV_ATTRIBUTE_MEM_ALIGN_SIZE` to force a WORD alignment.
|
||||
```c
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 4
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4)))
|
||||
```
|
||||
Update macro `LV_MEM_SIZE` to `(64*1024U)`.
|
||||
|
||||
Update macro `LV_FONT_MONTSERRAT_12` to `1`.
|
||||
|
||||
Update macro `LV_FONT_MONTSERRAT_12` to `1`.
|
||||
|
||||
6. Update Theme related macros:
|
||||
|
||||
```c
|
||||
@@ -89,25 +110,41 @@ Update macro `LV_MEM_SIZE` to `(64*1024U)`.
|
||||
#define LV_TICK_CUSTOM 1
|
||||
#if LV_TICK_CUSTOM
|
||||
extern uint32_t SystemCoreClock;
|
||||
#define LV_TICK_CUSTOM_INCLUDE "perf_counter.h"
|
||||
|
||||
#if __PER_COUNTER_VER__ < 10902ul
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR ((uint32_t)get_system_ticks() / (SystemCoreClock / 1000ul))
|
||||
#else
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR get_system_ms()
|
||||
#endif
|
||||
#define LV_TICK_CUSTOM_INCLUDE "perf_counter.h"
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR get_system_ms()
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
#else
|
||||
#define LV_TICK_CUSTOM 0
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
/*If using lvgl as ESP32 component*/
|
||||
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
|
||||
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
#endif /*__PERF_COUNTER__*/
|
||||
```
|
||||
9. Thoroughly remove the `DEMO USAGE` section.
|
||||
10. Thoroughly remove the '3rd party libraries' section.
|
||||
10. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'.
|
||||
|
||||
|
||||
9. Remove all content in `DEMO USAGE` section but keep the following:
|
||||
|
||||
```c
|
||||
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
/*Benchmark your system*/
|
||||
#if LV_USE_DEMO_BENCHMARK
|
||||
/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/
|
||||
#define LV_DEMO_BENCHMARK_RGB565A8 1
|
||||
#endif
|
||||
```
|
||||
|
||||
|
||||
|
||||
10. Thoroughly remove the `3rd party libraries` section.
|
||||
11. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v8.3.7
|
||||
* Configuration file for v8.3.11
|
||||
*/
|
||||
|
||||
/* clang-format off */
|
||||
@@ -76,6 +76,7 @@
|
||||
/*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
|
||||
|
||||
|
||||
/*Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#ifdef __PERF_COUNTER__
|
||||
@@ -90,12 +91,13 @@
|
||||
#if LV_TICK_CUSTOM
|
||||
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
|
||||
/*If using lvgl as ESP32 component*/
|
||||
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
|
||||
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
|
||||
/*If using lvgl as ESP32 component*/
|
||||
// #define LV_TICK_CUSTOM_INCLUDE "esp_timer.h"
|
||||
// #define LV_TICK_CUSTOM_SYS_TIME_EXPR ((esp_timer_get_time() / 1000LL))
|
||||
#endif /*LV_TICK_CUSTOM*/
|
||||
#endif /*__PERF_COUNTER__*/
|
||||
|
||||
|
||||
/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings.
|
||||
*(Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
#define LV_DPI_DEF 130 /*[px/inch]*/
|
||||
@@ -178,6 +180,7 @@
|
||||
* GPU
|
||||
*-----------*/
|
||||
|
||||
|
||||
/*Use STM32's DMA2D (aka Chrom Art) GPU*/
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
/*Must be defined to include path of CMSIS header of target processor
|
||||
@@ -185,6 +188,13 @@
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Enable RA6M3 G2D GPU*/
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
/*include path of target processor
|
||||
e.g. "hal_data.h"*/
|
||||
#define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h"
|
||||
#endif
|
||||
|
||||
/*Use SWM341's DMA2D GPU*/
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
#define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h"
|
||||
@@ -200,16 +210,6 @@
|
||||
#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0
|
||||
#endif
|
||||
|
||||
/*Use SDL renderer API*/
|
||||
#define LV_USE_GPU_SDL 0
|
||||
#if LV_USE_GPU_SDL
|
||||
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
/*Texture cache size, 8MB by default*/
|
||||
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
|
||||
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
* Logging
|
||||
*-----------*/
|
||||
@@ -225,11 +225,11 @@
|
||||
*LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
|
||||
*LV_LOG_LEVEL_USER Only logs added by the user
|
||||
*LV_LOG_LEVEL_NONE Do not log anything*/
|
||||
#define LV_LOG_LEVEL LV_LOG_LEVEL_USER
|
||||
#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
|
||||
|
||||
/*1: Print the log with 'printf';
|
||||
*0: User need to register a callback with `lv_log_register_print_cb()`*/
|
||||
#define LV_LOG_PRINTF 1
|
||||
#define LV_LOG_PRINTF 0
|
||||
|
||||
/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/
|
||||
#define LV_LOG_TRACE_MEM 1
|
||||
@@ -582,7 +582,6 @@
|
||||
#define LV_USE_THEME_BASIC 0
|
||||
#define LV_USE_THEME_MONO 0
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
* Layouts
|
||||
*----------*/
|
||||
@@ -593,28 +592,86 @@
|
||||
/*A layout similar to Grid in CSS.*/
|
||||
#define LV_USE_GRID 1
|
||||
|
||||
/*---------------------
|
||||
* 3rd party libraries
|
||||
*--------------------*/
|
||||
|
||||
/*File system interfaces for common APIs */
|
||||
|
||||
/*API for fopen, fread, etc*/
|
||||
#define LV_USE_FS_STDIO 0
|
||||
#if LV_USE_FS_STDIO
|
||||
#define LV_FS_STDIO_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_STDIO_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_STDIO_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for open, read, etc*/
|
||||
#define LV_USE_FS_POSIX 0
|
||||
#if LV_USE_FS_POSIX
|
||||
#define LV_FS_POSIX_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_POSIX_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_POSIX_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for CreateFile, ReadFile, etc*/
|
||||
#define LV_USE_FS_WIN32 0
|
||||
#if LV_USE_FS_WIN32
|
||||
#define LV_FS_WIN32_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_WIN32_PATH "" /*Set the working directory. File/directory paths will be appended to it.*/
|
||||
#define LV_FS_WIN32_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for FATFS (needs to be added separately). Uses f_open, f_read, etc*/
|
||||
#define LV_USE_FS_FATFS 0
|
||||
#if LV_USE_FS_FATFS
|
||||
#define LV_FS_FATFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/
|
||||
#define LV_USE_FS_LITTLEFS 0
|
||||
#if LV_USE_FS_LITTLEFS
|
||||
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*FreeType library*/
|
||||
#if LV_USE_FREETYPE
|
||||
/*Memory used by FreeType to cache characters [bytes] (-1: no caching)*/
|
||||
#define LV_FREETYPE_CACHE_SIZE (16 * 1024)
|
||||
#if LV_FREETYPE_CACHE_SIZE >= 0
|
||||
/* 1: bitmap cache use the sbit cache, 0:bitmap cache use the image cache. */
|
||||
/* sbit cache:it is much more memory efficient for small bitmaps(font size < 256) */
|
||||
/* if font size >= 256, must be configured as image cache */
|
||||
#define LV_FREETYPE_SBIT_CACHE 0
|
||||
/* Maximum number of opened FT_Face/FT_Size objects managed by this cache instance. */
|
||||
/* (0:use system defaults) */
|
||||
#define LV_FREETYPE_CACHE_FT_FACES 0
|
||||
#define LV_FREETYPE_CACHE_FT_SIZES 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Tiny TTF library*/
|
||||
#if LV_USE_TINY_TTF
|
||||
/*Load TTF data from files*/
|
||||
#define LV_TINY_TTF_FILE_SUPPORT 0
|
||||
#endif
|
||||
|
||||
|
||||
/*FFmpeg library for image decoding and playing videos
|
||||
*Supports all major image formats so do not enable other image decoder with it*/
|
||||
#if LV_USE_FFMPEG
|
||||
/*Dump input information to stderr*/
|
||||
#define LV_FFMPEG_DUMP_FORMAT 0
|
||||
#endif
|
||||
|
||||
/*-----------
|
||||
* Others
|
||||
*----------*/
|
||||
|
||||
/*1: Enable API to take snapshot for object*/
|
||||
#define LV_USE_SNAPSHOT 0
|
||||
|
||||
/*1: Enable Monkey test*/
|
||||
#define LV_USE_MONKEY 0
|
||||
|
||||
/*1: Enable grid navigation*/
|
||||
#define LV_USE_GRIDNAV 0
|
||||
|
||||
/*1: Enable lv_obj fragment*/
|
||||
#define LV_USE_FRAGMENT 0
|
||||
|
||||
/*1: Support using images as font in label or span widgets */
|
||||
#define LV_USE_IMGFONT 0
|
||||
|
||||
/*1: Enable a published subscriber based messaging system */
|
||||
#define LV_USE_MSG 0
|
||||
|
||||
/*1: Enable Pinyin input method*/
|
||||
/*Requires: lv_keyboard*/
|
||||
#if LV_USE_IME_PINYIN
|
||||
@@ -639,6 +696,20 @@
|
||||
/*Enable the examples to be built with the library*/
|
||||
#define LV_BUILD_EXAMPLES 1
|
||||
|
||||
/*===================
|
||||
* DEMO USAGE
|
||||
====================*/
|
||||
|
||||
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
/*Benchmark your system*/
|
||||
#if LV_USE_DEMO_BENCHMARK
|
||||
/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/
|
||||
#define LV_DEMO_BENCHMARK_RGB565A8 1
|
||||
#endif
|
||||
|
||||
/*--END OF LV_CONF_H--*/
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ static int lvgl_thread_init(void)
|
||||
rt_err_t err;
|
||||
|
||||
err = rt_thread_init(&lvgl_thread, "LVGL", lvgl_thread_entry, RT_NULL,
|
||||
&lvgl_thread_stack[0], sizeof(lvgl_thread_stack), PKG_LVGL_THREAD_PRIO, 0);
|
||||
&lvgl_thread_stack[0], sizeof(lvgl_thread_stack), PKG_LVGL_THREAD_PRIO, 10);
|
||||
if(err != RT_EOK)
|
||||
{
|
||||
LOG_E("Failed to create LVGL thread");
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = ['lv_ui_entry.c']
|
||||
|
||||
src += Glob(cwd + '/ui/*.c')
|
||||
|
||||
group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'])
|
||||
|
||||
src = Glob('*.c')
|
||||
inc = [cwd]
|
||||
|
||||
# check if .h or .hpp files exsit
|
||||
def check_h_hpp_exsit(path):
|
||||
file_dirs = os.listdir(path)
|
||||
for file_dir in file_dirs:
|
||||
if os.path.splitext(file_dir)[1] in ['.h', '.hpp']:
|
||||
return True
|
||||
return False
|
||||
|
||||
sls_src_cwd = cwd
|
||||
for root, dirs, files in os.walk(sls_src_cwd):
|
||||
for dir in dirs:
|
||||
current_path = os.path.join(root, dir)
|
||||
src = src + Glob(os.path.join(current_path,'*.c')) # add all .c files
|
||||
if check_h_hpp_exsit(current_path): # add .h and .hpp path
|
||||
inc = inc + [current_path]
|
||||
|
||||
group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'], CPPPATH = inc)
|
||||
|
||||
Return('group')
|
||||
|
||||
@@ -14,7 +14,7 @@ static const uint16_t screenWidth = 480;
|
||||
static const uint16_t screenHeight = 320;
|
||||
|
||||
static lv_disp_draw_buf_t draw_buf;
|
||||
static lv_color_t buf[ screenWidth * 10 ];
|
||||
static lv_color_t buf[ screenWidth * screenHeight / 10 ];
|
||||
|
||||
TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */
|
||||
|
||||
@@ -28,7 +28,7 @@ void my_print(const char * buf)
|
||||
#endif
|
||||
|
||||
/* Display flushing */
|
||||
void my_disp_flush( lv_disp_t *disp, const lv_area_t *area, lv_color_t *color_p )
|
||||
void my_disp_flush( lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p )
|
||||
{
|
||||
uint32_t w = ( area->x2 - area->x1 + 1 );
|
||||
uint32_t h = ( area->y2 - area->y1 + 1 );
|
||||
@@ -38,11 +38,11 @@ void my_disp_flush( lv_disp_t *disp, const lv_area_t *area, lv_color_t *color_p
|
||||
tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
|
||||
tft.endWrite();
|
||||
|
||||
lv_disp_flush_ready( disp );
|
||||
lv_disp_flush_ready( disp_drv );
|
||||
}
|
||||
|
||||
/*Read the touchpad*/
|
||||
void my_touchpad_read( lv_indev_t * indev_driver, lv_indev_data_t * data )
|
||||
void my_touchpad_read( lv_indev_drv_t * indev_drv, lv_indev_data_t * data )
|
||||
{
|
||||
uint16_t touchX, touchY;
|
||||
|
||||
@@ -93,10 +93,10 @@ void setup()
|
||||
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
|
||||
tft.setTouch( calData );
|
||||
|
||||
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * 10 );
|
||||
lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / 10 );
|
||||
|
||||
/*Initialize the display*/
|
||||
static lv_disp_t disp_drv;
|
||||
static lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init( &disp_drv );
|
||||
/*Change the following line to your display resolution*/
|
||||
disp_drv.hor_res = screenWidth;
|
||||
@@ -106,31 +106,30 @@ void setup()
|
||||
lv_disp_drv_register( &disp_drv );
|
||||
|
||||
/*Initialize the (dummy) input device driver*/
|
||||
static lv_indev_t indev_drv;
|
||||
static lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init( &indev_drv );
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = my_touchpad_read;
|
||||
lv_indev_drv_register( &indev_drv );
|
||||
|
||||
#if 0
|
||||
|
||||
/* Create simple label */
|
||||
lv_obj_t *label = lv_label_create( lv_scr_act() );
|
||||
lv_label_set_text( label, LVGL_Arduino.c_str() );
|
||||
lv_label_set_text( label, "Hello Ardino and LVGL!");
|
||||
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
|
||||
#else
|
||||
/* Try an example from the lv_examples Arduino library
|
||||
make sure to include it as written above.
|
||||
lv_example_btn_1();
|
||||
*/
|
||||
|
||||
// uncomment one of these demos
|
||||
lv_demo_widgets(); // OK
|
||||
// lv_demo_benchmark(); // OK
|
||||
// lv_demo_keypad_encoder(); // works, but I haven't an encoder
|
||||
// lv_demo_music(); // NOK
|
||||
|
||||
/* Try an example. See all the examples
|
||||
* online: https://docs.lvgl.io/master/examples.html
|
||||
* source codes: https://github.com/lvgl/lvgl/tree/e7f88efa5853128bf871dde335c0ca8da9eb7731/examples */
|
||||
//lv_example_btn_1();
|
||||
|
||||
/*Or try out a demo. Don't forget to enable the demos in lv_conf.h. E.g. LV_USE_DEMOS_WIDGETS*/
|
||||
//lv_demo_widgets();
|
||||
// lv_demo_benchmark();
|
||||
// lv_demo_keypad_encoder();
|
||||
// lv_demo_music();
|
||||
// lv_demo_printer();
|
||||
// lv_demo_stress(); // seems to be OK
|
||||
#endif
|
||||
// lv_demo_stress();
|
||||
|
||||
Serial.println( "Setup done" );
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples -name \*.c)
|
||||
CSRCS += $(shell find -L $(LVGL_DIR)/$(LVGL_DIR_NAME)/examples -name "*.c")
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_TABVIEW && LV_BUILD_EXAMPLES
|
||||
|
||||
static void scroll_begin_event(lv_event_t * e)
|
||||
{
|
||||
/*Disable the scroll animations. Triggered when a tab button is clicked */
|
||||
if(lv_event_get_code(e) == LV_EVENT_SCROLL_BEGIN) {
|
||||
lv_anim_t * a = lv_event_get_param(e);
|
||||
if(a) a->time = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void lv_example_tabview_2(void)
|
||||
{
|
||||
/*Create a Tab view object*/
|
||||
lv_obj_t * tabview;
|
||||
tabview = lv_tabview_create(lv_scr_act(), LV_DIR_LEFT, 80);
|
||||
lv_obj_add_event_cb(lv_tabview_get_content(tabview), scroll_begin_event, LV_EVENT_SCROLL_BEGIN, NULL);
|
||||
|
||||
lv_obj_set_style_bg_color(tabview, lv_palette_lighten(LV_PALETTE_RED, 2), 0);
|
||||
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
def scroll_begin_event(e):
|
||||
|
||||
#Disable the scroll animations. Triggered when a tab button is clicked */
|
||||
if e.get_code() == lv.EVENT.SCROLL_BEGIN:
|
||||
a = lv.anim_t.__cast__(e.get_param())
|
||||
if a:
|
||||
a.time = 0
|
||||
|
||||
# Create a Tab view object
|
||||
tabview = lv.tabview(lv.scr_act(), lv.DIR.LEFT, 80)
|
||||
tabview.get_content().add_event_cb(scroll_begin_event, lv.EVENT.SCROLL_BEGIN, None)
|
||||
|
||||
tabview.set_style_bg_color(lv.palette_lighten(lv.PALETTE.RED, 2), 0)
|
||||
|
||||
tab_btns = tabview.get_tab_btns()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "8.3.7",
|
||||
"version": "8.3.11",
|
||||
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
|
||||
"repository": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=lvgl
|
||||
version=8.3.7
|
||||
version=8.3.11
|
||||
author=kisvegabor
|
||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||
sentence=Full-featured Graphics Library for Embedded Systems
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v8.3.7
|
||||
* Configuration file for v8.3.11
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -187,6 +187,14 @@
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Enable RA6M3 G2D GPU*/
|
||||
#define LV_USE_GPU_RA6M3_G2D 0
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
/*include path of target processor
|
||||
e.g. "hal_data.h"*/
|
||||
#define LV_GPU_RA6M3_G2D_INCLUDE "hal_data.h"
|
||||
#endif
|
||||
|
||||
/*Use SWM341's DMA2D GPU*/
|
||||
#define LV_USE_GPU_SWM341_DMA2D 0
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
@@ -631,6 +639,13 @@
|
||||
#define LV_FS_FATFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*API for LittleFS (library needs to be added separately). Uses lfs_file_open, lfs_file_read, etc*/
|
||||
#define LV_USE_FS_LITTLEFS 0
|
||||
#if LV_USE_FS_LITTLEFS
|
||||
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
|
||||
#define LV_FS_LITTLEFS_CACHE_SIZE 0 /*>0 to cache this number of bytes in lv_fs_read()*/
|
||||
#endif
|
||||
|
||||
/*PNG decoder library*/
|
||||
#define LV_USE_PNG 0
|
||||
|
||||
@@ -664,6 +679,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Tiny TTF library*/
|
||||
#define LV_USE_TINY_TTF 0
|
||||
#if LV_USE_TINY_TTF
|
||||
/*Load TTF data from files*/
|
||||
#define LV_TINY_TTF_FILE_SUPPORT 0
|
||||
#endif
|
||||
|
||||
/*Rlottie library*/
|
||||
#define LV_USE_RLOTTIE 0
|
||||
|
||||
|
||||
2
lvgl.h
2
lvgl.h
@@ -15,7 +15,7 @@ extern "C" {
|
||||
***************************/
|
||||
#define LVGL_VERSION_MAJOR 8
|
||||
#define LVGL_VERSION_MINOR 3
|
||||
#define LVGL_VERSION_PATCH 7
|
||||
#define LVGL_VERSION_PATCH 11
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -163,7 +163,7 @@ props = [
|
||||
|
||||
{'name': 'BORDER_WIDTH',
|
||||
'style_type': 'num', 'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set hte width of the border. Only pixel values can be used."},
|
||||
'dsc': "Set the width of the border. Only pixel values can be used."},
|
||||
|
||||
{'name': 'BORDER_SIDE',
|
||||
'style_type': 'num', 'var_type': 'lv_border_side_t', 'default':'`LV_BORDER_SIDE_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
@@ -316,6 +316,10 @@ props = [
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." },
|
||||
|
||||
{'name': 'OPA_LAYERED',
|
||||
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "First draw the object on the layer, then scale down layer opacity factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." },
|
||||
|
||||
{'name': 'COLOR_FILTER_DSC',
|
||||
'style_type': 'ptr', 'var_type': 'const lv_color_filter_dsc_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
|
||||
'dsc': "Mix a color to all colors of the object." },
|
||||
@@ -346,7 +350,7 @@ props = [
|
||||
|
||||
{'name': 'LAYOUT',
|
||||
'style_type': 'num', 'var_type': 'uint16_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
|
||||
'dsc': "Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts."},
|
||||
'dsc': "Set the layout of the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts."},
|
||||
|
||||
{'name': 'BASE_DIR',
|
||||
'style_type': 'num', 'var_type': 'lv_base_dir_t', 'default':'`LV_BASE_DIR_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
|
||||
|
||||
@@ -224,9 +224,13 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_disp_t * d = lv_obj_get_disp(new_scr);
|
||||
lv_obj_t * act_scr = lv_scr_act();
|
||||
|
||||
if(act_scr == new_scr || d->scr_to_load == new_scr) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*If an other screen load animation is in progress
|
||||
*make target screen loaded immediately. */
|
||||
if(d->scr_to_load && act_scr != d->scr_to_load) {
|
||||
if(d->scr_to_load) {
|
||||
scr_load_internal(d->scr_to_load);
|
||||
lv_anim_del(d->scr_to_load, NULL);
|
||||
lv_obj_set_pos(d->scr_to_load, 0, 0);
|
||||
@@ -258,10 +262,10 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
|
||||
lv_obj_remove_local_style_prop(new_scr, LV_STYLE_OPA, 0);
|
||||
lv_obj_remove_local_style_prop(lv_scr_act(), LV_STYLE_OPA, 0);
|
||||
|
||||
|
||||
/*Shortcut for immediate load*/
|
||||
if(time == 0 && delay == 0) {
|
||||
scr_load_internal(new_scr);
|
||||
if(auto_del) lv_obj_del(act_scr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -477,6 +481,7 @@ static void scr_load_internal(lv_obj_t * scr)
|
||||
if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOAD_START, NULL);
|
||||
|
||||
d->act_scr = scr;
|
||||
d->scr_to_load = NULL;
|
||||
|
||||
if(d->act_scr) lv_event_send(scr, LV_EVENT_SCREEN_LOADED, NULL);
|
||||
if(d->act_scr) lv_event_send(old_scr, LV_EVENT_SCREEN_UNLOADED, NULL);
|
||||
|
||||
@@ -356,16 +356,16 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
/*Simple sanity check*/
|
||||
if(data->point.x < 0) {
|
||||
LV_LOG_WARN("X is %d which is smaller than zero", data->point.x);
|
||||
LV_LOG_WARN("X is %d which is smaller than zero", (int)data->point.x);
|
||||
}
|
||||
if(data->point.x >= lv_disp_get_hor_res(i->driver->disp)) {
|
||||
LV_LOG_WARN("X is %d which is greater than hor. res", data->point.x);
|
||||
LV_LOG_WARN("X is %d which is greater than hor. res", (int)data->point.x);
|
||||
}
|
||||
if(data->point.y < 0) {
|
||||
LV_LOG_WARN("Y is %d which is smaller than zero", data->point.y);
|
||||
LV_LOG_WARN("Y is %d which is smaller than zero", (int)data->point.y);
|
||||
}
|
||||
if(data->point.y >= lv_disp_get_ver_res(i->driver->disp)) {
|
||||
LV_LOG_WARN("Y is %d which is greater than ver. res", data->point.y);
|
||||
LV_LOG_WARN("Y is %d which is greater than ver. res", (int)data->point.y);
|
||||
}
|
||||
|
||||
/*Move the cursor if set and moved*/
|
||||
|
||||
@@ -30,6 +30,10 @@
|
||||
#include "../draw/stm32_dma2d/lv_gpu_stm32_dma2d.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
#include "../draw/renesas/lv_gpu_d2_ra6m3.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
#include "../draw/swm341_dma2d/lv_gpu_swm341_dma2d.h"
|
||||
#endif
|
||||
@@ -119,6 +123,11 @@ void lv_init(void)
|
||||
lv_draw_stm32_dma2d_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
/*Initialize G2D GPU*/
|
||||
lv_draw_ra6m3_g2d_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
/*Initialize DMA2D GPU*/
|
||||
lv_draw_swm341_dma2d_init();
|
||||
@@ -140,9 +149,9 @@ void lv_init(void)
|
||||
lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE);
|
||||
#endif
|
||||
/*Test if the IDE has UTF-8 encoding*/
|
||||
char * txt = "Á";
|
||||
const char * txt = "Á";
|
||||
|
||||
uint8_t * txt_u8 = (uint8_t *)txt;
|
||||
const uint8_t * txt_u8 = (uint8_t *)txt;
|
||||
if(txt_u8[0] != 0xc3 || txt_u8[1] != 0x81 || txt_u8[2] != 0x00) {
|
||||
LV_LOG_WARN("The strings have no UTF-8 encoding. Non-ASCII characters won't be displayed.");
|
||||
}
|
||||
@@ -223,12 +232,22 @@ void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f)
|
||||
|
||||
bool was_on_layout = lv_obj_is_layout_positioned(obj);
|
||||
|
||||
/* We must invalidate the area occupied by the object before we hide it as calls to invalidate hidden objects are ignored */
|
||||
if(f & LV_OBJ_FLAG_HIDDEN) lv_obj_invalidate(obj);
|
||||
|
||||
obj->flags |= f;
|
||||
|
||||
if(f & LV_OBJ_FLAG_HIDDEN) {
|
||||
lv_obj_invalidate(obj);
|
||||
if(lv_obj_has_state(obj, LV_STATE_FOCUSED)) {
|
||||
lv_group_t * group = lv_obj_get_group(obj);
|
||||
if(group != NULL) {
|
||||
lv_group_focus_next(group);
|
||||
lv_obj_t * next_obj = lv_group_get_focused(group);
|
||||
if(next_obj != NULL) {
|
||||
lv_obj_invalidate(next_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((was_on_layout != lv_obj_is_layout_positioned(obj)) || (f & (LV_OBJ_FLAG_LAYOUT_1 | LV_OBJ_FLAG_LAYOUT_2))) {
|
||||
@@ -494,6 +513,11 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
return;
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
|
||||
info->res = LV_COVER_RES_NOT_COVER;
|
||||
return;
|
||||
}
|
||||
|
||||
info->res = LV_COVER_RES_COVER;
|
||||
|
||||
}
|
||||
@@ -678,7 +702,7 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
}
|
||||
}
|
||||
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, LV_PART_SCROLLBAR);
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, LV_PART_SCROLLBAR);
|
||||
if(opa < LV_OPA_MAX) {
|
||||
dsc->bg_opa = (dsc->bg_opa * opa) >> 8;
|
||||
dsc->border_opa = (dsc->bg_opa * opa) >> 8;
|
||||
@@ -709,9 +733,9 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
else if(code == LV_EVENT_RELEASED) {
|
||||
lv_obj_clear_state(obj, LV_STATE_PRESSED);
|
||||
void * param = lv_event_get_param(e);
|
||||
lv_indev_t * indev = lv_event_get_indev(e);
|
||||
/*Go the checked state if enabled*/
|
||||
if(lv_indev_get_scroll_obj(param) == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) {
|
||||
if(lv_indev_get_scroll_obj(indev) == NULL && lv_obj_has_flag(obj, LV_OBJ_FLAG_CHECKABLE)) {
|
||||
if(!(lv_obj_get_state(obj) & LV_STATE_CHECKED)) lv_obj_add_state(obj, LV_STATE_CHECKED);
|
||||
else lv_obj_clear_state(obj, LV_STATE_CHECKED);
|
||||
|
||||
@@ -838,6 +862,10 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_CHILD_DELETED) {
|
||||
obj->readjust_scroll_after_layout = 1;
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN);
|
||||
lv_event_set_ext_draw_size(e, d);
|
||||
|
||||
@@ -183,11 +183,13 @@ typedef struct _lv_obj_t {
|
||||
lv_obj_flag_t flags;
|
||||
lv_state_t state;
|
||||
uint16_t layout_inv : 1;
|
||||
uint16_t readjust_scroll_after_layout : 1;
|
||||
uint16_t scr_layout_inv : 1;
|
||||
uint16_t skip_trans : 1;
|
||||
uint16_t style_cnt : 6;
|
||||
uint16_t h_layout : 1;
|
||||
uint16_t w_layout : 1;
|
||||
uint16_t being_deleted : 1;
|
||||
} lv_obj_t;
|
||||
|
||||
|
||||
|
||||
@@ -38,9 +38,8 @@
|
||||
|
||||
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc)
|
||||
{
|
||||
lv_opa_t opa = LV_OPA_COVER;
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(part != LV_PART_MAIN) {
|
||||
opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->bg_opa = LV_OPA_TRANSP;
|
||||
draw_dsc->bg_img_opa = LV_OPA_TRANSP;
|
||||
@@ -180,15 +179,12 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->bg_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->bg_img_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->border_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->outline_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->bg_opa = (opa * draw_dsc->bg_opa) >> 8;
|
||||
draw_dsc->bg_img_opa = (opa * draw_dsc->bg_img_opa) >> 8;
|
||||
draw_dsc->border_opa = (opa * draw_dsc->border_opa) >> 8;
|
||||
draw_dsc->outline_opa = (opa * draw_dsc->outline_opa) >> 8;
|
||||
draw_dsc->shadow_opa = (opa * draw_dsc->shadow_opa) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,16 +193,15 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
|
||||
draw_dsc->opa = lv_obj_get_style_text_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
|
||||
@@ -230,16 +225,15 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t *
|
||||
draw_dsc->opa = lv_obj_get_style_img_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->angle = 0;
|
||||
draw_dsc->zoom = LV_IMG_ZOOM_NONE;
|
||||
@@ -260,16 +254,15 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t
|
||||
draw_dsc->opa = lv_obj_get_style_line_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->width = lv_obj_get_style_line_width(obj, part);
|
||||
if(draw_dsc->width == 0) return;
|
||||
@@ -297,16 +290,15 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
|
||||
draw_dsc->opa = lv_obj_get_style_arc_opa(obj, part);
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
lv_opa_t opa = lv_obj_get_style_opa_recursive(obj, part);
|
||||
if(opa <= LV_OPA_MIN) {
|
||||
draw_dsc->opa = LV_OPA_TRANSP;
|
||||
return;
|
||||
}
|
||||
if(opa < LV_OPA_MAX) {
|
||||
draw_dsc->opa = (opa * draw_dsc->opa) >> 8;
|
||||
}
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
draw_dsc->color = lv_obj_get_style_arc_color_filtered(obj, part);
|
||||
draw_dsc->img_src = lv_obj_get_style_arc_img_src(obj, part);
|
||||
|
||||
@@ -200,7 +200,7 @@ bool lv_obj_refr_size(lv_obj_t * obj)
|
||||
/*Invalidate the new area*/
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
lv_obj_readjust_scroll(obj, LV_ANIM_OFF);
|
||||
obj->readjust_scroll_after_layout = 1;
|
||||
|
||||
/*If the object was out of the parent invalidate the new scrollbar area too.
|
||||
*If it wasn't out of the parent but out now, also invalidate the scrollbars*/
|
||||
@@ -1137,20 +1137,24 @@ static void layout_update_core(lv_obj_t * obj)
|
||||
layout_update_core(child);
|
||||
}
|
||||
|
||||
if(obj->layout_inv == 0) return;
|
||||
if(obj->layout_inv) {
|
||||
obj->layout_inv = 0;
|
||||
lv_obj_refr_size(obj);
|
||||
lv_obj_refr_pos(obj);
|
||||
|
||||
obj->layout_inv = 0;
|
||||
|
||||
lv_obj_refr_size(obj);
|
||||
lv_obj_refr_pos(obj);
|
||||
|
||||
if(child_cnt > 0) {
|
||||
uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN);
|
||||
if(layout_id > 0 && layout_id <= layout_cnt) {
|
||||
void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id - 1].user_data;
|
||||
LV_GC_ROOT(_lv_layout_list)[layout_id - 1].cb(obj, user_data);
|
||||
if(child_cnt > 0) {
|
||||
uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN);
|
||||
if(layout_id > 0 && layout_id <= layout_cnt) {
|
||||
void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id - 1].user_data;
|
||||
LV_GC_ROOT(_lv_layout_list)[layout_id - 1].cb(obj, user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(obj->readjust_scroll_after_layout) {
|
||||
obj->readjust_scroll_after_layout = 0;
|
||||
lv_obj_readjust_scroll(obj, LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
|
||||
|
||||
@@ -290,7 +290,7 @@ void lv_obj_get_scrollbar_area(struct _lv_obj_t * obj, lv_area_t * hor, lv_area_
|
||||
void lv_obj_scrollbar_invalidate(struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Checked if the content is scrolled "in" and adjusts it to a normal position.
|
||||
* Checks if the content is scrolled "in" and adjusts it to a normal position.
|
||||
* @param obj pointer to an object
|
||||
* @param anim_en LV_ANIM_ON/OFF
|
||||
*/
|
||||
|
||||
@@ -496,6 +496,40 @@ lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj,
|
||||
return align;
|
||||
}
|
||||
|
||||
lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part)
|
||||
{
|
||||
|
||||
lv_opa_t opa_obj = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
|
||||
lv_opa_t opa_final = LV_OPA_COVER;
|
||||
if(opa_obj < LV_OPA_MAX) {
|
||||
opa_final = ((uint32_t)opa_final * opa_obj) >> 8;
|
||||
}
|
||||
|
||||
if(part != LV_PART_MAIN) {
|
||||
part = LV_PART_MAIN;
|
||||
}
|
||||
else {
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
while(obj) {
|
||||
opa_obj = lv_obj_get_style_opa(obj, part);
|
||||
if(opa_obj <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_obj < LV_OPA_MAX) {
|
||||
opa_final = ((uint32_t)opa_final * opa_obj) >> 8;
|
||||
}
|
||||
|
||||
obj = lv_obj_get_parent(obj);
|
||||
}
|
||||
|
||||
if(opa_final <= LV_OPA_MIN) return LV_OPA_TRANSP;
|
||||
if(opa_final >= LV_OPA_MAX) return LV_OPA_COVER;
|
||||
return opa_final;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -846,8 +880,7 @@ static lv_layer_type_t calculate_layer_type(lv_obj_t * obj)
|
||||
{
|
||||
if(lv_obj_get_style_transform_angle(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_transform_zoom(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_opa(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
|
||||
|
||||
if(lv_obj_get_style_opa_layered(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
|
||||
#endif
|
||||
|
||||
@@ -236,6 +236,21 @@ static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t valu
|
||||
|
||||
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt);
|
||||
|
||||
static inline lv_coord_t lv_obj_get_style_transform_zoom_safe(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
int16_t zoom = lv_obj_get_style_transform_zoom(obj, part);
|
||||
return zoom != 0 ? zoom : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the `opa` style property from all parents and multiply and `>> 8` them.
|
||||
* @param obj the object whose opacity should be get
|
||||
* @param part the part whose opacity should be get. Non-MAIN parts will consider the `opa` of teh MAIN part too
|
||||
* @return the final opacity considering the parents' opacity too
|
||||
*/
|
||||
lv_opa_t lv_obj_get_style_opa_recursive(const struct _lv_obj_t * obj, lv_part_t part);
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -600,6 +600,14 @@ void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selec
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA_LAYERED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
|
||||
@@ -508,6 +508,12 @@ static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline lv_opa_t lv_obj_get_style_opa_layered(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED);
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
|
||||
@@ -637,6 +643,7 @@ void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value,
|
||||
void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim(struct _lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector);
|
||||
|
||||
@@ -49,9 +49,6 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
if(par) {
|
||||
lv_obj_scrollbar_invalidate(par);
|
||||
}
|
||||
|
||||
lv_disp_t * disp = NULL;
|
||||
bool act_scr_del = false;
|
||||
@@ -65,8 +62,6 @@ void lv_obj_del(lv_obj_t * obj)
|
||||
|
||||
/*Call the ancestor's event handler to the parent to notify it about the child delete*/
|
||||
if(par) {
|
||||
lv_obj_update_layout(par);
|
||||
lv_obj_readjust_scroll(par, LV_ANIM_OFF);
|
||||
lv_obj_scrollbar_invalidate(par);
|
||||
lv_event_send(par, LV_EVENT_CHILD_CHANGED, NULL);
|
||||
lv_event_send(par, LV_EVENT_CHILD_DELETED, NULL);
|
||||
@@ -173,7 +168,6 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
obj->parent = parent;
|
||||
|
||||
/*Notify the original parent because one of its children is lost*/
|
||||
lv_obj_readjust_scroll(old_parent, LV_ANIM_OFF);
|
||||
lv_obj_scrollbar_invalidate(old_parent);
|
||||
lv_event_send(old_parent, LV_EVENT_CHILD_CHANGED, obj);
|
||||
lv_event_send(old_parent, LV_EVENT_CHILD_DELETED, NULL);
|
||||
@@ -360,6 +354,8 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
lv_res_t res = lv_event_send(obj, LV_EVENT_DELETE, NULL);
|
||||
if(res == LV_RES_INV) return;
|
||||
|
||||
obj->being_deleted = 1;
|
||||
|
||||
/*Recursively delete the children*/
|
||||
lv_obj_t * child = lv_obj_get_child(obj, 0);
|
||||
while(child) {
|
||||
|
||||
@@ -53,6 +53,7 @@ typedef struct {
|
||||
**********************/
|
||||
static void lv_refr_join_area(void);
|
||||
static void refr_invalid_areas(void);
|
||||
static void refr_sync_areas(void);
|
||||
static void refr_area(const lv_area_t * area_p);
|
||||
static void refr_area_part(lv_draw_ctx_t * draw_ctx);
|
||||
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
|
||||
@@ -320,12 +321,25 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
}
|
||||
|
||||
lv_refr_join_area();
|
||||
|
||||
refr_sync_areas();
|
||||
refr_invalid_areas();
|
||||
|
||||
/*If refresh happened ...*/
|
||||
if(disp_refr->inv_p != 0) {
|
||||
|
||||
/*Copy invalid areas for sync next refresh in double buffered direct mode*/
|
||||
if(disp_refr->driver->direct_mode && disp_refr->driver->draw_buf->buf2) {
|
||||
|
||||
uint16_t i;
|
||||
for(i = 0; i < disp_refr->inv_p; i++) {
|
||||
if(disp_refr->inv_area_joined[i])
|
||||
continue;
|
||||
|
||||
lv_area_t * sync_area = _lv_ll_ins_tail(&disp_refr->sync_areas);
|
||||
*sync_area = disp_refr->inv_areas[i];
|
||||
}
|
||||
}
|
||||
|
||||
/*Clean up*/
|
||||
lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
lv_memset_00(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
|
||||
@@ -495,6 +509,78 @@ static void lv_refr_join_area(void)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the sync areas
|
||||
*/
|
||||
static void refr_sync_areas(void)
|
||||
{
|
||||
/*Do not sync if not direct mode*/
|
||||
if(!disp_refr->driver->direct_mode) return;
|
||||
|
||||
/*Do not sync if not double buffered*/
|
||||
if(disp_refr->driver->draw_buf->buf2 == NULL) return;
|
||||
|
||||
/*Do not sync if no sync areas*/
|
||||
if(_lv_ll_is_empty(&disp_refr->sync_areas)) return;
|
||||
|
||||
/*The buffers are already swapped.
|
||||
*So the active buffer is the off screen buffer where LVGL will render*/
|
||||
void * buf_off_screen = disp_refr->driver->draw_buf->buf_act;
|
||||
void * buf_on_screen = disp_refr->driver->draw_buf->buf_act == disp_refr->driver->draw_buf->buf1
|
||||
? disp_refr->driver->draw_buf->buf2
|
||||
: disp_refr->driver->draw_buf->buf1;
|
||||
|
||||
/*Get stride for buffer copy*/
|
||||
lv_coord_t stride = lv_disp_get_hor_res(disp_refr);
|
||||
|
||||
/*Iterate through invalidated areas to see if sync area should be copied*/
|
||||
lv_area_t res[4] = {0};
|
||||
int8_t res_c, j;
|
||||
uint32_t i;
|
||||
lv_area_t * sync_area, *new_area, *next_area;
|
||||
for(i = 0; i < disp_refr->inv_p; i++) {
|
||||
/*Skip joined areas*/
|
||||
if(disp_refr->inv_area_joined[i]) continue;
|
||||
|
||||
/*Iterate over sync areas*/
|
||||
sync_area = _lv_ll_get_head(&disp_refr->sync_areas);
|
||||
while(sync_area != NULL) {
|
||||
/*Get next sync area*/
|
||||
next_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area);
|
||||
|
||||
/*Remove intersect of redraw area from sync area and get remaining areas*/
|
||||
res_c = _lv_area_diff(res, sync_area, &disp_refr->inv_areas[i]);
|
||||
|
||||
/*New sub areas created after removing intersect*/
|
||||
if(res_c != -1) {
|
||||
/*Replace old sync area with new areas*/
|
||||
for(j = 0; j < res_c; j++) {
|
||||
new_area = _lv_ll_ins_prev(&disp_refr->sync_areas, sync_area);
|
||||
*new_area = res[j];
|
||||
}
|
||||
_lv_ll_remove(&disp_refr->sync_areas, sync_area);
|
||||
lv_mem_free(sync_area);
|
||||
}
|
||||
|
||||
/*Move on to next sync area*/
|
||||
sync_area = next_area;
|
||||
}
|
||||
}
|
||||
|
||||
/*Copy sync areas (if any remaining)*/
|
||||
for(sync_area = _lv_ll_get_head(&disp_refr->sync_areas); sync_area != NULL;
|
||||
sync_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area)) {
|
||||
disp_refr->driver->draw_ctx->buffer_copy(
|
||||
disp_refr->driver->draw_ctx,
|
||||
buf_off_screen, stride, sync_area,
|
||||
buf_on_screen, stride, sync_area
|
||||
);
|
||||
}
|
||||
|
||||
/*Clear sync areas*/
|
||||
_lv_ll_clear(&disp_refr->sync_areas);
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh the joined areas
|
||||
*/
|
||||
@@ -888,7 +974,7 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
lv_obj_redraw(draw_ctx, obj);
|
||||
}
|
||||
else {
|
||||
lv_opa_t opa = lv_obj_get_style_opa(obj, 0);
|
||||
lv_opa_t opa = lv_obj_get_style_opa_layered(obj, 0);
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
|
||||
lv_area_t layer_area_full;
|
||||
@@ -1027,7 +1113,7 @@ static void draw_buf_rotate_180(lv_disp_drv_t * drv, lv_area_t * area, lv_color_
|
||||
area->x1 = drv->hor_res - tmp_coord - 1;
|
||||
}
|
||||
|
||||
static LV_ATTRIBUTE_FAST_MEM void draw_buf_rotate_90(bool invert_i, lv_coord_t area_w, lv_coord_t area_h,
|
||||
static void LV_ATTRIBUTE_FAST_MEM draw_buf_rotate_90(bool invert_i, lv_coord_t area_w, lv_coord_t area_h,
|
||||
lv_color_t * orig_color_p, lv_color_t * rot_buf)
|
||||
{
|
||||
|
||||
|
||||
@@ -418,19 +418,17 @@
|
||||
**********************/
|
||||
|
||||
#if __ARM_2D_HAS_HW_ACC__
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool lv_draw_arm2d_fill_colour(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const arm_2d_tile_t * mask_tile);
|
||||
static bool /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_arm2d_fill_colour(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const arm_2d_tile_t * mask_tile);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool lv_draw_arm2d_tile_copy(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
arm_2d_tile_t * source_tile,
|
||||
lv_opa_t opa,
|
||||
arm_2d_tile_t * mask_tile);
|
||||
static bool /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_arm2d_tile_copy(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
arm_2d_tile_t * source_tile,
|
||||
lv_opa_t opa,
|
||||
arm_2d_tile_t * mask_tile);
|
||||
#else
|
||||
|
||||
static void convert_cb(const lv_area_t * dest_area,
|
||||
@@ -443,36 +441,32 @@ static void convert_cb(const lv_area_t * dest_area,
|
||||
lv_color_t * cbuf,
|
||||
lv_opa_t * abuf);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool arm_2d_fill_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride);
|
||||
static bool /* LV_ATTRIBUTE_FAST_MEM */ arm_2d_fill_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf,
|
||||
lv_coord_t src_stride,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride);
|
||||
static bool /* LV_ATTRIBUTE_FAST_MEM */ arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf,
|
||||
lv_coord_t src_stride,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride);
|
||||
#endif
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_gpu_arm2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords,
|
||||
const uint8_t * src_buf,
|
||||
lv_img_cf_t cf);
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_sw_blend_dsc_t * dsc);
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ lv_gpu_arm2d_wait_cb(lv_draw_ctx_t * draw_ctx);
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords,
|
||||
const uint8_t * src_buf,
|
||||
lv_img_cf_t cf);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -512,8 +506,8 @@ void lv_draw_arm2d_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
extern void test_flush(lv_color_t * color_p);
|
||||
|
||||
#if __ARM_2D_HAS_HW_ACC__
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
static void LV_ATTRIBUTE_FAST_MEM lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
const lv_opa_t * mask;
|
||||
if(dsc->mask_buf == NULL) mask = NULL;
|
||||
@@ -560,12 +554,11 @@ static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool lv_draw_arm2d_fill_colour(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const arm_2d_tile_t * mask_tile)
|
||||
static bool LV_ATTRIBUTE_FAST_MEM lv_draw_arm2d_fill_colour(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const arm_2d_tile_t * mask_tile)
|
||||
{
|
||||
arm_fsm_rt_t result = (arm_fsm_rt_t)ARM_2D_ERR_NONE;
|
||||
|
||||
@@ -623,12 +616,11 @@ static bool lv_draw_arm2d_fill_colour(const arm_2d_tile_t * target_tile,
|
||||
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool lv_draw_arm2d_tile_copy(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
arm_2d_tile_t * source_tile,
|
||||
lv_opa_t opa,
|
||||
arm_2d_tile_t * mask_tile)
|
||||
static bool LV_ATTRIBUTE_FAST_MEM lv_draw_arm2d_tile_copy(const arm_2d_tile_t * target_tile,
|
||||
const arm_2d_region_t * region,
|
||||
arm_2d_tile_t * source_tile,
|
||||
lv_opa_t opa,
|
||||
arm_2d_tile_t * mask_tile)
|
||||
{
|
||||
arm_fsm_rt_t result = (arm_fsm_rt_t)ARM_2D_ERR_NONE;
|
||||
|
||||
@@ -691,8 +683,8 @@ static void lv_gpu_arm2d_wait_cb(lv_draw_ctx_t * draw_ctx)
|
||||
#else
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
static void LV_ATTRIBUTE_FAST_MEM lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
const lv_opa_t * mask;
|
||||
if(dsc->mask_buf == NULL) mask = NULL;
|
||||
@@ -777,14 +769,13 @@ static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend
|
||||
if(!is_accelerated) lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool arm_2d_fill_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride)
|
||||
static bool LV_ATTRIBUTE_FAST_MEM arm_2d_fill_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
lv_color_t color,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride)
|
||||
{
|
||||
arm_2d_size_t target_size = {
|
||||
.iWidth = lv_area_get_width(dest_area),
|
||||
@@ -835,15 +826,14 @@ static bool arm_2d_fill_normal(lv_color_t * dest_buf,
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static bool arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf,
|
||||
lv_coord_t src_stride,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride)
|
||||
static bool LV_ATTRIBUTE_FAST_MEM arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
const lv_area_t * dest_area,
|
||||
lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf,
|
||||
lv_coord_t src_stride,
|
||||
lv_opa_t opa,
|
||||
const lv_opa_t * mask,
|
||||
lv_coord_t mask_stride)
|
||||
|
||||
{
|
||||
int32_t w = lv_area_get_width(dest_area);
|
||||
@@ -908,12 +898,11 @@ static bool arm_2d_copy_normal(lv_color_t * dest_buf,
|
||||
return true;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM
|
||||
static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords,
|
||||
const uint8_t * src_buf,
|
||||
lv_img_cf_t cf)
|
||||
static void LV_ATTRIBUTE_FAST_MEM lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords,
|
||||
const uint8_t * src_buf,
|
||||
lv_img_cf_t cf)
|
||||
{
|
||||
/*Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
|
||||
@@ -25,8 +25,9 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src);
|
||||
static lv_res_t /* LV_ATTRIBUTE_FAST_MEM */ decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src);
|
||||
|
||||
static void show_error(lv_draw_ctx_t * draw_ctx, const lv_area_t * coords, const char * msg);
|
||||
static void draw_cleanup(_lv_img_cache_entry_t * cache);
|
||||
@@ -198,11 +199,19 @@ lv_img_src_t lv_img_src_get_type(const void * src)
|
||||
if(src == NULL) return img_src_type;
|
||||
const uint8_t * u8_p = src;
|
||||
|
||||
/*The first byte shows the type of the image source*/
|
||||
/*The first or fourth byte depending on platform endianess shows the type of the image source*/
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
if(u8_p[3] >= 0x20 && u8_p[3] <= 0x7F) {
|
||||
#else
|
||||
if(u8_p[0] >= 0x20 && u8_p[0] <= 0x7F) {
|
||||
#endif
|
||||
img_src_type = LV_IMG_SRC_FILE; /*If it's an ASCII character then it's file name*/
|
||||
}
|
||||
#if LV_BIG_ENDIAN_SYSTEM
|
||||
else if(u8_p[3] >= 0x80) {
|
||||
#else
|
||||
else if(u8_p[0] >= 0x80) {
|
||||
#endif
|
||||
img_src_type = LV_IMG_SRC_SYMBOL; /*Symbols begins after 0x7F*/
|
||||
}
|
||||
else {
|
||||
@@ -228,7 +237,8 @@ void lv_draw_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * draw_dsc,
|
||||
static lv_res_t LV_ATTRIBUTE_FAST_MEM decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
const lv_draw_img_dsc_t * draw_dsc,
|
||||
const lv_area_t * coords, const void * src)
|
||||
{
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return LV_RES_OK;
|
||||
|
||||
@@ -52,7 +52,7 @@ static uint8_t hex_char_to_num(char hex);
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
@@ -74,7 +74,7 @@ void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the draw to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_label(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_area_t * coords, const char * txt, lv_draw_label_hint_t * hint)
|
||||
{
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
|
||||
@@ -68,7 +68,7 @@ struct _lv_draw_ctx_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Write a text
|
||||
@@ -79,8 +79,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the draw to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_area_t * coords, const char * txt, lv_draw_label_hint_t * hint);
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_label(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_area_t * coords, const char * txt, lv_draw_label_hint_t * hint);
|
||||
|
||||
void lv_draw_letter(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter);
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t));
|
||||
dsc->width = 1;
|
||||
@@ -42,7 +42,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
dsc->color = lv_color_black();
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc,
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc,
|
||||
const lv_point_t * point1, const lv_point_t * point2)
|
||||
{
|
||||
if(dsc->width == 0) return;
|
||||
|
||||
@@ -43,7 +43,7 @@ struct _lv_draw_ctx_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Draw a line
|
||||
@@ -52,8 +52,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
* @param clip the line will be drawn only in this area
|
||||
* @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2);
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_line(struct _lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc,
|
||||
const lv_point_t * point1, const lv_point_t * point2);
|
||||
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -26,31 +26,31 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_polygon(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_polygon_param_t * param);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * param);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * param);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * param);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * param);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_polygon(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_polygon_param_t * param);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
static lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
|
||||
static void circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius);
|
||||
static bool circ_cont(lv_point_t * c);
|
||||
@@ -58,7 +58,7 @@ static void circ_next(lv_point_t * c, lv_coord_t * tmp);
|
||||
static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radius);
|
||||
static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len,
|
||||
lv_coord_t * x_start);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new);
|
||||
static inline lv_opa_t /* LV_ATTRIBUTE_FAST_MEM */ mask_mix(lv_opa_t mask_act, lv_opa_t mask_new);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -108,8 +108,8 @@ int16_t lv_draw_mask_add(void * param, void * custom_id)
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len)
|
||||
lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len)
|
||||
{
|
||||
bool changed = false;
|
||||
_lv_draw_mask_common_dsc_t * dsc;
|
||||
@@ -142,8 +142,9 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len, const int16_t * ids, int16_t ids_count)
|
||||
lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
const int16_t * ids, int16_t ids_count)
|
||||
{
|
||||
bool changed = false;
|
||||
_lv_draw_mask_common_dsc_t * dsc;
|
||||
@@ -243,7 +244,7 @@ void _lv_draw_mask_cleanup(void)
|
||||
* Count the currently added masks
|
||||
* @return number of active masks
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void)
|
||||
uint8_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_get_cnt(void)
|
||||
{
|
||||
uint8_t cnt = 0;
|
||||
uint8_t i;
|
||||
@@ -593,7 +594,7 @@ void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_po
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
@@ -653,7 +654,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
return res;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
@@ -769,7 +770,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
@@ -911,7 +912,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * p)
|
||||
{
|
||||
@@ -1050,7 +1051,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * p)
|
||||
{
|
||||
@@ -1167,7 +1168,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * p)
|
||||
{
|
||||
@@ -1213,7 +1214,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mas
|
||||
}
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * p)
|
||||
{
|
||||
@@ -1247,7 +1248,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_polygon(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
static lv_draw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_mask_polygon(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_polygon_param_t * param)
|
||||
{
|
||||
@@ -1518,7 +1519,7 @@ static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new)
|
||||
static inline lv_opa_t LV_ATTRIBUTE_FAST_MEM mask_mix(lv_opa_t mask_act, lv_opa_t mask_new)
|
||||
{
|
||||
if(mask_new >= LV_OPA_MAX) return mask_act;
|
||||
if(mask_new <= LV_OPA_MIN) return 0;
|
||||
|
||||
@@ -241,8 +241,8 @@ int16_t lv_draw_mask_add(void * param, void * custom_id);
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len);
|
||||
lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len);
|
||||
|
||||
/**
|
||||
* Apply the specified buffers on a line. Used internally by the library's drawing routines.
|
||||
@@ -257,8 +257,9 @@ LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf,
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len, const int16_t * ids, int16_t ids_count);
|
||||
lv_draw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_apply_ids(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
const int16_t * ids, int16_t ids_count);
|
||||
|
||||
//! @endcond
|
||||
|
||||
@@ -299,7 +300,7 @@ void _lv_draw_mask_cleanup(void);
|
||||
* Count the currently added masks
|
||||
* @return number of active masks
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void);
|
||||
uint8_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_mask_get_cnt(void);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_rect_dsc_t));
|
||||
dsc->bg_color = lv_color_white();
|
||||
|
||||
@@ -74,7 +74,7 @@ struct _lv_draw_ctx_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
|
||||
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,17 +38,7 @@
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the color of an image's pixel
|
||||
* @param dsc an image descriptor
|
||||
* @param x x coordinate of the point to get
|
||||
* @param y x coordinate of the point to get
|
||||
* @param color the color of the image. In case of `LV_IMG_CF_ALPHA_1/2/4/8` this color is used.
|
||||
* Not used in other cases.
|
||||
* @param safe true: check out of bounds
|
||||
* @return color of the point
|
||||
*/
|
||||
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color)
|
||||
lv_color_t lv_img_buf_get_px_color(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color)
|
||||
{
|
||||
lv_color_t p_color = lv_color_black();
|
||||
uint8_t * buf_u8 = (uint8_t *)dsc->data;
|
||||
@@ -107,15 +97,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
return p_color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the alpha value of an image's pixel
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param x x coordinate of the point to set
|
||||
* @param y x coordinate of the point to set
|
||||
* @param safe true: check out of bounds
|
||||
* @return alpha value of the point
|
||||
*/
|
||||
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
lv_opa_t lv_img_buf_get_px_alpha(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
uint8_t * buf_u8 = (uint8_t *)dsc->data;
|
||||
|
||||
@@ -170,15 +152,7 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
return LV_OPA_COVER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the alpha value of a pixel of an image. The color won't be affected
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param x x coordinate of the point to set
|
||||
* @param y x coordinate of the point to set
|
||||
* @param opa the desired opacity
|
||||
* @param safe true: check out of bounds
|
||||
*/
|
||||
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa)
|
||||
void lv_img_buf_set_px_alpha(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa)
|
||||
{
|
||||
uint8_t * buf_u8 = (uint8_t *)dsc->data;
|
||||
|
||||
@@ -229,15 +203,7 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the color of a pixel of an image. The alpha channel won't be affected.
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param x x coordinate of the point to set
|
||||
* @param y x coordinate of the point to set
|
||||
* @param c color of the point
|
||||
* @param safe true: check out of bounds
|
||||
*/
|
||||
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c)
|
||||
void lv_img_buf_set_px_color(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c)
|
||||
{
|
||||
uint8_t * buf_u8 = (uint8_t *)dsc->data;
|
||||
|
||||
@@ -296,17 +262,7 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
|
||||
* @param dsc pointer to an image descriptor
|
||||
* @param id the palette color to set:
|
||||
* - for `LV_IMG_CF_INDEXED1`: 0..1
|
||||
* - for `LV_IMG_CF_INDEXED2`: 0..3
|
||||
* - for `LV_IMG_CF_INDEXED4`: 0..15
|
||||
* - for `LV_IMG_CF_INDEXED8`: 0..255
|
||||
* @param c the color to set
|
||||
*/
|
||||
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
void lv_img_buf_set_palette(const lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
{
|
||||
if((dsc->header.cf == LV_IMG_CF_ALPHA_1BIT && id > 1) || (dsc->header.cf == LV_IMG_CF_ALPHA_2BIT && id > 3) ||
|
||||
(dsc->header.cf == LV_IMG_CF_ALPHA_4BIT && id > 15) || (dsc->header.cf == LV_IMG_CF_ALPHA_8BIT)) {
|
||||
@@ -320,13 +276,6 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
lv_memcpy_small(&buf[id * sizeof(c32)], &c32, sizeof(c32));
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate an image buffer in RAM
|
||||
* @param w width of image
|
||||
* @param h height of image
|
||||
* @param cf a color format (`LV_IMG_CF_...`)
|
||||
* @return an allocated image, or NULL on failure
|
||||
*/
|
||||
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
{
|
||||
/*Allocate image descriptor*/
|
||||
@@ -359,10 +308,6 @@ lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
return dsc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free an allocated image buffer
|
||||
* @param dsc image buffer to free
|
||||
*/
|
||||
void lv_img_buf_free(lv_img_dsc_t * dsc)
|
||||
{
|
||||
if(dsc != NULL) {
|
||||
@@ -373,13 +318,6 @@ void lv_img_buf_free(lv_img_dsc_t * dsc)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the memory consumption of a raw bitmap, given color format and dimensions.
|
||||
* @param w width
|
||||
* @param h height
|
||||
* @param cf color format
|
||||
* @return size in bytes
|
||||
*/
|
||||
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
{
|
||||
switch(cf) {
|
||||
@@ -411,15 +349,6 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the area of a rectangle if its rotated and scaled
|
||||
* @param res store the coordinates here
|
||||
* @param w width of the rectangle to transform
|
||||
* @param h height of the rectangle to transform
|
||||
* @param angle angle of rotation
|
||||
* @param zoom zoom, (256 no zoom)
|
||||
* @param pivot x,y pivot coordinates of rotation
|
||||
*/
|
||||
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
|
||||
const lv_point_t * pivot)
|
||||
{
|
||||
|
||||
@@ -167,7 +167,7 @@ lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
|
||||
* @param safe true: check out of bounds
|
||||
* @return color of the point
|
||||
*/
|
||||
lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color);
|
||||
lv_color_t lv_img_buf_get_px_color(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Get the alpha value of an image's pixel
|
||||
@@ -177,7 +177,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
* @param safe true: check out of bounds
|
||||
* @return alpha value of the point
|
||||
*/
|
||||
lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
|
||||
lv_opa_t lv_img_buf_get_px_alpha(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Set the color of a pixel of an image. The alpha channel won't be affected.
|
||||
@@ -187,7 +187,7 @@ lv_opa_t lv_img_buf_get_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
* @param c color of the point
|
||||
* @param safe true: check out of bounds
|
||||
*/
|
||||
void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
|
||||
void lv_img_buf_set_px_color(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_color_t c);
|
||||
|
||||
/**
|
||||
* Set the alpha value of a pixel of an image. The color won't be affected
|
||||
@@ -197,7 +197,7 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
* @param opa the desired opacity
|
||||
* @param safe true: check out of bounds
|
||||
*/
|
||||
void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
|
||||
void lv_img_buf_set_px_alpha(const lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* Set the palette color of an indexed image. Valid only for `LV_IMG_CF_INDEXED1/2/4/8`
|
||||
@@ -209,7 +209,7 @@ void lv_img_buf_set_px_alpha(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
* - for `LV_IMG_CF_INDEXED8`: 0..255
|
||||
* @param c the color to set
|
||||
*/
|
||||
void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
|
||||
void lv_img_buf_set_palette(const lv_img_dsc_t * dsc, uint8_t id, lv_color_t c);
|
||||
|
||||
/**
|
||||
* Free an allocated image buffer
|
||||
|
||||
@@ -360,10 +360,35 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
}
|
||||
|
||||
lv_img_cf_t cf = dsc->header.cf;
|
||||
/*Process A8, RGB565A8, need load file to ram after https://github.com/lvgl/lvgl/pull/3337*/
|
||||
if(cf == LV_IMG_CF_ALPHA_8BIT || cf == LV_IMG_CF_RGB565A8) {
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
/*In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
*So simply give its pointer*/
|
||||
dsc->img_data = ((lv_img_dsc_t *)dsc->src)->data;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
else {
|
||||
/*If it's a file, read all to memory*/
|
||||
uint32_t len = dsc->header.w * dsc->header.h;
|
||||
len *= cf == LV_IMG_CF_RGB565A8 ? 3 : 1;
|
||||
uint8_t * fs_buf = lv_mem_alloc(len);
|
||||
if(fs_buf == NULL) return LV_RES_INV;
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
lv_fs_seek(&user_data->f, 4, LV_FS_SEEK_SET); /*+4 to skip the header*/
|
||||
lv_fs_res_t res = lv_fs_read(&user_data->f, fs_buf, len, NULL);
|
||||
if(res != LV_FS_RES_OK) {
|
||||
lv_mem_free(fs_buf);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
dsc->img_data = fs_buf;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
}
|
||||
/*Process true color formats*/
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
|
||||
cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED || cf == LV_IMG_CF_RGB565A8 ||
|
||||
cf == LV_IMG_CF_ALPHA_8BIT) {
|
||||
else if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
|
||||
cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
/*In case of uncompressed formats the image stored in the ROM/RAM.
|
||||
*So simply give its pointer*/
|
||||
|
||||
@@ -59,10 +59,14 @@
|
||||
|
||||
static void lv_draw_pxp_wait_for_finish(lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
static void lv_draw_pxp_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
static void lv_draw_pxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf);
|
||||
|
||||
static void lv_draw_pxp_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
static void lv_draw_pxp_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -84,6 +88,7 @@ void lv_draw_pxp_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
pxp_draw_ctx->base_draw.draw_img_decoded = lv_draw_pxp_img_decoded;
|
||||
pxp_draw_ctx->blend = lv_draw_pxp_blend;
|
||||
pxp_draw_ctx->base_draw.wait_for_finish = lv_draw_pxp_wait_for_finish;
|
||||
pxp_draw_ctx->base_draw.buffer_copy = lv_draw_pxp_buffer_copy;
|
||||
}
|
||||
|
||||
void lv_draw_pxp_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
@@ -184,22 +189,28 @@ static void lv_draw_pxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t blend_area;
|
||||
/*Let's get the blend area which is the intersection of the area to draw and the clip area.*/
|
||||
if(!_lv_area_intersect(&blend_area, coords, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
lv_area_t rel_coords;
|
||||
lv_area_copy(&rel_coords, coords);
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
lv_area_t rel_clip_area;
|
||||
lv_area_copy(&rel_clip_area, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_coord_t src_width = lv_area_get_width(coords);
|
||||
lv_coord_t src_height = lv_area_get_height(coords);
|
||||
|
||||
bool has_mask = lv_draw_mask_is_any(&blend_area);
|
||||
bool has_scale = (dsc->zoom != LV_IMG_ZOOM_NONE);
|
||||
bool has_rotation = (dsc->angle != 0);
|
||||
bool unsup_rotation = false;
|
||||
|
||||
lv_area_t blend_area;
|
||||
if(has_rotation)
|
||||
lv_area_copy(&blend_area, &rel_coords);
|
||||
else if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
bool has_mask = lv_draw_mask_is_any(&blend_area);
|
||||
lv_coord_t src_width = lv_area_get_width(coords);
|
||||
lv_coord_t src_height = lv_area_get_height(coords);
|
||||
|
||||
if(has_rotation) {
|
||||
/*
|
||||
* PXP can only rotate at 90x angles.
|
||||
@@ -247,4 +258,18 @@ static void lv_draw_pxp_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_
|
||||
dsc, cf);
|
||||
}
|
||||
|
||||
static void lv_draw_pxp_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area)
|
||||
{
|
||||
LV_UNUSED(draw_ctx);
|
||||
|
||||
if(lv_area_get_size(dest_area) < LV_GPU_NXP_PXP_SIZE_LIMIT) {
|
||||
lv_draw_sw_buffer_copy(draw_ctx, dest_buf, dest_stride, dest_area, src_buf, src_stride, src_area);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_gpu_nxp_pxp_buffer_copy(dest_buf, dest_area, dest_stride, src_buf, src_area, src_stride);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_PXP*/
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define PXP_TEMP_BUF_SIZE LCD_WIDTH * LCD_HEIGHT * LCD_FB_BYTE_PER_PIXEL
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
#error Color swap not implemented. Disable LV_COLOR_16_SWAP feature.
|
||||
#endif
|
||||
@@ -50,10 +48,17 @@
|
||||
#define PXP_OUT_PIXEL_FORMAT kPXP_OutputPixelFormatRGB565
|
||||
#define PXP_AS_PIXEL_FORMAT kPXP_AsPixelFormatRGB565
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB565
|
||||
#define PXP_TEMP_BUF_SIZE LCD_WIDTH * LCD_HEIGHT * 2U
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define PXP_OUT_PIXEL_FORMAT kPXP_OutputPixelFormatARGB8888
|
||||
#define PXP_AS_PIXEL_FORMAT kPXP_AsPixelFormatARGB8888
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB888
|
||||
#if (!(defined(FSL_FEATURE_PXP_HAS_NO_EXTEND_PIXEL_FORMAT) && FSL_FEATURE_PXP_HAS_NO_EXTEND_PIXEL_FORMAT)) && \
|
||||
(!(defined(FSL_FEATURE_PXP_V3) && FSL_FEATURE_PXP_V3))
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatARGB8888
|
||||
#else
|
||||
#define PXP_PS_PIXEL_FORMAT kPXP_PsPixelFormatRGB888
|
||||
#endif
|
||||
#define PXP_TEMP_BUF_SIZE LCD_WIDTH * LCD_HEIGHT * 4U
|
||||
#elif
|
||||
#error Only 16bit and 32bit color depth are supported. Set LV_COLOR_DEPTH to 16 or 32.
|
||||
#endif
|
||||
@@ -100,7 +105,7 @@ static void lv_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t * dest_area,
|
||||
* @param[in] dsc Image descriptor
|
||||
* @param[in] cf Color format
|
||||
*/
|
||||
static void lv_pxp_blit_cover(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
static void lv_pxp_blit_cover(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
@@ -286,7 +291,7 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_
|
||||
lv_gpu_nxp_pxp_run();
|
||||
}
|
||||
|
||||
void lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
void lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
@@ -308,6 +313,33 @@ void lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest
|
||||
lv_pxp_blit_cf(dest_buf, dest_area, dest_stride, src_buf, src_area, src_stride, dsc, cf);
|
||||
}
|
||||
|
||||
void lv_gpu_nxp_pxp_buffer_copy(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride)
|
||||
{
|
||||
lv_coord_t src_width = lv_area_get_width(src_area);
|
||||
lv_coord_t src_height = lv_area_get_height(src_area);
|
||||
|
||||
lv_gpu_nxp_pxp_reset();
|
||||
|
||||
const pxp_pic_copy_config_t picCopyConfig = {
|
||||
.srcPicBaseAddr = (uint32_t)src_buf,
|
||||
.srcPitchBytes = src_stride * sizeof(lv_color_t),
|
||||
.srcOffsetX = src_area->x1,
|
||||
.srcOffsetY = src_area->y1,
|
||||
.destPicBaseAddr = (uint32_t)dest_buf,
|
||||
.destPitchBytes = dest_stride * sizeof(lv_color_t),
|
||||
.destOffsetX = dest_area->x1,
|
||||
.destOffsetY = dest_area->y1,
|
||||
.width = src_width,
|
||||
.height = src_height,
|
||||
.pixelFormat = PXP_AS_PIXEL_FORMAT
|
||||
};
|
||||
|
||||
PXP_StartPictureCopy(LV_GPU_NXP_PXP_ID, &picCopyConfig);
|
||||
|
||||
lv_gpu_nxp_pxp_wait();
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -316,22 +348,25 @@ static void lv_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t * dest_area,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
lv_coord_t temp_area_w = lv_area_get_width(dest_area);
|
||||
lv_coord_t temp_area_h = lv_area_get_height(dest_area);
|
||||
const lv_area_t temp_area = {
|
||||
.x1 = 0,
|
||||
.y1 = 0,
|
||||
.x2 = temp_area_w - 1,
|
||||
.y2 = temp_area_h - 1
|
||||
};
|
||||
lv_area_t temp_area;
|
||||
lv_area_copy(&temp_area, dest_area);
|
||||
lv_coord_t temp_stride = dest_stride;
|
||||
lv_coord_t temp_w = lv_area_get_width(&temp_area);
|
||||
lv_coord_t temp_h = lv_area_get_height(&temp_area);
|
||||
|
||||
/*Step 1: Transform with full opacity to temporary buffer*/
|
||||
lv_pxp_blit_cover((lv_color_t *)temp_buf, &temp_area, temp_area_w, src_buf, src_area, src_stride, dsc, cf);
|
||||
lv_pxp_blit_cover((lv_color_t *)temp_buf, &temp_area, temp_stride, src_buf, src_area, src_stride, dsc, cf);
|
||||
|
||||
/*Switch width and height if angle requires it*/
|
||||
if(dsc->angle == 900 || dsc->angle == 2700) {
|
||||
temp_area.x2 = temp_area.x1 + temp_h - 1;
|
||||
temp_area.y2 = temp_area.y1 + temp_w - 1;
|
||||
}
|
||||
|
||||
/*Step 2: Blit temporary result with required opacity to output*/
|
||||
lv_pxp_blit_cf(dest_buf, dest_area, dest_stride, (lv_color_t *)temp_buf, &temp_area, temp_area_w, dsc, cf);
|
||||
lv_pxp_blit_cf(dest_buf, &temp_area, dest_stride, (lv_color_t *)temp_buf, &temp_area, temp_stride, dsc, cf);
|
||||
}
|
||||
static void lv_pxp_blit_cover(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
static void lv_pxp_blit_cover(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf)
|
||||
{
|
||||
@@ -343,28 +378,43 @@ static void lv_pxp_blit_cover(lv_color_t * dest_buf, const lv_area_t * dest_area
|
||||
bool has_recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
bool has_rotation = (dsc->angle != 0);
|
||||
|
||||
lv_point_t pivot = dsc->pivot;
|
||||
lv_coord_t piv_offset_x;
|
||||
lv_coord_t piv_offset_y;
|
||||
|
||||
lv_gpu_nxp_pxp_reset();
|
||||
|
||||
if(has_rotation) {
|
||||
/*Convert rotation angle*/
|
||||
/*Convert rotation angle and calculate offsets caused by pivot*/
|
||||
pxp_rotate_degree_t pxp_angle;
|
||||
switch(dsc->angle) {
|
||||
case 0:
|
||||
pxp_angle = kPXP_Rotate0;
|
||||
piv_offset_x = 0;
|
||||
piv_offset_y = 0;
|
||||
break;
|
||||
case 900:
|
||||
piv_offset_x = pivot.x + pivot.y - dest_h;
|
||||
piv_offset_y = pivot.y - pivot.x;
|
||||
pxp_angle = kPXP_Rotate90;
|
||||
break;
|
||||
case 1800:
|
||||
piv_offset_x = 2 * pivot.x - dest_w;
|
||||
piv_offset_y = 2 * pivot.y - dest_h;
|
||||
pxp_angle = kPXP_Rotate180;
|
||||
break;
|
||||
case 2700:
|
||||
piv_offset_x = pivot.x - pivot.y;
|
||||
piv_offset_y = pivot.x + pivot.y - dest_w;
|
||||
pxp_angle = kPXP_Rotate270;
|
||||
break;
|
||||
default:
|
||||
piv_offset_x = 0;
|
||||
piv_offset_y = 0;
|
||||
pxp_angle = kPXP_Rotate0;
|
||||
}
|
||||
PXP_SetRotateConfig(LV_GPU_NXP_PXP_ID, kPXP_RotateOutputBuffer, pxp_angle, kPXP_FlipDisable);
|
||||
lv_area_move(dest_area, piv_offset_x, piv_offset_y);
|
||||
}
|
||||
|
||||
/*AS buffer - source image*/
|
||||
|
||||
@@ -99,10 +99,24 @@ void lv_gpu_nxp_pxp_blit(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_
|
||||
* @param[in] dsc Image descriptor
|
||||
* @param[in] cf Color format
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
void lv_gpu_nxp_pxp_blit_transform(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc, lv_img_cf_t cf);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf, no transformation or blending.
|
||||
*
|
||||
*
|
||||
* @param[in/out] dest_buf Destination buffer
|
||||
* @param[in] dest_area Area with relative coordinates of destination buffer
|
||||
* @param[in] dest_stride Stride of destination buffer in pixels
|
||||
* @param[in] src_buf Source buffer
|
||||
* @param[in] src_area Area with relative coordinates of source buffer
|
||||
* @param[in] src_stride Stride of source buffer in pixels
|
||||
*/
|
||||
void lv_gpu_nxp_pxp_buffer_copy(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -149,7 +149,7 @@ void lv_gpu_nxp_pxp_wait(void);
|
||||
#if LV_GPU_NXP_PXP_LOG_TRACES
|
||||
#define PXP_LOG_TRACE(fmt, ...) \
|
||||
do { \
|
||||
LV_LOG_ERROR(fmt, ##__VA_ARGS__); \
|
||||
LV_LOG(fmt, ##__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else
|
||||
#define PXP_LOG_TRACE(fmt, ...) \
|
||||
|
||||
@@ -69,6 +69,10 @@ static void lv_draw_vglite_wait_for_finish(lv_draw_ctx_t * draw_ctx);
|
||||
static void lv_draw_vglite_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t cf);
|
||||
|
||||
static void lv_draw_vglite_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area);
|
||||
|
||||
static void lv_draw_vglite_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
static void lv_draw_vglite_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
@@ -111,6 +115,7 @@ void lv_draw_vglite_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
vglite_draw_ctx->base_draw.draw_img_decoded = lv_draw_vglite_img_decoded;
|
||||
vglite_draw_ctx->blend = lv_draw_vglite_blend;
|
||||
vglite_draw_ctx->base_draw.wait_for_finish = lv_draw_vglite_wait_for_finish;
|
||||
vglite_draw_ctx->base_draw.buffer_copy = lv_draw_vglite_buffer_copy;
|
||||
}
|
||||
|
||||
void lv_draw_vglite_ctx_deinit(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
@@ -166,11 +171,9 @@ static void lv_draw_vglite_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blen
|
||||
}
|
||||
|
||||
lv_area_t blend_area;
|
||||
/*Let's get the blend area which is the intersection of the area to draw and the clip area*/
|
||||
if(!_lv_area_intersect(&blend_area, dsc->blend_area, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
bool done = false;
|
||||
@@ -185,9 +188,6 @@ static void lv_draw_vglite_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blen
|
||||
VG_LITE_LOG_TRACE("VG-Lite fill failed. Fallback.");
|
||||
}
|
||||
else {
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
lv_area_t src_area;
|
||||
src_area.x1 = blend_area.x1 - (dsc->blend_area->x1 - draw_ctx->buf_area->x1);
|
||||
src_area.y1 = blend_area.y1 - (dsc->blend_area->y1 - draw_ctx->buf_area->y1);
|
||||
@@ -195,8 +195,15 @@ static void lv_draw_vglite_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blen
|
||||
src_area.y2 = src_area.y1 + lv_area_get_height(dsc->blend_area) - 1;
|
||||
lv_coord_t src_stride = lv_area_get_width(dsc->blend_area);
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit(dest_buf, &blend_area, dest_stride,
|
||||
src_buf, &src_area, src_stride, dsc->opa) == LV_RES_OK);
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit_split(dest_buf, &blend_area, dest_stride,
|
||||
src_buf, &src_area, src_stride, dsc->opa) == LV_RES_OK);
|
||||
#else
|
||||
done = (lv_gpu_nxp_vglite_blit(&blend_area, src_buf, &src_area, src_stride, dsc->opa) == LV_RES_OK);
|
||||
#endif
|
||||
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit failed. Fallback.");
|
||||
@@ -224,13 +231,21 @@ static void lv_draw_vglite_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_i
|
||||
return;
|
||||
}
|
||||
|
||||
lv_area_t blend_area;
|
||||
/*Let's get the blend area which is the intersection of the area to draw and the clip area*/
|
||||
if(!_lv_area_intersect(&blend_area, coords, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
lv_area_t rel_coords;
|
||||
lv_area_copy(&rel_coords, coords);
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
/*Make the blend area relative to the buffer*/
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
lv_area_t rel_clip_area;
|
||||
lv_area_copy(&rel_clip_area, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t blend_area;
|
||||
bool has_transform = dsc->angle != 0 || dsc->zoom != LV_IMG_ZOOM_NONE;
|
||||
|
||||
if(has_transform)
|
||||
lv_area_copy(&blend_area, &rel_coords);
|
||||
else if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
bool has_mask = lv_draw_mask_is_any(&blend_area);
|
||||
bool has_recolor = (dsc->recolor_opa != LV_OPA_TRANSP);
|
||||
@@ -242,9 +257,6 @@ static void lv_draw_vglite_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_i
|
||||
&& !lv_img_cf_has_alpha(cf)
|
||||
#endif
|
||||
) {
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
lv_area_t src_area;
|
||||
src_area.x1 = blend_area.x1 - (coords->x1 - draw_ctx->buf_area->x1);
|
||||
src_area.y1 = blend_area.y1 - (coords->y1 - draw_ctx->buf_area->y1);
|
||||
@@ -252,17 +264,48 @@ static void lv_draw_vglite_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_i
|
||||
src_area.y2 = src_area.y1 + lv_area_get_height(coords) - 1;
|
||||
lv_coord_t src_stride = lv_area_get_width(coords);
|
||||
|
||||
done = (lv_gpu_nxp_vglite_blit_transform(dest_buf, &blend_area, dest_stride,
|
||||
src_buf, &src_area, src_stride, dsc) == LV_RES_OK);
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
if(has_transform)
|
||||
/* VG-Lite blit split with transformation is not supported! */
|
||||
done = false;
|
||||
else
|
||||
done = (lv_gpu_nxp_vglite_blit_split(dest_buf, &blend_area, dest_stride,
|
||||
src_buf, &src_area, src_stride, dsc->opa) == LV_RES_OK);
|
||||
#else
|
||||
if(has_transform)
|
||||
done = (lv_gpu_nxp_vglite_blit_transform(&blend_area, &rel_clip_area,
|
||||
src_buf, &src_area, src_stride, dsc) == LV_RES_OK);
|
||||
else
|
||||
done = (lv_gpu_nxp_vglite_blit(&blend_area, src_buf, &src_area, src_stride, dsc->opa) == LV_RES_OK);
|
||||
#endif
|
||||
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit transform failed. Fallback.");
|
||||
VG_LITE_LOG_TRACE("VG-Lite blit %sfailed. Fallback.", has_transform ? "transform " : "");
|
||||
}
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, cf);
|
||||
}
|
||||
|
||||
static void lv_draw_vglite_buffer_copy(lv_draw_ctx_t * draw_ctx,
|
||||
void * dest_buf, lv_coord_t dest_stride, const lv_area_t * dest_area,
|
||||
void * src_buf, lv_coord_t src_stride, const lv_area_t * src_area)
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
if(lv_area_get_size(dest_area) >= LV_GPU_NXP_VG_LITE_SIZE_LIMIT) {
|
||||
done = lv_gpu_nxp_vglite_buffer_copy(dest_buf, dest_area, dest_stride, src_buf, src_area, src_stride);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite buffer copy failed. Fallback.");
|
||||
}
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_buffer_copy(draw_ctx, dest_buf, dest_stride, dest_area, src_buf, src_stride, src_area);
|
||||
}
|
||||
|
||||
static void lv_draw_vglite_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2)
|
||||
{
|
||||
@@ -284,21 +327,19 @@ static void lv_draw_vglite_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc
|
||||
rel_clip_area.y1 = LV_MIN(point1->y, point2->y) - dsc->width / 2;
|
||||
rel_clip_area.y2 = LV_MAX(point1->y, point2->y) + dsc->width / 2;
|
||||
|
||||
bool is_common;
|
||||
is_common = _lv_area_intersect(&rel_clip_area, &rel_clip_area, draw_ctx->clip_area);
|
||||
if(!is_common)
|
||||
return;
|
||||
lv_area_t clipped_coords;
|
||||
if(!_lv_area_intersect(&clipped_coords, &rel_clip_area, draw_ctx->clip_area))
|
||||
return; /*Fully clipped, nothing to do*/
|
||||
|
||||
/* Make coordinates relative to the draw buffer */
|
||||
lv_area_move(&rel_clip_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_point_t rel_point1 = { point1->x - draw_ctx->buf_area->x1, point1->y - draw_ctx->buf_area->y1 };
|
||||
lv_point_t rel_point2 = { point2->x - draw_ctx->buf_area->x1, point2->y - draw_ctx->buf_area->y1 };
|
||||
|
||||
bool done = false;
|
||||
bool mask_any = lv_draw_mask_is_any(&rel_clip_area);
|
||||
bool has_mask = lv_draw_mask_is_any(&rel_clip_area);
|
||||
|
||||
if(!mask_any) {
|
||||
if(!has_mask) {
|
||||
done = (lv_gpu_nxp_vglite_draw_line(&rel_point1, &rel_point2, &rel_clip_area, dsc) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw line failed. Fallback.");
|
||||
@@ -369,8 +410,6 @@ static lv_res_t lv_draw_vglite_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_d
|
||||
rel_coords.x2 -= (dsc->border_side & LV_BORDER_SIDE_RIGHT) ? 1 : 0;
|
||||
rel_coords.y2 -= (dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* Make coordinates relative to draw buffer */
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t rel_clip_area;
|
||||
@@ -379,9 +418,9 @@ static lv_res_t lv_draw_vglite_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_d
|
||||
|
||||
lv_area_t clipped_coords;
|
||||
if(!_lv_area_intersect(&clipped_coords, &rel_coords, &rel_clip_area))
|
||||
return LV_RES_INV;
|
||||
return LV_RES_OK; /*Fully clipped, nothing to do*/
|
||||
|
||||
bool mask_any = lv_draw_mask_is_any(&rel_coords);
|
||||
bool has_mask = lv_draw_mask_is_any(&rel_coords);
|
||||
lv_grad_dir_t grad_dir = dsc->bg_grad.dir;
|
||||
lv_color_t bg_color = (grad_dir == (lv_grad_dir_t)LV_GRAD_DIR_NONE) ?
|
||||
dsc->bg_color : dsc->bg_grad.stops[0].color;
|
||||
@@ -394,7 +433,7 @@ static lv_res_t lv_draw_vglite_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_d
|
||||
*
|
||||
* Complex case: gradient or radius but no mask.
|
||||
*/
|
||||
if(!mask_any && ((dsc->radius != 0) || (grad_dir != (lv_grad_dir_t)LV_GRAD_DIR_NONE))) {
|
||||
if(!has_mask && ((dsc->radius != 0) || (grad_dir != (lv_grad_dir_t)LV_GRAD_DIR_NONE))) {
|
||||
lv_res_t res = lv_gpu_nxp_vglite_draw_bg(&rel_coords, &rel_clip_area, dsc);
|
||||
if(res != LV_RES_OK)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw bg failed. Fallback.");
|
||||
@@ -426,13 +465,16 @@ static lv_res_t lv_draw_vglite_border(lv_draw_ctx_t * draw_ctx, const lv_draw_re
|
||||
rel_coords.y1 = coords->y1 + ceil(border_width / 2.0f);
|
||||
rel_coords.y2 = coords->y2 - floor(border_width / 2.0f);
|
||||
|
||||
/* Make coordinates relative to the draw buffer */
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t rel_clip_area;
|
||||
lv_area_copy(&rel_clip_area, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t clipped_coords;
|
||||
if(!_lv_area_intersect(&clipped_coords, &rel_coords, &rel_clip_area))
|
||||
return LV_RES_OK; /*Fully clipped, nothing to do*/
|
||||
|
||||
lv_res_t res = lv_gpu_nxp_vglite_draw_border_generic(&rel_coords, &rel_clip_area, dsc, true);
|
||||
if(res != LV_RES_OK)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw border failed. Fallback.");
|
||||
@@ -456,13 +498,16 @@ static lv_res_t lv_draw_vglite_outline(lv_draw_ctx_t * draw_ctx, const lv_draw_r
|
||||
rel_coords.y1 = coords->y1 - outline_pad - floor(dsc->outline_width / 2.0f);
|
||||
rel_coords.y2 = coords->y2 + outline_pad + ceil(dsc->outline_width / 2.0f);
|
||||
|
||||
/* Make coordinates relative to the draw buffer */
|
||||
lv_area_move(&rel_coords, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t rel_clip_area;
|
||||
lv_area_copy(&rel_clip_area, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
lv_area_t clipped_coords;
|
||||
if(!_lv_area_intersect(&clipped_coords, &rel_coords, &rel_clip_area))
|
||||
return LV_RES_OK; /*Fully clipped, nothing to do*/
|
||||
|
||||
lv_res_t res = lv_gpu_nxp_vglite_draw_border_generic(&rel_coords, &rel_clip_area, dsc, false);
|
||||
if(res != LV_RES_OK)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw outline failed. Fallback.");
|
||||
@@ -488,17 +533,21 @@ static void lv_draw_vglite_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make coordinates relative to the draw buffer */
|
||||
lv_point_t rel_center = {center->x - draw_ctx->buf_area->x1, center->y - draw_ctx->buf_area->y1};
|
||||
|
||||
lv_area_t rel_clip_area;
|
||||
lv_area_copy(&rel_clip_area, draw_ctx->clip_area);
|
||||
lv_area_move(&rel_clip_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
|
||||
done = (lv_gpu_nxp_vglite_draw_arc(&rel_center, (int32_t)radius, (int32_t)start_angle, (int32_t)end_angle,
|
||||
&rel_clip_area, dsc) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw arc failed. Fallback.");
|
||||
bool has_mask = lv_draw_mask_is_any(&rel_clip_area);
|
||||
|
||||
if(!has_mask) {
|
||||
done = (lv_gpu_nxp_vglite_draw_arc(&rel_center, (int32_t)radius, (int32_t)start_angle, (int32_t)end_angle,
|
||||
&rel_clip_area, dsc) == LV_RES_OK);
|
||||
if(!done)
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw arc failed. Fallback.");
|
||||
}
|
||||
|
||||
#endif/*LV_DRAW_COMPLEX*/
|
||||
|
||||
if(!done)
|
||||
|
||||
@@ -216,6 +216,8 @@ lv_res_t lv_gpu_nxp_vglite_draw_arc(const lv_point_t * center, int32_t radius, i
|
||||
vg_lite_matrix_t matrix;
|
||||
vg_lite_identity(&matrix);
|
||||
|
||||
lv_vglite_set_scissor(clip_area);
|
||||
|
||||
/*** Draw arc ***/
|
||||
err = vg_lite_draw(vgbuf, &path, VG_LITE_FILL_NON_ZERO, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw arc failed.");
|
||||
@@ -223,6 +225,8 @@ lv_res_t lv_gpu_nxp_vglite_draw_arc(const lv_point_t * center, int32_t radius, i
|
||||
if(lv_vglite_run() != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Run failed.");
|
||||
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
@@ -591,6 +595,8 @@ static void add_split_arc_path(int32_t * arc_path, int * pidx, vg_arc * q_arc, c
|
||||
static void add_arc_path(int32_t * arc_path, int * pidx, int32_t radius,
|
||||
int32_t start_angle, int32_t end_angle, const lv_point_t * center, bool cw)
|
||||
{
|
||||
if(end_angle < start_angle) end_angle += 360;
|
||||
|
||||
/* set number of arcs to draw */
|
||||
vg_arc q_arc;
|
||||
int32_t start_arc_angle = start_angle % 90;
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#if LV_USE_GPU_NXP_VG_LITE
|
||||
#include "lv_vglite_buf.h"
|
||||
#include "lv_vglite_utils.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -43,21 +44,6 @@
|
||||
/** Stride in px required by VG-Lite HW*/
|
||||
#define LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX 16U
|
||||
|
||||
/**
|
||||
* Enable BLIT quality degradation workaround for RT595,
|
||||
* recommended for screen's dimension > 352 pixels.
|
||||
*/
|
||||
#define RT595_BLIT_WRKRND_ENABLED 1
|
||||
|
||||
/* Internal compound symbol */
|
||||
#if (defined(CPU_MIMXRT595SFFOB) || defined(CPU_MIMXRT595SFFOB_cm33) || \
|
||||
defined(CPU_MIMXRT595SFFOC) || defined(CPU_MIMXRT595SFFOC_cm33)) && \
|
||||
RT595_BLIT_WRKRND_ENABLED
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 1
|
||||
#else
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 0
|
||||
#endif
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
/**
|
||||
* BLIT split threshold - BLITs with width or height higher than this value will be done
|
||||
@@ -75,16 +61,15 @@
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Blit single image, with optional opacity.
|
||||
* Blit image, with optional opacity.
|
||||
*
|
||||
* @param[in] dest_area Area with relative coordinates of destination buffer
|
||||
* @param[in] src_area Source area with relative coordinates of source buffer
|
||||
* @param[in] opa Opacity
|
||||
*
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
static lv_res_t lv_vglite_blit_single(const lv_area_t * dest_area, const lv_area_t * src_area, lv_opa_t opa);
|
||||
static lv_res_t lv_vglite_blit(const lv_area_t * src_area, lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* Check source memory and stride alignment.
|
||||
@@ -113,7 +98,6 @@ static inline void lv_vglite_set_translation_matrix(const lv_area_t * dest_area)
|
||||
static inline void lv_vglite_set_transformation_matrix(const lv_area_t * dest_area, const lv_draw_img_dsc_t * dsc);
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
|
||||
/**
|
||||
* Move buffer pointer as close as possible to area, but with respect to alignment requirements. X-axis only.
|
||||
*
|
||||
@@ -148,7 +132,7 @@ static void align_y(lv_area_t * area, lv_color_t ** buf, lv_coord_t stride);
|
||||
static lv_res_t lv_vglite_blit_split(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_opa_t opa);
|
||||
#endif
|
||||
#endif /*VG_LITE_BLIT_SPLIT_ENABLED*/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -223,17 +207,14 @@ lv_res_t lv_gpu_nxp_vglite_fill(const lv_area_t * dest_area, lv_color_t color, l
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_opa_t opa)
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_split(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_opa_t opa)
|
||||
{
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_translation_matrix(dest_area);
|
||||
|
||||
/* Set src_vgbuf structure. */
|
||||
lv_vglite_set_src_buf(src_buf, src_area, src_stride);
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
lv_color_t * orig_dest_buf = dest_buf;
|
||||
|
||||
lv_res_t rv = lv_vglite_blit_split(dest_buf, dest_area, dest_stride, src_buf, src_area, src_stride, opa);
|
||||
@@ -242,45 +223,112 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_color_t * dest_buf, lv_area_t * dest_area, lv
|
||||
lv_vglite_set_dest_buf_ptr(orig_dest_buf);
|
||||
|
||||
return rv;
|
||||
}
|
||||
#else
|
||||
LV_UNUSED(dest_buf);
|
||||
LV_UNUSED(dest_stride);
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(const lv_area_t * dest_area,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_opa_t opa)
|
||||
{
|
||||
if(check_src_alignment(src_buf, src_stride) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Check src alignment failed.");
|
||||
|
||||
return lv_vglite_blit_single(dest_area, src_area, opa);
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc)
|
||||
{
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_transformation_matrix(dest_area, dsc);
|
||||
|
||||
/* Set src_vgbuf structure. */
|
||||
lv_vglite_set_src_buf(src_buf, src_area, src_stride);
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
lv_color_t * orig_dest_buf = dest_buf;
|
||||
/* Set scissor. */
|
||||
lv_vglite_set_scissor(dest_area);
|
||||
|
||||
lv_res_t rv = lv_vglite_blit_split(dest_buf, dest_area, dest_stride, src_buf, src_area, src_stride, dsc->opa);
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_translation_matrix(dest_area);
|
||||
|
||||
/* Restore the original dest_vgbuf memory address. */
|
||||
lv_vglite_set_dest_buf_ptr(orig_dest_buf);
|
||||
/* Start blit. */
|
||||
lv_res_t rv = lv_vglite_blit(src_area, opa);
|
||||
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
return rv;
|
||||
#else
|
||||
LV_UNUSED(dest_buf);
|
||||
LV_UNUSED(dest_stride);
|
||||
}
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(const lv_area_t * dest_area, const lv_area_t * clip_area,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc)
|
||||
{
|
||||
lv_res_t rv = LV_RES_INV;
|
||||
|
||||
if(check_src_alignment(src_buf, src_stride) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Check src alignment failed.");
|
||||
|
||||
return lv_vglite_blit_single(dest_area, src_area, dsc->opa);
|
||||
#endif
|
||||
/* Set src_vgbuf structure. */
|
||||
lv_vglite_set_src_buf(src_buf, src_area, src_stride);
|
||||
|
||||
/* Set scissor */
|
||||
lv_vglite_set_scissor(clip_area);
|
||||
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_transformation_matrix(dest_area, dsc);
|
||||
|
||||
/* Start blit. */
|
||||
rv = lv_vglite_blit(src_area, dsc->opa);
|
||||
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif /*VG_LITE_BLIT_SPLIT_ENABLED*/
|
||||
|
||||
lv_res_t lv_gpu_nxp_vglite_buffer_copy(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride)
|
||||
{
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
|
||||
if(check_src_alignment(src_buf, src_stride) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Check src alignment failed.");
|
||||
|
||||
vg_lite_buffer_t src_vgbuf;
|
||||
/* Set src_vgbuf structure. */
|
||||
lv_vglite_set_buf(&src_vgbuf, src_buf, src_area, src_stride);
|
||||
|
||||
vg_lite_buffer_t dest_vgbuf;
|
||||
/* Set dest_vgbuf structure. */
|
||||
lv_vglite_set_buf(&dest_vgbuf, dest_buf, dest_area, dest_stride);
|
||||
|
||||
uint32_t rect[] = {
|
||||
(uint32_t)src_area->x1, /* start x */
|
||||
(uint32_t)src_area->y1, /* start y */
|
||||
(uint32_t)lv_area_get_width(src_area), /* width */
|
||||
(uint32_t)lv_area_get_height(src_area) /* height */
|
||||
};
|
||||
|
||||
/* Set scissor. */
|
||||
lv_vglite_set_scissor(dest_area);
|
||||
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_translation_matrix(dest_area);
|
||||
|
||||
err = vg_lite_blit_rect(&dest_vgbuf, &src_vgbuf, rect, &vgmatrix,
|
||||
VG_LITE_BLEND_NONE, 0xFFFFFFFFU, VG_LITE_FILTER_POINT);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
LV_LOG_ERROR("Blit rectangle failed.");
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(lv_vglite_run() != LV_RES_OK) {
|
||||
LV_LOG_ERROR("Run failed.");
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -320,10 +368,17 @@ static lv_res_t lv_vglite_blit_split(lv_color_t * dest_buf, lv_area_t * dest_are
|
||||
lv_vglite_set_dest_buf_ptr(dest_buf);
|
||||
lv_vglite_set_src_buf_ptr(src_buf);
|
||||
|
||||
/* Set scissor */
|
||||
lv_vglite_set_scissor(dest_area);
|
||||
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_translation_matrix(dest_area);
|
||||
|
||||
rv = lv_vglite_blit_single(dest_area, src_area, opa);
|
||||
/* Start blit. */
|
||||
rv = lv_vglite_blit(src_area, opa);
|
||||
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
VG_LITE_LOG_TRACE("Single "
|
||||
"Area: ([%d,%d], [%d,%d]) -> ([%d,%d], [%d,%d]) | "
|
||||
@@ -426,14 +481,21 @@ static lv_res_t lv_vglite_blit_split(lv_color_t * dest_buf, lv_area_t * dest_are
|
||||
if(check_src_alignment(tile_src_buf, src_stride) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Check src alignment failed.");
|
||||
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_translation_matrix(&tile_dest_area);
|
||||
|
||||
/* Set new dest_vgbuf and src_vgbuf memory addresses. */
|
||||
lv_vglite_set_dest_buf_ptr(tile_dest_buf);
|
||||
lv_vglite_set_src_buf_ptr(tile_src_buf);
|
||||
|
||||
rv = lv_vglite_blit_single(&tile_dest_area, &tile_src_area, opa);
|
||||
/* Set scissor */
|
||||
lv_vglite_set_scissor(&tile_dest_area);
|
||||
|
||||
/* Set vgmatrix. */
|
||||
lv_vglite_set_translation_matrix(&tile_dest_area);
|
||||
|
||||
/* Start blit. */
|
||||
rv = lv_vglite_blit(&tile_src_area, opa);
|
||||
|
||||
/* Disable scissor. */
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
VG_LITE_LOG_TRACE("Tile [%d, %d] "
|
||||
"Area: ([%d,%d], [%d,%d]) -> ([%d,%d], [%d,%d]) | "
|
||||
@@ -455,9 +517,9 @@ static lv_res_t lv_vglite_blit_split(lv_color_t * dest_buf, lv_area_t * dest_are
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif /* VG_LITE_BLIT_SPLIT_ENABLED */
|
||||
#endif /*VG_LITE_BLIT_SPLIT_ENABLED*/
|
||||
|
||||
static lv_res_t lv_vglite_blit_single(const lv_area_t * dest_area, const lv_area_t * src_area, lv_opa_t opa)
|
||||
static lv_res_t lv_vglite_blit(const lv_area_t * src_area, lv_opa_t opa)
|
||||
{
|
||||
vg_lite_error_t err = VG_LITE_SUCCESS;
|
||||
vg_lite_buffer_t * dst_vgbuf = lv_vglite_get_dest_buf();
|
||||
@@ -489,30 +551,11 @@ static lv_res_t lv_vglite_blit_single(const lv_area_t * dest_area, const lv_area
|
||||
src_vgbuf->transparency_mode = VG_LITE_IMAGE_TRANSPARENT;
|
||||
}
|
||||
|
||||
bool scissoring = lv_area_get_width(dest_area) < lv_area_get_width(src_area) ||
|
||||
lv_area_get_height(dest_area) < lv_area_get_height(src_area);
|
||||
if(scissoring) {
|
||||
vg_lite_enable_scissor();
|
||||
vg_lite_set_scissor((int32_t)dest_area->x1, (int32_t)dest_area->y1,
|
||||
(int32_t)lv_area_get_width(dest_area),
|
||||
(int32_t)lv_area_get_height(dest_area));
|
||||
}
|
||||
|
||||
err = vg_lite_blit_rect(dst_vgbuf, src_vgbuf, rect, &vgmatrix, blend, color, VG_LITE_FILTER_POINT);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
if(scissoring)
|
||||
vg_lite_disable_scissor();
|
||||
VG_LITE_RETURN_INV("Blit rectangle failed.");
|
||||
}
|
||||
VG_LITE_ERR_RETURN_INV(err, "Blit rectangle failed.");
|
||||
|
||||
if(lv_vglite_run() != LV_RES_OK) {
|
||||
if(scissoring)
|
||||
vg_lite_disable_scissor();
|
||||
if(lv_vglite_run() != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Run failed.");
|
||||
}
|
||||
|
||||
if(scissoring)
|
||||
vg_lite_disable_scissor();
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@@ -546,16 +589,14 @@ static inline void lv_vglite_set_transformation_matrix(const lv_area_t * dest_ar
|
||||
bool has_scale = (dsc->zoom != LV_IMG_ZOOM_NONE);
|
||||
bool has_rotation = (dsc->angle != 0);
|
||||
|
||||
if(has_scale || has_rotation) {
|
||||
vg_lite_translate(dsc->pivot.x, dsc->pivot.y, &vgmatrix);
|
||||
if(has_rotation)
|
||||
vg_lite_rotate(dsc->angle / 10.0f, &vgmatrix); /* angle is 1/10 degree */
|
||||
if(has_scale) {
|
||||
vg_lite_float_t scale = 1.0f * dsc->zoom / LV_IMG_ZOOM_NONE;
|
||||
vg_lite_scale(scale, scale, &vgmatrix);
|
||||
}
|
||||
vg_lite_translate(0.0f - dsc->pivot.x, 0.0f - dsc->pivot.y, &vgmatrix);
|
||||
vg_lite_translate(dsc->pivot.x, dsc->pivot.y, &vgmatrix);
|
||||
if(has_rotation)
|
||||
vg_lite_rotate(dsc->angle / 10.0f, &vgmatrix); /* angle is 1/10 degree */
|
||||
if(has_scale) {
|
||||
vg_lite_float_t scale = 1.0f * dsc->zoom / LV_IMG_ZOOM_NONE;
|
||||
vg_lite_scale(scale, scale, &vgmatrix);
|
||||
}
|
||||
vg_lite_translate(0.0f - dsc->pivot.x, 0.0f - dsc->pivot.y, &vgmatrix);
|
||||
}
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
|
||||
@@ -47,6 +47,21 @@ extern "C" {
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**
|
||||
* Enable BLIT quality degradation workaround for RT595,
|
||||
* recommended for screen's dimension > 352 pixels.
|
||||
*/
|
||||
#define RT595_BLIT_WRKRND_ENABLED 1
|
||||
|
||||
/* Internal compound symbol */
|
||||
#if (defined(CPU_MIMXRT595SFFOB) || defined(CPU_MIMXRT595SFFOB_cm33) || \
|
||||
defined(CPU_MIMXRT595SFFOC) || defined(CPU_MIMXRT595SFFOC_cm33)) && \
|
||||
RT595_BLIT_WRKRND_ENABLED
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 1
|
||||
#else
|
||||
#define VG_LITE_BLIT_SPLIT_ENABLED 0
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -67,6 +82,7 @@ extern "C" {
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_fill(const lv_area_t * dest_area, lv_color_t color, lv_opa_t opa);
|
||||
|
||||
#if VG_LITE_BLIT_SPLIT_ENABLED
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects.
|
||||
* By default, image is copied directly, with optional opacity.
|
||||
@@ -82,17 +98,33 @@ lv_res_t lv_gpu_nxp_vglite_fill(const lv_area_t * dest_area, lv_color_t color, l
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_split(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_opa_t opa);
|
||||
#else
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with effects.
|
||||
* By default, image is copied directly, with optional opacity.
|
||||
*
|
||||
* @param[in] dest_stride Stride of destination buffer in pixels
|
||||
* @param[in] src_buf Source buffer
|
||||
* @param[in] src_area Source area with relative coordinates of source buffer
|
||||
* @param[in] src_stride Stride of source buffer in pixels
|
||||
* @param[in] opa Opacity
|
||||
*
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit(const lv_area_t * dest_area,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_opa_t opa);
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - copy rectangular image from src_buf to dst_buf with transformation.
|
||||
* By default, image is copied directly, with optional opacity.
|
||||
*
|
||||
* @param[in/out] dest_buf Destination buffer
|
||||
* @param[in] dest_area Area with relative coordinates of destination buffer
|
||||
* @param[in] dest_stride Stride of destination buffer in pixels
|
||||
* @param[in] clip_area Clip area with relative coordinates of destination buffer
|
||||
* @param[in] src_buf Source buffer
|
||||
* @param[in] src_area Source area with relative coordinates of source buffer
|
||||
* @param[in] src_stride Stride of source buffer in pixels
|
||||
@@ -101,10 +133,28 @@ lv_res_t lv_gpu_nxp_vglite_blit(lv_color_t * dest_buf, lv_area_t * dest_area, lv
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(lv_color_t * dest_buf, lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, lv_area_t * src_area, lv_coord_t src_stride,
|
||||
lv_res_t lv_gpu_nxp_vglite_blit_transform(const lv_area_t * dest_area, const lv_area_t * clip_area,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride,
|
||||
const lv_draw_img_dsc_t * dsc);
|
||||
|
||||
#endif /*VG_LITE_BLIT_SPLIT_ENABLED*/
|
||||
|
||||
/**
|
||||
* BLock Image Transfer - simple copy of rectangular image from source to destination.
|
||||
*
|
||||
* @param[in] dest_buf Destination buffer
|
||||
* @param[in] dest_area Area with relative coordinates of destination buffer
|
||||
* @param[in] dest_stride Stride of destination buffer in pixels
|
||||
* @param[in] src_buf Source buffer
|
||||
* @param[in] src_area Source area with relative coordinates of source buffer
|
||||
* @param[in] src_stride Stride of source buffer in pixels
|
||||
*
|
||||
* @retval LV_RES_OK Transfer complete
|
||||
* @retval LV_RES_INV Error occurred (\see LV_GPU_NXP_VG_LITE_LOG_ERRORS)
|
||||
*/
|
||||
lv_res_t lv_gpu_nxp_vglite_buffer_copy(lv_color_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src_buf, const lv_area_t * src_area, lv_coord_t src_stride);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -119,12 +119,16 @@ lv_res_t lv_gpu_nxp_vglite_draw_line(const lv_point_t * point1, const lv_point_t
|
||||
err = vg_lite_update_stroke(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Update stroke failed.");
|
||||
|
||||
lv_vglite_set_scissor(clip_area);
|
||||
|
||||
err = vg_lite_draw(vgbuf, &path, VG_LITE_FILL_NON_ZERO, &matrix, vglite_blend_mode, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw line failed.");
|
||||
|
||||
if(lv_vglite_run() != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Run failed.");
|
||||
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
|
||||
@@ -166,6 +166,8 @@ lv_res_t lv_gpu_nxp_vglite_draw_bg(const lv_area_t * coords, const lv_area_t * c
|
||||
if(lv_vglite_premult_and_swizzle(&vgcol, bg_col32, dsc->bg_opa, color_format) != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Premultiplication and swizzle failed.");
|
||||
|
||||
lv_vglite_set_scissor(clip_area);
|
||||
|
||||
/*** Draw rectangle ***/
|
||||
if(dsc->bg_grad.dir == (lv_grad_dir_t)LV_GRAD_DIR_NONE) {
|
||||
err = vg_lite_draw(vgbuf, &path, VG_LITE_FILL_EVEN_ODD, &matrix, VG_LITE_BLEND_SRC_OVER, vgcol);
|
||||
@@ -178,6 +180,8 @@ lv_res_t lv_gpu_nxp_vglite_draw_bg(const lv_area_t * coords, const lv_area_t * c
|
||||
if(lv_vglite_run() != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Run failed.");
|
||||
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
@@ -263,12 +267,16 @@ lv_res_t lv_gpu_nxp_vglite_draw_border_generic(const lv_area_t * coords, const l
|
||||
err = vg_lite_update_stroke(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Update stroke failed.");
|
||||
|
||||
lv_vglite_set_scissor(clip_area);
|
||||
|
||||
err = vg_lite_draw(vgbuf, &path, VG_LITE_FILL_NON_ZERO, &matrix, vglite_blend_mode, vgcol);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Draw border failed.");
|
||||
|
||||
if(lv_vglite_run() != LV_RES_OK)
|
||||
VG_LITE_RETURN_INV("Run failed.");
|
||||
|
||||
lv_vglite_disable_scissor();
|
||||
|
||||
err = vg_lite_clear_path(&path);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Clear path failed.");
|
||||
|
||||
@@ -276,6 +284,10 @@ lv_res_t lv_gpu_nxp_vglite_draw_border_generic(const lv_area_t * coords, const l
|
||||
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void lv_vglite_create_rect_path_data(int32_t * path_data, uint32_t * path_data_size,
|
||||
lv_coord_t radius,
|
||||
const lv_area_t * coords)
|
||||
@@ -444,8 +456,4 @@ static void lv_vglite_create_rect_path_data(int32_t * path_data, uint32_t * path
|
||||
*path_data_size = pidx * sizeof(int32_t);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
@@ -57,8 +57,6 @@
|
||||
|
||||
static inline void lv_vglite_set_dest_buf(const lv_color_t * buf, const lv_area_t * area, lv_coord_t stride);
|
||||
static inline void lv_vglite_set_buf_ptr(vg_lite_buffer_t * vgbuf, const lv_color_t * buf);
|
||||
static inline void lv_vglite_set_buf(vg_lite_buffer_t * vgbuf, const lv_color_t * buf,
|
||||
const lv_area_t * area, lv_coord_t stride);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -106,23 +104,8 @@ void lv_vglite_set_src_buf(const lv_color_t * buf, const lv_area_t * area, lv_co
|
||||
lv_vglite_set_buf(&src_vgbuf, buf, area, stride);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline void lv_vglite_set_dest_buf(const lv_color_t * buf, const lv_area_t * area, lv_coord_t stride)
|
||||
{
|
||||
lv_vglite_set_buf(&dest_vgbuf, buf, area, stride);
|
||||
}
|
||||
|
||||
static inline void lv_vglite_set_buf_ptr(vg_lite_buffer_t * vgbuf, const lv_color_t * buf)
|
||||
{
|
||||
vgbuf->memory = (void *)buf;
|
||||
vgbuf->address = (uint32_t)vgbuf->memory;
|
||||
}
|
||||
|
||||
static inline void lv_vglite_set_buf(vg_lite_buffer_t * vgbuf, const lv_color_t * buf,
|
||||
const lv_area_t * area, lv_coord_t stride)
|
||||
void lv_vglite_set_buf(vg_lite_buffer_t * vgbuf, const lv_color_t * buf,
|
||||
const lv_area_t * area, lv_coord_t stride)
|
||||
{
|
||||
vgbuf->format = VG_LITE_PX_FMT;
|
||||
vgbuf->tiled = VG_LITE_LINEAR;
|
||||
@@ -140,4 +123,19 @@ static inline void lv_vglite_set_buf(vg_lite_buffer_t * vgbuf, const lv_color_t
|
||||
vgbuf->handle = NULL;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline void lv_vglite_set_dest_buf(const lv_color_t * buf, const lv_area_t * area, lv_coord_t stride)
|
||||
{
|
||||
lv_vglite_set_buf(&dest_vgbuf, buf, area, stride);
|
||||
}
|
||||
|
||||
static inline void lv_vglite_set_buf_ptr(vg_lite_buffer_t * vgbuf, const lv_color_t * buf)
|
||||
{
|
||||
vgbuf->memory = (void *)buf;
|
||||
vgbuf->address = (uint32_t)vgbuf->memory;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
@@ -100,6 +100,17 @@ void lv_vglite_set_src_buf_ptr(const lv_color_t * buf);
|
||||
*/
|
||||
void lv_vglite_set_src_buf(const lv_color_t * buf, const lv_area_t * area, lv_coord_t stride);
|
||||
|
||||
/**
|
||||
* Set vglite buffer.
|
||||
*
|
||||
* @param[in] vgbuf Address of the VGLite buffer object
|
||||
* @param[in] buf Address of the memory for the VGLite buffer
|
||||
* @param[in] area buffer area (for width and height)
|
||||
* @param[in] stride buffer stride
|
||||
*/
|
||||
void lv_vglite_set_buf(vg_lite_buffer_t * vgbuf, const lv_color_t * buf,
|
||||
const lv_area_t * area, lv_coord_t stride);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -71,6 +71,23 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Enable scissor and set the clipping box.
|
||||
*
|
||||
* @param[in] clip_area Clip area with relative coordinates of destination buffer
|
||||
*/
|
||||
static inline void lv_vglite_set_scissor(const lv_area_t * clip_area);
|
||||
|
||||
/**
|
||||
* Disable scissor.
|
||||
*/
|
||||
static inline void lv_vglite_disable_scissor(void);
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -157,6 +174,23 @@ lv_res_t lv_vglite_run(void);
|
||||
}while(0)
|
||||
#endif /*LV_GPU_NXP_VG_LITE_LOG_TRACES*/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline void lv_vglite_set_scissor(const lv_area_t * clip_area)
|
||||
{
|
||||
vg_lite_enable_scissor();
|
||||
vg_lite_set_scissor((int32_t)clip_area->x1, (int32_t)clip_area->y1,
|
||||
(int32_t)lv_area_get_width(clip_area),
|
||||
(int32_t)lv_area_get_height(clip_area));
|
||||
}
|
||||
|
||||
static inline void lv_vglite_disable_scissor(void)
|
||||
{
|
||||
vg_lite_disable_scissor();
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_NXP_VG_LITE*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
7
src/draw/renesas/lv_draw_renesas.mk
Normal file
7
src/draw/renesas/lv_draw_renesas.mk
Normal file
@@ -0,0 +1,7 @@
|
||||
CSRCS += lv_gpu_d2_ra6m3.c
|
||||
CSRCS += lv_gpu_d2_draw_label.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/renesas
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/renesas
|
||||
|
||||
CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/draw/renesas"
|
||||
292
src/draw/renesas/lv_gpu_d2_draw_label.c
Normal file
292
src/draw/renesas/lv_gpu_d2_draw_label.c
Normal file
@@ -0,0 +1,292 @@
|
||||
/**
|
||||
* @file lv_gpu_d2_draw_label.c
|
||||
*
|
||||
* @description HAL layer for display driver
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../draw/lv_draw_label.h"
|
||||
#include "../../misc/lv_assert.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
#include "lv_gpu_d2_ra6m3.h"
|
||||
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
#include LV_GPU_RA6M3_G2D_INCLUDE
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
extern const uint8_t _lv_bpp1_opa_table[2];
|
||||
extern const uint8_t _lv_bpp2_opa_table[4];
|
||||
extern const uint8_t _lv_bpp4_opa_table[16];
|
||||
extern const uint8_t _lv_bpp8_opa_table[256];
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM draw_letter_normal(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc,
|
||||
const lv_point_t * pos, lv_font_glyph_dsc_t * g, const uint8_t * map_p)
|
||||
{
|
||||
|
||||
const uint8_t * bpp_opa_table_p;
|
||||
uint32_t bitmask_init;
|
||||
uint32_t bitmask;
|
||||
uint32_t bpp = g->bpp;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
uint32_t shades;
|
||||
if(bpp == 3) bpp = 4;
|
||||
|
||||
#if LV_USE_IMGFONT
|
||||
if(bpp == LV_IMGFONT_BPP) { //is imgfont
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = pos->x;
|
||||
fill_area.y1 = pos->y;
|
||||
fill_area.x2 = pos->x + g->box_w - 1;
|
||||
fill_area.y2 = pos->y + g->box_h - 1;
|
||||
lv_draw_img_dsc_t img_dsc;
|
||||
lv_draw_img_dsc_init(&img_dsc);
|
||||
img_dsc.angle = 0;
|
||||
img_dsc.zoom = LV_IMG_ZOOM_NONE;
|
||||
img_dsc.opa = dsc->opa;
|
||||
img_dsc.blend_mode = dsc->blend_mode;
|
||||
lv_draw_img(draw_ctx, &img_dsc, &fill_area, map_p);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch(bpp) {
|
||||
case 1:
|
||||
bpp_opa_table_p = _lv_bpp1_opa_table;
|
||||
bitmask_init = 0x80;
|
||||
shades = 2;
|
||||
break;
|
||||
case 2:
|
||||
bpp_opa_table_p = _lv_bpp2_opa_table;
|
||||
bitmask_init = 0xC0;
|
||||
shades = 4;
|
||||
break;
|
||||
case 4:
|
||||
bpp_opa_table_p = _lv_bpp4_opa_table;
|
||||
bitmask_init = 0xF0;
|
||||
shades = 16;
|
||||
break;
|
||||
case 8:
|
||||
bpp_opa_table_p = _lv_bpp8_opa_table;
|
||||
bitmask_init = 0xFF;
|
||||
shades = 256;
|
||||
break; /*No opa table, pixel value will be used directly*/
|
||||
default:
|
||||
LV_LOG_WARN("lv_draw_letter: invalid bpp");
|
||||
return; /*Invalid bpp. Can't render the letter*/
|
||||
}
|
||||
|
||||
static lv_opa_t opa_table[256];
|
||||
static lv_opa_t prev_opa = LV_OPA_TRANSP;
|
||||
static uint32_t prev_bpp = 0;
|
||||
if(opa < LV_OPA_MAX) {
|
||||
if(prev_opa != opa || prev_bpp != bpp) {
|
||||
uint32_t i;
|
||||
for(i = 0; i < shades; i++) {
|
||||
opa_table[i] = bpp_opa_table_p[i] == LV_OPA_COVER ? opa : ((bpp_opa_table_p[i] * opa) >> 8);
|
||||
}
|
||||
}
|
||||
bpp_opa_table_p = opa_table;
|
||||
prev_opa = opa;
|
||||
prev_bpp = bpp;
|
||||
}
|
||||
|
||||
int32_t col, row;
|
||||
int32_t box_w = g->box_w;
|
||||
int32_t box_h = g->box_h;
|
||||
int32_t width_bit = box_w * bpp; /*Letter width in bits*/
|
||||
|
||||
/*Calculate the col/row start/end on the map*/
|
||||
int32_t col_start = pos->x >= draw_ctx->clip_area->x1 ? 0 : draw_ctx->clip_area->x1 - pos->x;
|
||||
int32_t col_end = pos->x + box_w <= draw_ctx->clip_area->x2 ? box_w : draw_ctx->clip_area->x2 - pos->x + 1;
|
||||
int32_t row_start = pos->y >= draw_ctx->clip_area->y1 ? 0 : draw_ctx->clip_area->y1 - pos->y;
|
||||
int32_t row_end = pos->y + box_h <= draw_ctx->clip_area->y2 ? box_h : draw_ctx->clip_area->y2 - pos->y + 1;
|
||||
|
||||
/*Move on the map too*/
|
||||
uint32_t bit_ofs = (row_start * width_bit) + (col_start * bpp);
|
||||
map_p += bit_ofs >> 3;
|
||||
|
||||
uint8_t letter_px;
|
||||
uint32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /*"& 0x7" equals to "% 8" just faster*/
|
||||
|
||||
lv_draw_sw_blend_dsc_t blend_dsc;
|
||||
lv_memset_00(&blend_dsc, sizeof(blend_dsc));
|
||||
blend_dsc.color = dsc->color;
|
||||
blend_dsc.opa = LV_OPA_COVER;
|
||||
blend_dsc.blend_mode = dsc->blend_mode;
|
||||
|
||||
lv_coord_t hor_res = lv_disp_get_hor_res(_lv_refr_get_disp_refreshing());
|
||||
uint32_t mask_buf_size = box_w * box_h > hor_res ? hor_res : box_w * box_h;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
blend_dsc.mask_buf = mask_buf;
|
||||
int32_t mask_p = 0;
|
||||
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = col_start + pos->x;
|
||||
fill_area.x2 = col_end + pos->x - 1;
|
||||
fill_area.y1 = row_start + pos->y;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
#if LV_DRAW_COMPLEX
|
||||
lv_coord_t fill_w = lv_area_get_width(&fill_area);
|
||||
lv_area_t mask_area;
|
||||
lv_area_copy(&mask_area, &fill_area);
|
||||
mask_area.y2 = mask_area.y1 + row_end;
|
||||
bool mask_any = lv_draw_mask_is_any(&mask_area);
|
||||
#endif
|
||||
blend_dsc.blend_area = &fill_area;
|
||||
blend_dsc.mask_area = &fill_area;
|
||||
|
||||
uint32_t col_bit_max = 8 - bpp;
|
||||
uint32_t col_bit_row_ofs = (box_w + col_start - col_end) * bpp;
|
||||
|
||||
for(row = row_start ; row < row_end; row++) {
|
||||
#if LV_DRAW_COMPLEX
|
||||
int32_t mask_p_start = mask_p;
|
||||
#endif
|
||||
bitmask = bitmask_init >> col_bit;
|
||||
for(col = col_start; col < col_end; col++) {
|
||||
/*Load the pixel's opacity into the mask*/
|
||||
letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit);
|
||||
if(letter_px) {
|
||||
mask_buf[mask_p] = bpp_opa_table_p[letter_px];
|
||||
}
|
||||
else {
|
||||
mask_buf[mask_p] = 0;
|
||||
}
|
||||
|
||||
/*Go to the next column*/
|
||||
if(col_bit < col_bit_max) {
|
||||
col_bit += bpp;
|
||||
bitmask = bitmask >> bpp;
|
||||
}
|
||||
else {
|
||||
col_bit = 0;
|
||||
bitmask = bitmask_init;
|
||||
map_p++;
|
||||
}
|
||||
|
||||
/*Next mask byte*/
|
||||
mask_p++;
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*Apply masks if any*/
|
||||
if(mask_any) {
|
||||
blend_dsc.mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2,
|
||||
fill_w);
|
||||
if(blend_dsc.mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + mask_p_start, fill_w);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
fill_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
lv_draw_ra6m3_2d_blend(draw_ctx, &blend_dsc);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
col_bit += col_bit_row_ofs;
|
||||
map_p += (col_bit >> 3);
|
||||
col_bit = col_bit & 0x7;
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
lv_draw_ra6m3_2d_blend(draw_ctx, &blend_dsc);
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
|
||||
void lv_draw_gpu_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter)
|
||||
{
|
||||
const lv_font_t * font_p = dsc->font;
|
||||
|
||||
lv_opa_t opa = dsc->opa;
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
if(font_p == NULL) {
|
||||
LV_LOG_WARN("lv_draw_letter: font is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_font_glyph_dsc_t g;
|
||||
bool g_ret = lv_font_get_glyph_dsc(font_p, &g, letter, '\0');
|
||||
if(g_ret == false) {
|
||||
/*Add warning if the dsc is not found
|
||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
if(letter >= 0x20 &&
|
||||
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", letter);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Don't draw anything if the character is empty. E.g. space*/
|
||||
if((g.box_h == 0) || (g.box_w == 0)) return;
|
||||
|
||||
lv_point_t gpos;
|
||||
gpos.x = pos_p->x + g.ofs_x;
|
||||
gpos.y = pos_p->y + (dsc->font->line_height - dsc->font->base_line) - g.box_h - g.ofs_y;
|
||||
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(gpos.x + g.box_w < draw_ctx->clip_area->x1 ||
|
||||
gpos.x > draw_ctx->clip_area->x2 ||
|
||||
gpos.y + g.box_h < draw_ctx->clip_area->y1 ||
|
||||
gpos.y > draw_ctx->clip_area->y2) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t * map_p = lv_font_get_glyph_bitmap(font_p, letter);
|
||||
if(map_p == NULL) {
|
||||
LV_LOG_WARN("lv_draw_letter: character's bitmap not found");
|
||||
return;
|
||||
}
|
||||
|
||||
if(font_p->subpx) {
|
||||
#if LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX
|
||||
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||
#else
|
||||
LV_LOG_WARN("Can't draw sub-pixel rendered letter because LV_USE_FONT_SUBPX == 0 in lv_conf.h");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
draw_letter_normal(draw_ctx, dsc, &gpos, &g, map_p);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
742
src/draw/renesas/lv_gpu_d2_ra6m3.c
Normal file
742
src/draw/renesas/lv_gpu_d2_ra6m3.c
Normal file
@@ -0,0 +1,742 @@
|
||||
/**
|
||||
* @file lv_gpu_d2_ra6m3.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_gpu_d2_ra6m3.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
#include <math.h>
|
||||
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
|
||||
#include LV_GPU_RA6M3_G2D_INCLUDE
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LOG_ERRORS
|
||||
#ifdef LOG_ERRORS
|
||||
#define STRINGIFY(x) #x
|
||||
#define TOSTRING(x) STRINGIFY(x)
|
||||
|
||||
#define ERROR_LIST_SIZE (4)
|
||||
#define D2_EXEC(a) lv_port_gpu_log_error(a, __func__, __LINE__)
|
||||
#else
|
||||
/* here is error logging not enabled */
|
||||
#define D2_EXEC(a) a;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct {
|
||||
d2_s32 error;
|
||||
const char * func;
|
||||
int line;
|
||||
} log_error_entry;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#ifdef LOG_ERRORS
|
||||
static void lv_port_gpu_log_error(d2_s32 status, const char * func, int line);
|
||||
#endif
|
||||
static void invalidate_cache(void);
|
||||
|
||||
void lv_draw_gpu_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
#ifdef LOG_ERRORS
|
||||
static log_error_entry log_error_list[ERROR_LIST_SIZE];
|
||||
static int error_list_index;
|
||||
static int error_count;
|
||||
#endif
|
||||
|
||||
static d2_device * _d2_handle;
|
||||
static d2_renderbuffer * renderbuffer;
|
||||
|
||||
static d2_s32 src_cf_val, dst_cf_val;
|
||||
static lv_draw_img_dsc_t img_dsc;
|
||||
static bool color_key_enabled, alpha_enabled, blend_enabled, colorize_enabled;
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
static d2_s32 lv_port_gpu_cf_lv_to_d2(lv_img_cf_t cf)
|
||||
{
|
||||
d2_s32 d2_cf;
|
||||
|
||||
#if (DLG_LVGL_CF == 1)
|
||||
switch(cf & ~(1 << 5)) {
|
||||
#else
|
||||
switch(cf) {
|
||||
#endif /* (DLG_LVGL_CF == 1) */
|
||||
case LV_IMG_CF_TRUE_COLOR:
|
||||
d2_cf = d2_mode_rgb565;
|
||||
break;
|
||||
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
|
||||
d2_cf = d2_mode_rgb565;
|
||||
break;
|
||||
case LV_IMG_CF_ALPHA_1BIT:
|
||||
d2_cf = d2_mode_alpha1;
|
||||
break;
|
||||
case LV_IMG_CF_ALPHA_2BIT:
|
||||
d2_cf = d2_mode_alpha2;
|
||||
break;
|
||||
case LV_IMG_CF_ALPHA_4BIT:
|
||||
d2_cf = d2_mode_alpha4;
|
||||
break;
|
||||
case LV_IMG_CF_ALPHA_8BIT:
|
||||
d2_cf = d2_mode_alpha8;
|
||||
break;
|
||||
case LV_IMG_CF_INDEXED_1BIT:
|
||||
d2_cf = d2_mode_i1 | d2_mode_clut;
|
||||
break;
|
||||
case LV_IMG_CF_INDEXED_2BIT:
|
||||
d2_cf = d2_mode_i2 | d2_mode_clut;
|
||||
break;
|
||||
case LV_IMG_CF_INDEXED_4BIT:
|
||||
d2_cf = d2_mode_i4 | d2_mode_clut;
|
||||
break;
|
||||
case LV_IMG_CF_INDEXED_8BIT:
|
||||
d2_cf = d2_mode_i8 | d2_mode_clut;
|
||||
break;
|
||||
#if (DLG_LVGL_CF == 1)
|
||||
case LV_IMG_CF_RGB565:
|
||||
d2_cf = d2_mode_rgb565;
|
||||
break;
|
||||
case LV_IMG_CF_RGB888:
|
||||
d2_cf = d2_mode_rgb888;
|
||||
break;
|
||||
case LV_IMG_CF_RGBA8888:
|
||||
d2_cf = d2_mode_rgba8888;
|
||||
break;
|
||||
#endif /* DLG_LVGL_CF */
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if (DLG_LVGL_CF == 1)
|
||||
return d2_cf | (cf & (1 << 5) ? d2_mode_rle : 0);
|
||||
#else
|
||||
return d2_cf;
|
||||
#endif /* (DLG_LVGL_CF == 1) */
|
||||
}
|
||||
|
||||
static bool lv_port_gpu_cf_fb_valid(d2_s32 cf)
|
||||
{
|
||||
if((cf & (d2_mode_rle | d2_mode_clut)) || cf < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(cf) {
|
||||
case d2_mode_alpha8:
|
||||
case d2_mode_rgb565:
|
||||
case d2_mode_argb8888:
|
||||
case d2_mode_argb4444:
|
||||
case d2_mode_rgba8888:
|
||||
case d2_mode_rgba4444:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool lv_port_gpu_cf_has_alpha(d2_s32 cf)
|
||||
{
|
||||
switch(cf & ~(d2_mode_clut | d2_mode_rle)) {
|
||||
case d2_mode_argb8888:
|
||||
case d2_mode_rgba8888:
|
||||
case d2_mode_argb4444:
|
||||
case d2_mode_rgba4444:
|
||||
case d2_mode_argb1555:
|
||||
case d2_mode_rgba5551:
|
||||
case d2_mode_ai44:
|
||||
case d2_mode_i8:
|
||||
case d2_mode_i4:
|
||||
case d2_mode_i2:
|
||||
case d2_mode_i1:
|
||||
case d2_mode_alpha8:
|
||||
case d2_mode_alpha4:
|
||||
case d2_mode_alpha2:
|
||||
case d2_mode_alpha1:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool lv_port_gpu_cf_is_alpha(d2_s32 cf)
|
||||
{
|
||||
switch(cf & ~d2_mode_rle) {
|
||||
case d2_mode_alpha8:
|
||||
case d2_mode_alpha4:
|
||||
case d2_mode_alpha2:
|
||||
case d2_mode_alpha1:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static d2_color lv_port_gpu_color_lv_to_d2(lv_color_t color)
|
||||
{
|
||||
uint8_t alpha, red, green, blue;
|
||||
|
||||
alpha = 0xFF;
|
||||
red = color.ch.red << 3 | color.ch.red >> 2;
|
||||
green = color.ch.green << 2 | color.ch.green >> 4;
|
||||
blue = color.ch.blue << 3 | color.ch.blue >> 2;
|
||||
|
||||
return (alpha) << 24UL
|
||||
| (red) << 16UL
|
||||
| (green) << 8UL
|
||||
| (blue) << 0UL;
|
||||
}
|
||||
|
||||
static void lv_port_gpu_get_recolor_consts(d2_color * cl, d2_color * ch)
|
||||
{
|
||||
d2_color c = lv_port_gpu_color_lv_to_d2(img_dsc.recolor);
|
||||
d2_alpha r, g, b, opa = img_dsc.recolor_opa > LV_OPA_MAX ? LV_OPA_COVER : img_dsc.recolor_opa;
|
||||
|
||||
r = ((uint32_t)((uint8_t)(c >> 16UL)) * opa) / 255;
|
||||
g = ((uint32_t)((uint8_t)(c >> 8UL)) * opa) / 255;
|
||||
b = ((uint32_t)((uint8_t)(c >> 0UL)) * opa) / 255;
|
||||
*cl = r << 16UL | g << 8UL | b << 0UL;
|
||||
|
||||
r += 255 - opa;
|
||||
g += 255 - opa;
|
||||
b += 255 - opa;
|
||||
*ch = r << 16UL | g << 8UL | b << 0UL;
|
||||
}
|
||||
|
||||
static int lv_port_gpu_handle_indexed_color(const lv_color_t ** src, const d2_color ** clut, d2_s32 cf)
|
||||
{
|
||||
int clut_len = 0;
|
||||
|
||||
if(cf & d2_mode_clut) {
|
||||
/* Calculate CLUT length in entries */
|
||||
switch(cf & ~(d2_mode_clut | d2_mode_rle)) {
|
||||
case d2_mode_i1:
|
||||
clut_len = 2;
|
||||
break;
|
||||
case d2_mode_i2:
|
||||
clut_len = 4;
|
||||
break;
|
||||
case d2_mode_i4:
|
||||
clut_len = 16;
|
||||
break;
|
||||
case d2_mode_i8:
|
||||
clut_len = 256;
|
||||
break;
|
||||
case d2_mode_ai44:
|
||||
clut_len = 16;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
*clut = (const d2_color *)*src;
|
||||
*src = (const lv_color_t *)((const uint32_t *)*src + clut_len);
|
||||
}
|
||||
return clut_len;
|
||||
}
|
||||
|
||||
static int lv_port_gpu_cf_bpp(d2_s32 cf)
|
||||
{
|
||||
switch(cf & ~(d2_mode_clut | d2_mode_rle)) {
|
||||
case d2_mode_argb8888:
|
||||
return 32;
|
||||
case d2_mode_rgba8888:
|
||||
return 32;
|
||||
case d2_mode_rgb888:
|
||||
return 32;
|
||||
case d2_mode_argb4444:
|
||||
return 16;
|
||||
case d2_mode_rgba4444:
|
||||
return 16;
|
||||
case d2_mode_argb1555:
|
||||
return 16;
|
||||
case d2_mode_rgba5551:
|
||||
return 16;
|
||||
case d2_mode_rgb565:
|
||||
return 16;
|
||||
case d2_mode_ai44:
|
||||
return 8;
|
||||
case d2_mode_i8:
|
||||
return 8;
|
||||
case d2_mode_i4:
|
||||
return 4;
|
||||
case d2_mode_i2:
|
||||
return 2;
|
||||
case d2_mode_i1:
|
||||
return 1;
|
||||
case d2_mode_alpha8:
|
||||
return 8;
|
||||
case d2_mode_alpha4:
|
||||
return 4;
|
||||
case d2_mode_alpha2:
|
||||
return 2;
|
||||
case d2_mode_alpha1:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static d2_s32 lv_port_gpu_cf_get_default(void)
|
||||
{
|
||||
return d2_mode_rgb565;
|
||||
}
|
||||
|
||||
static void lv_port_gpu_config_blit_clear(void)
|
||||
{
|
||||
alpha_enabled = false;
|
||||
color_key_enabled = false;
|
||||
blend_enabled = true;
|
||||
colorize_enabled = false;
|
||||
|
||||
lv_draw_img_dsc_init(&img_dsc);
|
||||
|
||||
src_cf_val = lv_port_gpu_cf_get_default();
|
||||
dst_cf_val = lv_port_gpu_cf_get_default();
|
||||
}
|
||||
|
||||
void lv_port_gpu_init(void)
|
||||
{
|
||||
lv_port_gpu_config_blit_clear();
|
||||
}
|
||||
|
||||
static void lv_port_gpu_rotate_point(int * x, int * y, float cos_angle, float sin_angle, int pivot_x, int pivot_y)
|
||||
{
|
||||
float fx, fy;
|
||||
|
||||
*x -= pivot_x;
|
||||
*y -= pivot_y;
|
||||
|
||||
fx = ((float) * x) / 16.0f;
|
||||
fy = ((float) * y) / 16.0f;
|
||||
|
||||
*x = (int)(((fx * cos_angle) - (fy * sin_angle)) * 16.0f);
|
||||
*y = (int)(((fx * sin_angle) + (fy * cos_angle)) * 16.0f);
|
||||
|
||||
*x += pivot_x;
|
||||
*y += pivot_y;
|
||||
}
|
||||
|
||||
void lv_draw_ra6m3_g2d_init(void)
|
||||
{
|
||||
if(_d2_handle != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
_d2_handle = d2_opendevice(0);
|
||||
|
||||
if(_d2_handle == NULL)
|
||||
return;
|
||||
|
||||
/* set blocksize for default displaylist */
|
||||
if(d2_setdlistblocksize(_d2_handle, 25) != D2_OK) {
|
||||
LV_LOG_ERROR("Could NOT d2_setdlistblocksize\n");
|
||||
d2_closedevice(_d2_handle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* bind the hardware */
|
||||
if(d2_inithw(_d2_handle, 0) != D2_OK) {
|
||||
LV_LOG_ERROR("Could NOT d2_inithw\n");
|
||||
d2_closedevice(_d2_handle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
renderbuffer = d2_newrenderbuffer(_d2_handle, 20, 20);
|
||||
if(!renderbuffer) {
|
||||
LV_LOG_ERROR("NO renderbuffer\n");
|
||||
d2_closedevice(_d2_handle);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void lv_port_gpu_hw_deinit(void)
|
||||
{
|
||||
if(_d2_handle == NULL)
|
||||
return;
|
||||
|
||||
D2_EXEC(d2_freerenderbuffer(_d2_handle, renderbuffer));
|
||||
D2_EXEC(d2_closedevice(_d2_handle));
|
||||
|
||||
renderbuffer = NULL;
|
||||
_d2_handle = NULL;
|
||||
}
|
||||
|
||||
void lv_port_gpu_flush(void)
|
||||
{
|
||||
lv_port_gpu_hw_deinit();
|
||||
}
|
||||
|
||||
static void lv_port_gpu_start_render(void)
|
||||
{
|
||||
D2_EXEC(d2_selectrenderbuffer(_d2_handle, renderbuffer));
|
||||
}
|
||||
|
||||
static void lv_port_gpu_complete_render(void)
|
||||
{
|
||||
D2_EXEC(d2_flushframe(_d2_handle));
|
||||
}
|
||||
|
||||
void lv_port_gpu_wait(lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_port_gpu_complete_render();
|
||||
|
||||
lv_draw_sw_wait_for_finish(draw_ctx);
|
||||
}
|
||||
|
||||
static void lv_port_gpu_execute_render(void)
|
||||
{
|
||||
if(_d2_handle) {
|
||||
D2_EXEC(d2_executerenderbuffer(_d2_handle, renderbuffer, 0));
|
||||
}
|
||||
}
|
||||
|
||||
void lv_port_gpu_blit(int32_t x, int32_t y, lv_color_t * dst, const lv_area_t * fill_area)
|
||||
{
|
||||
uint32_t ModeSrc;
|
||||
|
||||
ModeSrc = d2_mode_rgb565;
|
||||
|
||||
lv_coord_t dst_width, dst_hight;
|
||||
dst_width = lv_area_get_width(fill_area);
|
||||
dst_hight = lv_area_get_height(fill_area);
|
||||
|
||||
d2_selectrenderbuffer(_d2_handle, renderbuffer);
|
||||
|
||||
// Generate render operations
|
||||
d2_framebuffer(_d2_handle, (uint16_t *)&fb_background[0], LV_HOR_RES_MAX, LV_HOR_RES_MAX,
|
||||
MAX(fill_area->y2 + 1, 2), lv_port_gpu_cf_get_default());
|
||||
|
||||
d2_cliprect(_d2_handle, 0, 0, LV_HOR_RES_MAX - 1, fill_area->y2);
|
||||
d2_setblitsrc(_d2_handle, (void *) dst, dst_width, dst_width, dst_hight, ModeSrc);
|
||||
d2_blitcopy(_d2_handle, dst_width, dst_hight, 0, 0, D2_FIX4(dst_width), D2_FIX4(dst_hight),
|
||||
D2_FIX4(fill_area->x1), D2_FIX4(fill_area->y1), 0);
|
||||
|
||||
// Execute render operations
|
||||
d2_executerenderbuffer(_d2_handle, renderbuffer, 0);
|
||||
}
|
||||
|
||||
void lv_port_gpu_fill(lv_color_t * dest_buf, const lv_area_t * fill_area, lv_coord_t dst_width,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
lv_port_gpu_start_render();
|
||||
|
||||
D2_EXEC(d2_framebuffer(_d2_handle, d1_maptovidmem(_d2_handle, dest_buf), MAX(dst_width, 2), MAX(dst_width, 2),
|
||||
MAX(fill_area->y2 + 1, 2), lv_port_gpu_cf_get_default()));
|
||||
|
||||
D2_EXEC(d2_cliprect(_d2_handle, 0, 0, dst_width - 1, fill_area->y2));
|
||||
D2_EXEC(d2_setalpha(_d2_handle, opa > LV_OPA_MAX ? 0xFF : opa));
|
||||
D2_EXEC(d2_setcolor(_d2_handle, 0, lv_port_gpu_color_lv_to_d2(color)));
|
||||
D2_EXEC(d2_renderbox(_d2_handle, D2_FIX4(fill_area->x1), D2_FIX4(fill_area->y1),
|
||||
D2_FIX4(lv_area_get_width(fill_area)), D2_FIX4(lv_area_get_height(fill_area))));
|
||||
|
||||
lv_port_gpu_execute_render();
|
||||
}
|
||||
|
||||
bool lv_port_gpu_config_blit(const lv_draw_img_dsc_t * draw_dsc, lv_img_cf_t dst_cf,
|
||||
lv_img_cf_t src_cf, bool alpha_en, bool color_key_en, bool blend_en, bool colorize_en)
|
||||
{
|
||||
d2_s32 d2_src_cf, d2_dst_cf;
|
||||
|
||||
if(blend_en && draw_dsc->blend_mode != LV_BLEND_MODE_NORMAL
|
||||
&& draw_dsc->blend_mode != LV_BLEND_MODE_ADDITIVE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
d2_src_cf = lv_port_gpu_cf_lv_to_d2(src_cf);
|
||||
d2_dst_cf = lv_port_gpu_cf_lv_to_d2(dst_cf);
|
||||
if(d2_src_cf < 0 || !lv_port_gpu_cf_fb_valid(d2_dst_cf)) {
|
||||
return false;
|
||||
}
|
||||
src_cf_val = d2_src_cf;
|
||||
dst_cf_val = d2_dst_cf;
|
||||
|
||||
img_dsc = *draw_dsc;
|
||||
|
||||
/* Disable alpha if alpha channel does not exist */
|
||||
alpha_enabled = lv_port_gpu_cf_has_alpha(src_cf_val) ? alpha_en : 0;
|
||||
color_key_enabled = color_key_en;
|
||||
blend_enabled = blend_en;
|
||||
colorize_enabled = colorize_en | lv_port_gpu_cf_is_alpha(src_cf_val);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void lv_port_gpu_blit_internal(const lv_area_t * dest_area, const lv_color_t * src_buf,
|
||||
const lv_area_t * src_area, d2_u32 flags)
|
||||
{
|
||||
const lv_area_t * img_area = src_area;
|
||||
lv_area_t img_area_scaled;
|
||||
lv_coord_t w, h, img_w, img_h;
|
||||
d2_s32 pitch;
|
||||
int bpp = lv_port_gpu_cf_bpp(src_cf_val);
|
||||
|
||||
D2_EXEC(d2_cliprect(_d2_handle, dest_area->x1, dest_area->y1, dest_area->x2, dest_area->y2));
|
||||
|
||||
pitch = w = lv_area_get_width(src_area);
|
||||
h = lv_area_get_height(src_area);
|
||||
|
||||
if(img_dsc.zoom != LV_IMG_ZOOM_NONE) {
|
||||
img_area_scaled.x1 = src_area->x1 + ((((int32_t)0 - img_dsc.pivot.x) * img_dsc.zoom) >> 8) + img_dsc.pivot.x;
|
||||
img_area_scaled.x2 = src_area->x1 + ((((int32_t)w - img_dsc.pivot.x) * img_dsc.zoom) >> 8) + img_dsc.pivot.x;
|
||||
img_area_scaled.y1 = src_area->y1 + ((((int32_t)0 - img_dsc.pivot.y) * img_dsc.zoom) >> 8) + img_dsc.pivot.y;
|
||||
img_area_scaled.y2 = src_area->y1 + ((((int32_t)h - img_dsc.pivot.y) * img_dsc.zoom) >> 8) + img_dsc.pivot.y;
|
||||
img_area = &img_area_scaled;
|
||||
}
|
||||
|
||||
img_w = lv_area_get_width(img_area);
|
||||
img_h = lv_area_get_height(img_area);
|
||||
|
||||
if(0 < bpp && bpp < 8) {
|
||||
pitch = (w + (8 - bpp)) & (~(8 - bpp));
|
||||
}
|
||||
|
||||
if(img_dsc.angle == 0) {
|
||||
D2_EXEC(d2_setblitsrc(_d2_handle, (void *) src_buf, pitch, w, h, src_cf_val));
|
||||
|
||||
D2_EXEC(d2_blitcopy(_d2_handle, w, h, 0, 0,
|
||||
D2_FIX4(img_w), D2_FIX4(img_h), D2_FIX4(img_area->x1), D2_FIX4(img_area->y1), flags));
|
||||
}
|
||||
else {
|
||||
int x, y, x1, y1, x2, y2, x3, y3, x4, y4, dxu, dxv, dyu, dyv, xx, xy, yx, yy;
|
||||
int pivot_scaled_x, pivot_scaled_y;
|
||||
int tex_offset = (flags & d2_bf_filter) ? -32767 : 0;
|
||||
d2_u8 amode, cmode = d2_to_copy;
|
||||
float angle = ((float)img_dsc.angle / 10) * M_PI / 180;
|
||||
float cos_angle = cosf(angle);
|
||||
float sin_angle = sinf(angle);
|
||||
d2_u8 fillmode_backup;
|
||||
|
||||
/* setup texture params */
|
||||
fillmode_backup = d2_getfillmode(_d2_handle);
|
||||
D2_EXEC(d2_setfillmode(_d2_handle, d2_fm_texture));
|
||||
D2_EXEC(d2_settexture(_d2_handle, (void *) src_buf, pitch, w, h, src_cf_val));
|
||||
D2_EXEC(d2_settexturemode(_d2_handle, flags & (d2_bf_filter | d2_bf_wrap)));
|
||||
amode = flags & d2_bf_usealpha ? d2_to_copy : d2_to_one;
|
||||
cmode = flags & d2_bf_colorize2 ? d2_to_blend : d2_to_copy;
|
||||
D2_EXEC(d2_settextureoperation(_d2_handle, amode, cmode, cmode, cmode));
|
||||
if(flags & d2_bf_colorize2) {
|
||||
d2_color cl = d2_getcolor(_d2_handle, 0), ch = d2_getcolor(_d2_handle, 1);
|
||||
D2_EXEC(d2_settexopparam(_d2_handle, d2_cc_red, (uint8_t)(cl >> 16UL),
|
||||
(uint8_t)(ch >> 16UL)));
|
||||
D2_EXEC(d2_settexopparam(_d2_handle, d2_cc_green, (uint8_t)(cl >> 8UL),
|
||||
(uint8_t)(ch >> 8UL)));
|
||||
D2_EXEC(d2_settexopparam(_d2_handle, d2_cc_blue, (uint8_t)(cl >> 0UL),
|
||||
(uint8_t)(ch >> 0UL)));
|
||||
}
|
||||
|
||||
x = D2_FIX4(img_area->x1);
|
||||
y = D2_FIX4(img_area->y1);
|
||||
|
||||
/* define quad points */
|
||||
x1 = D2_FIX4(0);
|
||||
y1 = D2_FIX4(0);
|
||||
x2 = D2_FIX4(img_w);
|
||||
y2 = D2_FIX4(0);
|
||||
x3 = D2_FIX4(img_w);
|
||||
y3 = D2_FIX4(img_h);
|
||||
x4 = D2_FIX4(0);
|
||||
y4 = D2_FIX4(img_h);
|
||||
|
||||
/* rotate points for quad */
|
||||
pivot_scaled_x = (img_dsc.pivot.x * img_dsc.zoom) >> 4;
|
||||
pivot_scaled_y = (img_dsc.pivot.y * img_dsc.zoom) >> 4;
|
||||
|
||||
lv_port_gpu_rotate_point(&x1, &y1, cos_angle, sin_angle, pivot_scaled_x, pivot_scaled_y);
|
||||
lv_port_gpu_rotate_point(&x2, &y2, cos_angle, sin_angle, pivot_scaled_x, pivot_scaled_y);
|
||||
lv_port_gpu_rotate_point(&x3, &y3, cos_angle, sin_angle, pivot_scaled_x, pivot_scaled_y);
|
||||
lv_port_gpu_rotate_point(&x4, &y4, cos_angle, sin_angle, pivot_scaled_x, pivot_scaled_y);
|
||||
|
||||
/* compute texture increments */
|
||||
xx = (int)(cos_angle * 65536.0f);
|
||||
xy = (int)(sin_angle * 65536.0f);
|
||||
yx = (int)(-sin_angle * 65536.0f);
|
||||
yy = (int)(cos_angle * 65536.0f);
|
||||
dxu = ((D2_FIX16(w) / D2_FIX4(img_w)) * xx) >> 12;
|
||||
dxv = ((D2_FIX16(w) / D2_FIX4(img_w)) * xy) >> 12;
|
||||
dyu = ((D2_FIX16(h) / D2_FIX4(img_h)) * yx) >> 12;
|
||||
dyv = ((D2_FIX16(h) / D2_FIX4(img_h)) * yy) >> 12;
|
||||
|
||||
/* map texture exactly to rotated quad, so texel center is always (0/0) top-left */
|
||||
D2_EXEC(d2_settexelcenter(_d2_handle, 0, 0));
|
||||
D2_EXEC(d2_settexturemapping(_d2_handle, (d2_point)(x + x1), (d2_point)(y + y1),
|
||||
tex_offset, tex_offset, dxu, dxv, dyu, dyv));
|
||||
|
||||
int minx = MAX(dest_area->x1, D2_INT4(x + MIN(x1, MIN(x2, MIN(x3, x4)))));
|
||||
int maxx = MIN(dest_area->x2, D2_INT4(x + MAX(x1, MAX(x2, MAX(x3, x4)))));
|
||||
int slice = (flags & d2_bf_filter) ? 6 : 8;
|
||||
|
||||
/* Perform render operation in slices to acheive better performance */
|
||||
for(int posx = minx; posx < maxx; posx += slice) {
|
||||
D2_EXEC(d2_cliprect(_d2_handle, posx, dest_area->y1, MIN(posx + slice - 1, maxx), dest_area->y2));
|
||||
D2_EXEC(d2_renderquad(_d2_handle, (d2_point)(x + x1), (d2_point)(y + y1),
|
||||
(d2_point)(x + x2), (d2_point)(y + y2),
|
||||
(d2_point)(x + x3), (d2_point)(y + y3),
|
||||
(d2_point)(x + x4), (d2_point)(y + y4), 0));
|
||||
}
|
||||
D2_EXEC(d2_setfillmode(_d2_handle, fillmode_backup));
|
||||
}
|
||||
}
|
||||
|
||||
void lv_port_ra_gpu_blit(lv_color_t * dst, const lv_area_t * dst_area, lv_coord_t dest_stride,
|
||||
const lv_color_t * src, const lv_area_t * src_area, lv_opa_t opa)
|
||||
{
|
||||
d2_u32 flags = 0;
|
||||
const d2_color * clut = NULL;
|
||||
int clut_len = 0;
|
||||
|
||||
invalidate_cache();
|
||||
|
||||
clut_len = lv_port_gpu_handle_indexed_color(&src, &clut, src_cf_val);
|
||||
|
||||
lv_port_gpu_start_render();
|
||||
|
||||
D2_EXEC(d2_framebuffer(_d2_handle, d1_maptovidmem(_d2_handle, dst), MAX(dest_stride, 2),
|
||||
MAX(dst_area->x2 + 1, 2), MAX(dst_area->y2 + 1, 2), dst_cf_val));
|
||||
|
||||
flags |= alpha_enabled ? d2_bf_usealpha : 0;
|
||||
|
||||
D2_EXEC(d2_setalpha(_d2_handle, opa > LV_OPA_MAX ? LV_OPA_COVER : opa));
|
||||
|
||||
if(clut) {
|
||||
D2_EXEC(d2_writetexclut_direct(_d2_handle, clut, 0, clut_len));
|
||||
}
|
||||
|
||||
flags |= color_key_enabled ? d2_bf_usealpha : 0;
|
||||
flags |= (colorize_enabled || img_dsc.recolor_opa != LV_OPA_TRANSP) ? d2_bf_colorize2 : 0;
|
||||
if(colorize_enabled) {
|
||||
D2_EXEC(d2_setcolor(_d2_handle, 0, lv_port_gpu_color_lv_to_d2(img_dsc.recolor)));
|
||||
D2_EXEC(d2_setcolor(_d2_handle, 1, lv_port_gpu_color_lv_to_d2(img_dsc.recolor)));
|
||||
}
|
||||
else if(img_dsc.recolor_opa != LV_OPA_TRANSP) {
|
||||
d2_color cl = 0, ch = 0;
|
||||
lv_port_gpu_get_recolor_consts(&cl, &ch);
|
||||
D2_EXEC(d2_setcolor(_d2_handle, 0, cl));
|
||||
D2_EXEC(d2_setcolor(_d2_handle, 1, ch));
|
||||
}
|
||||
|
||||
flags |= ((img_dsc.angle || img_dsc.zoom != LV_IMG_ZOOM_NONE) && img_dsc.antialias) ? d2_bf_filter : 0;
|
||||
|
||||
if(blend_enabled) {
|
||||
D2_EXEC(d2_setblendmode(_d2_handle, d2_bm_alpha,
|
||||
img_dsc.blend_mode != LV_BLEND_MODE_NORMAL ? d2_bm_one : d2_bm_one_minus_alpha));
|
||||
D2_EXEC(d2_setalphablendmode(_d2_handle, d2_bm_one, d2_bm_one_minus_alpha));
|
||||
}
|
||||
else {
|
||||
D2_EXEC(d2_setblendmode(_d2_handle, d2_bm_one, d2_bm_zero));
|
||||
D2_EXEC(d2_setalphablendmode(_d2_handle, d2_bm_one, d2_bm_zero));
|
||||
}
|
||||
|
||||
lv_port_gpu_blit_internal(dst_area, src, src_area, flags);
|
||||
|
||||
lv_port_gpu_execute_render();
|
||||
}
|
||||
|
||||
void lv_draw_ra6m3_2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
lv_area_t blend_area;
|
||||
if(!_lv_area_intersect(&blend_area, dsc->blend_area, draw_ctx->clip_area)) return;
|
||||
|
||||
bool done = false;
|
||||
|
||||
if(dsc->mask_buf == NULL && dsc->blend_mode == LV_BLEND_MODE_NORMAL && lv_area_get_size(&blend_area) > 100) {
|
||||
lv_coord_t dest_stride = lv_area_get_width(draw_ctx->buf_area);
|
||||
|
||||
lv_color_t * dest_buf = draw_ctx->buf;
|
||||
|
||||
const lv_color_t * src_buf = dsc->src_buf;
|
||||
if(src_buf) {
|
||||
lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
|
||||
lv_area_t src_area;
|
||||
src_area.x1 = blend_area.x1 - (dsc->blend_area->x1 - draw_ctx->buf_area->x1);
|
||||
src_area.y1 = blend_area.y1 - (dsc->blend_area->y1 - draw_ctx->buf_area->y1);
|
||||
src_area.x2 = src_area.x1 + lv_area_get_width(dsc->blend_area) - 1;
|
||||
src_area.y2 = src_area.y1 + lv_area_get_height(dsc->blend_area) - 1;
|
||||
|
||||
lv_port_ra_gpu_blit(dest_buf, &blend_area, dest_stride, src_buf, &src_area, dsc->opa);
|
||||
done = true;
|
||||
}
|
||||
else if(dsc->opa >= LV_OPA_MAX) {
|
||||
lv_area_move(&blend_area, -draw_ctx->buf_area->x1, -draw_ctx->buf_area->y1);
|
||||
lv_port_gpu_fill(dest_buf, &blend_area, dest_stride, dsc->color, dsc->opa);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!done) lv_draw_sw_blend_basic(draw_ctx, dsc);
|
||||
}
|
||||
|
||||
static void lv_port_gpu_img_decoded(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t * dsc,
|
||||
const lv_area_t * coords, const uint8_t * map_p, lv_img_cf_t color_format)
|
||||
{
|
||||
/*TODO basic ARGB8888 image can be handles here*/
|
||||
|
||||
lv_draw_sw_img_decoded(draw_ctx, dsc, coords, map_p, color_format);
|
||||
}
|
||||
|
||||
void lv_draw_ra6m3_2d_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sw_init_ctx(drv, draw_ctx);
|
||||
|
||||
lv_draw_ra6m3_dma2d_ctx_t * ra_2d_draw_ctx = (lv_draw_sw_ctx_t *)draw_ctx;
|
||||
|
||||
ra_2d_draw_ctx->blend = lv_draw_ra6m3_2d_blend;
|
||||
ra_2d_draw_ctx->base_draw.draw_img_decoded = lv_port_gpu_img_decoded;
|
||||
ra_2d_draw_ctx->base_draw.wait_for_finish = lv_port_gpu_wait;
|
||||
ra_2d_draw_ctx->base_draw.draw_letter = lv_draw_gpu_letter;
|
||||
//ra_2d_draw_ctx->base_draw.buffer_copy = lv_draw_ra6m3_2d_buffer_copy;
|
||||
}
|
||||
|
||||
void lv_draw_stm32_dma2d_ctx_deinit(lv_disp_t * disp, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
LV_UNUSED(disp);
|
||||
LV_UNUSED(draw_ctx);
|
||||
}
|
||||
|
||||
static void invalidate_cache(void)
|
||||
{
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->clean_dcache_cb) disp->driver->clean_dcache_cb(disp->driver);
|
||||
}
|
||||
|
||||
#ifdef LOG_ERRORS
|
||||
static void lv_port_gpu_log_error(d2_s32 status, const char * func, int line)
|
||||
{
|
||||
if(status) {
|
||||
log_error_list[error_list_index].error = status;
|
||||
log_error_list[error_list_index].func = func;
|
||||
log_error_list[error_list_index].line = line;
|
||||
LV_LOG_ERROR("%s\r\n", d2_geterrorstring(_d2_handle));
|
||||
LV_LOG_ERROR("%d:\t%d - %s : %d\r\n", error_count,
|
||||
log_error_list[error_list_index].error,
|
||||
log_error_list[error_list_index].func,
|
||||
log_error_list[error_list_index].line);
|
||||
|
||||
error_count++;
|
||||
error_list_index++;
|
||||
if(error_list_index >= ERROR_LIST_SIZE) {
|
||||
error_list_index = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* LV_USE_GPU_RA6M3_G2D */
|
||||
56
src/draw/renesas/lv_gpu_d2_ra6m3.h
Normal file
56
src/draw/renesas/lv_gpu_d2_ra6m3.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/**
|
||||
* @file lv_gpu_d2_ra6m3.h
|
||||
*
|
||||
*/
|
||||
#ifndef LV_GPU_D2_RA6M3_H
|
||||
#define LV_GPU_D2_RA6M3_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../misc/lv_color.h"
|
||||
|
||||
#if LV_USE_GPU_RA6M3_G2D
|
||||
#include "../../core/lv_disp.h"
|
||||
#include "../sw/lv_draw_sw.h"
|
||||
|
||||
/**********************
|
||||
* DEFINE
|
||||
**********************/
|
||||
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||
#define M_PI 3.1415926
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef lv_draw_sw_ctx_t lv_draw_ra6m3_dma2d_ctx_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_draw_ra6m3_g2d_init(void);
|
||||
|
||||
void lv_port_gpu_init(void);
|
||||
|
||||
void lv_port_gpu_flush(void);
|
||||
|
||||
void lv_port_gpu_blit(int32_t x, int32_t y, lv_color_t * dst, const lv_area_t * fill_area);
|
||||
|
||||
void lv_draw_ra6m3_2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc);
|
||||
|
||||
void lv_draw_ra6m3_2d_ctx_init(lv_disp_drv_t * drv, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
void lv_draw_ra6m3_2d_ctx_deinit(lv_disp_drv_t * disp, lv_draw_ctx_t * draw_ctx);
|
||||
|
||||
#endif /*LV_USE_GPU_GD32_IPA*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -104,7 +104,9 @@ void lv_draw_sdl_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * ds
|
||||
}
|
||||
|
||||
lv_coord_t w = lv_area_get_width(&draw_area), h = lv_area_get_height(&draw_area);
|
||||
SDL_Texture * texture = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1, w, h);
|
||||
bool texture_cached = false;
|
||||
SDL_Texture * texture = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM1, w, h,
|
||||
&texture_cached);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
dump_masks(texture, &draw_area, mask_ids, mask_ids_count, cap_ids[0] != LV_MASK_ID_INV ? cap_ids : NULL);
|
||||
|
||||
@@ -135,6 +137,11 @@ void lv_draw_sdl_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t * ds
|
||||
SDL_SetTextureColorMod(texture, color.r, color.g, color.b);
|
||||
SDL_SetTextureAlphaMod(texture, dsc->opa);
|
||||
SDL_RenderCopy(ctx->renderer, texture, &srcrect, &dstrect);
|
||||
|
||||
if(!texture_cached) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -86,7 +86,8 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
LV_ASSERT(internals->mask == NULL && internals->composition == NULL && internals->target_backup == NULL);
|
||||
|
||||
lv_coord_t w = lv_area_get_width(apply_area), h = lv_area_get_height(apply_area);
|
||||
internals->composition = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0, w, h);
|
||||
internals->composition = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TARGET0, w, h,
|
||||
&internals->composition_cached);
|
||||
/* Don't need to worry about integral overflow */
|
||||
lv_coord_t ofs_x = (lv_coord_t) - apply_area->x1, ofs_y = (lv_coord_t) - apply_area->y1;
|
||||
/* Offset draw area to start with (0,0) of coords */
|
||||
@@ -100,7 +101,8 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
SDL_RenderFillRect(ctx->renderer, NULL);
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h);
|
||||
internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h,
|
||||
&internals->composition_cached);
|
||||
dump_masks(internals->mask, apply_area);
|
||||
#endif
|
||||
}
|
||||
@@ -174,19 +176,23 @@ void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_
|
||||
break;
|
||||
}
|
||||
SDL_RenderCopy(ctx->renderer, internals->composition, &src_rect, &dst_rect);
|
||||
if(!internals->composition_cached) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(internals->composition);
|
||||
}
|
||||
}
|
||||
|
||||
internals->mask = internals->composition = internals->target_backup = NULL;
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
|
||||
lv_coord_t w, lv_coord_t h)
|
||||
lv_coord_t w, lv_coord_t h, bool * texture_in_cache)
|
||||
{
|
||||
lv_point_t * tex_size = NULL;
|
||||
composite_key_t mask_key = mask_key_create(id);
|
||||
SDL_Texture * result = lv_draw_sdl_texture_cache_get_with_userdata(ctx, &mask_key, sizeof(composite_key_t), NULL,
|
||||
(void **) &tex_size);
|
||||
if(!result || tex_size->x < w || tex_size->y < h) {
|
||||
if(result == NULL || tex_size->x < w || tex_size->y < h) {
|
||||
lv_coord_t size = next_pow_of_2(LV_MAX(w, h));
|
||||
int access = SDL_TEXTUREACCESS_STREAMING;
|
||||
if(id >= LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0) {
|
||||
@@ -198,8 +204,19 @@ SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_d
|
||||
result = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, access, size, size);
|
||||
tex_size = lv_mem_alloc(sizeof(lv_point_t));
|
||||
tex_size->x = tex_size->y = size;
|
||||
lv_draw_sdl_texture_cache_put_advanced(ctx, &mask_key, sizeof(composite_key_t), result, tex_size, lv_mem_free, 0);
|
||||
bool in_cache = lv_draw_sdl_texture_cache_put_advanced(ctx, &mask_key, sizeof(composite_key_t), result,
|
||||
tex_size, lv_mem_free, 0);
|
||||
if(!in_cache) {
|
||||
lv_mem_free(tex_size);
|
||||
}
|
||||
if(texture_in_cache != NULL) {
|
||||
*texture_in_cache = in_cache;
|
||||
}
|
||||
}
|
||||
else if(texture_in_cache != NULL) {
|
||||
*texture_in_cache = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ typedef enum lv_draw_sdl_composite_texture_id_t {
|
||||
/**
|
||||
* Begin drawing with mask. Render target will be switched to a temporary texture,
|
||||
* and drawing coordinates may get clipped or translated
|
||||
* @param ctx Drawing context
|
||||
* @param coords_in Original coordinates
|
||||
* @param clip_in Original clip area
|
||||
* @param extension Useful for shadows or outlines, can be NULL
|
||||
@@ -59,8 +60,18 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
|
||||
void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_area, lv_blend_mode_t blend_mode);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ctx Drawing context
|
||||
* @param id Texture ID
|
||||
* @param w Maximum width needed
|
||||
* @param h Maximum height needed
|
||||
* @param texture_in_cache output to query if the texture is in cache. If it's not in cache, you'll need to destroy it
|
||||
* by yourself
|
||||
* @return Obtained texture
|
||||
*/
|
||||
SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_composite_texture_id_t id,
|
||||
lv_coord_t w, lv_coord_t h);
|
||||
lv_coord_t w, lv_coord_t h, bool * texture_in_cache);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -72,7 +72,8 @@ static void draw_img_rounded(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, con
|
||||
lv_coord_t radius);
|
||||
|
||||
static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture,
|
||||
const lv_draw_sdl_img_header_t * header, int w, int h, lv_coord_t radius);
|
||||
const lv_draw_sdl_img_header_t * header, int w, int h, lv_coord_t radius,
|
||||
bool * in_cache);
|
||||
|
||||
static lv_draw_img_rounded_key_t rounded_key_create(const SDL_Texture * texture, lv_coord_t w, lv_coord_t h,
|
||||
lv_coord_t radius);
|
||||
@@ -106,11 +107,16 @@ lv_res_t lv_draw_sdl_img_core(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t
|
||||
lv_draw_sdl_img_header_t * header = NULL;
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get_with_userdata(ctx, key, key_size, &texture_found,
|
||||
(void **) &header);
|
||||
bool texture_in_cache = false;
|
||||
if(!texture_found) {
|
||||
lv_draw_sdl_img_load_texture(ctx, key, key_size, src, draw_dsc->frame_id, &texture, &header);
|
||||
lv_draw_sdl_img_load_texture(ctx, key, key_size, src, draw_dsc->frame_id, &texture, &header,
|
||||
&texture_in_cache);
|
||||
}
|
||||
else {
|
||||
texture_in_cache = true;
|
||||
}
|
||||
SDL_free(key);
|
||||
if(!texture) {
|
||||
if(!texture || !header) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -148,6 +154,14 @@ lv_res_t lv_draw_sdl_img_core(lv_draw_ctx_t * draw_ctx, const lv_draw_img_dsc_t
|
||||
|
||||
lv_draw_sdl_composite_end(ctx, &apply_area, draw_dsc->blend_mode);
|
||||
|
||||
if(!texture_in_cache) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
if(!header->managed) {
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
lv_mem_free(header);
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
@@ -185,7 +199,7 @@ static void calc_draw_part(SDL_Texture * texture, const lv_draw_sdl_img_header_t
|
||||
|
||||
bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key_head_img_t * key, size_t key_size,
|
||||
const void * src, int32_t frame_id, SDL_Texture ** texture,
|
||||
lv_draw_sdl_img_header_t ** header)
|
||||
lv_draw_sdl_img_header_t ** header, bool * texture_in_cache)
|
||||
{
|
||||
_lv_img_cache_entry_t * cdsc = _lv_img_cache_open(src, lv_color_white(), frame_id);
|
||||
lv_draw_sdl_cache_flag_t tex_flags = 0;
|
||||
@@ -210,16 +224,18 @@ bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key
|
||||
#endif
|
||||
}
|
||||
if(texture && cdsc) {
|
||||
*header = SDL_malloc(sizeof(lv_draw_sdl_img_header_t));
|
||||
*header = lv_mem_alloc(sizeof(lv_draw_sdl_img_header_t));
|
||||
SDL_memcpy(&(*header)->base, &cdsc->dec_dsc.header, sizeof(lv_img_header_t));
|
||||
(*header)->rect = rect;
|
||||
lv_draw_sdl_texture_cache_put_advanced(ctx, key, key_size, *texture, *header, SDL_free, tex_flags);
|
||||
(*header)->managed = (tex_flags & LV_DRAW_SDL_CACHE_FLAG_MANAGED) != 0;
|
||||
*texture_in_cache = lv_draw_sdl_texture_cache_put_advanced(ctx, key, key_size, *texture, *header, SDL_free,
|
||||
tex_flags);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
lv_draw_sdl_texture_cache_put(ctx, key, key_size, NULL);
|
||||
*texture_in_cache = lv_draw_sdl_texture_cache_put(ctx, key, key_size, NULL);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -320,7 +336,8 @@ static void draw_img_rounded(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, con
|
||||
{
|
||||
const int w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
lv_coord_t real_radius = LV_MIN3(radius, w, h);
|
||||
SDL_Texture * frag = img_rounded_frag_obtain(ctx, texture, header, w, h, real_radius);
|
||||
bool frag_in_cache = false;
|
||||
SDL_Texture * frag = img_rounded_frag_obtain(ctx, texture, header, w, h, real_radius, &frag_in_cache);
|
||||
apply_recolor_opa(frag, draw_dsc);
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, frag, real_radius, coords, clip, true);
|
||||
|
||||
@@ -360,6 +377,11 @@ static void draw_img_rounded(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture, con
|
||||
SDL_RenderCopy(ctx->renderer, texture, &src_rect, &dst_rect);
|
||||
}
|
||||
SDL_RenderSetClipRect(ctx->renderer, NULL);
|
||||
|
||||
if(!frag_in_cache) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(frag);
|
||||
}
|
||||
}
|
||||
|
||||
static void apply_recolor_opa(SDL_Texture * texture, const lv_draw_img_dsc_t * draw_dsc)
|
||||
@@ -377,15 +399,18 @@ static void apply_recolor_opa(SDL_Texture * texture, const lv_draw_img_dsc_t * d
|
||||
}
|
||||
|
||||
static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Texture * texture,
|
||||
const lv_draw_sdl_img_header_t * header, int w, int h, lv_coord_t radius)
|
||||
const lv_draw_sdl_img_header_t * header, int w, int h, lv_coord_t radius,
|
||||
bool * in_cache)
|
||||
{
|
||||
lv_draw_img_rounded_key_t key = rounded_key_create(texture, w, h, radius);
|
||||
SDL_Texture * mask_frag = lv_draw_sdl_rect_bg_frag_obtain(ctx, radius);
|
||||
bool mask_frag_in_cache = false;
|
||||
SDL_Texture * mask_frag = lv_draw_sdl_rect_bg_frag_obtain(ctx, radius, &mask_frag_in_cache);
|
||||
SDL_Texture * img_frag = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(img_frag == NULL) {
|
||||
const lv_coord_t full_frag_size = radius * 2 + 3;
|
||||
img_frag = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, SDL_TEXTUREACCESS_TARGET,
|
||||
full_frag_size, full_frag_size);
|
||||
SDL_assert(img_frag);
|
||||
SDL_SetTextureBlendMode(img_frag, SDL_BLENDMODE_BLEND);
|
||||
SDL_Texture * old_target = SDL_GetRenderTarget(ctx->renderer);
|
||||
SDL_SetRenderTarget(ctx->renderer, img_frag);
|
||||
@@ -395,7 +420,7 @@ static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Textur
|
||||
SDL_RenderFillRect(ctx->renderer, NULL);
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
|
||||
lv_area_t coords = {0, 0, w - 1, h - 1}, clip;
|
||||
lv_area_t coords = {0, 0, w - 1, h - 1};
|
||||
lv_area_t frag_coords = {0, 0, full_frag_size - 1, full_frag_size - 1};
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, mask_frag, radius, &frag_coords, NULL, false);
|
||||
|
||||
@@ -446,7 +471,14 @@ static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Textur
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
SDL_SetRenderTarget(ctx->renderer, old_target);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), img_frag);
|
||||
*in_cache = lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), img_frag);
|
||||
}
|
||||
else {
|
||||
*in_cache = true;
|
||||
}
|
||||
if(!mask_frag_in_cache) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(mask_frag);
|
||||
}
|
||||
return img_frag;
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ extern "C" {
|
||||
typedef struct lv_draw_sdl_img_header_t {
|
||||
lv_img_header_t base;
|
||||
SDL_Rect rect;
|
||||
bool managed;
|
||||
} lv_draw_sdl_img_header_t;
|
||||
|
||||
/**********************
|
||||
@@ -56,9 +57,22 @@ typedef struct lv_draw_sdl_img_header_t {
|
||||
/*=====================
|
||||
* Other functions
|
||||
*====================*/
|
||||
/**
|
||||
*
|
||||
* @param ctx Drawing context
|
||||
* @param key Texture cache key
|
||||
* @param key_size Size of texture cache key
|
||||
* @param src Image source pointer
|
||||
* @param frame_id Frame ID for animated image
|
||||
* @param texture Texture for render
|
||||
* @param header Header also holds sdl image info
|
||||
* @param texture_in_cache Whether the texture has been put in the cache. Please note for managed texture,
|
||||
* this will be false too. So you'll need to check header.managed too.
|
||||
* @return Whether the image has been loaded successfully
|
||||
*/
|
||||
bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key_head_img_t * key, size_t key_size,
|
||||
const void * src, int32_t frame_id, SDL_Texture ** texture,
|
||||
lv_draw_sdl_img_header_t ** header);
|
||||
lv_draw_sdl_img_header_t ** header, bool * texture_in_cache);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -54,7 +54,7 @@ static lv_font_glyph_key_t font_key_glyph_create(const lv_font_t * font_p, uint3
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t * dsc, const lv_point_t * pos_p,
|
||||
uint32_t letter)
|
||||
{
|
||||
const lv_area_t * clip_area = draw_ctx->clip_area;
|
||||
@@ -117,6 +117,7 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
lv_font_glyph_key_t glyph_key = font_key_glyph_create(font_p, letter);
|
||||
bool glyph_found = false;
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &glyph_key, sizeof(glyph_key), &glyph_found);
|
||||
bool in_cache = false;
|
||||
if(!glyph_found) {
|
||||
if(g.resolved_font) {
|
||||
font_p = g.resolved_font;
|
||||
@@ -128,7 +129,10 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
texture = SDL_CreateTextureFromSurface(renderer, mask);
|
||||
SDL_FreeSurface(mask);
|
||||
lv_mem_free(buf);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &glyph_key, sizeof(glyph_key), texture);
|
||||
in_cache = lv_draw_sdl_texture_cache_put(ctx, &glyph_key, sizeof(glyph_key), texture);
|
||||
}
|
||||
else {
|
||||
in_cache = true;
|
||||
}
|
||||
if(!texture) {
|
||||
return;
|
||||
@@ -142,6 +146,10 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
|
||||
/*If the letter is completely out of mask don't draw it*/
|
||||
if(!_lv_area_intersect(&draw_area, &t_letter, &t_clip)) {
|
||||
if(!in_cache) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
return;
|
||||
}
|
||||
SDL_Rect srcrect, dstrect;
|
||||
@@ -156,6 +164,11 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
SDL_RenderCopy(renderer, texture, &srcrect, &dstrect);
|
||||
|
||||
lv_draw_sdl_composite_end(ctx, &apply_area, dsc->blend_mode);
|
||||
|
||||
if(!in_cache) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -58,7 +58,8 @@ lv_draw_layer_ctx_t * lv_draw_sdl_layer_init(lv_draw_ctx_t * draw_ctx, lv_draw_l
|
||||
|
||||
enum lv_draw_sdl_composite_texture_id_t texture_id = LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_TRANSFORM0 +
|
||||
ctx->internals->transform_count;
|
||||
transform_ctx->target = lv_draw_sdl_composite_texture_obtain(ctx, texture_id, target_w, target_h);
|
||||
transform_ctx->target = lv_draw_sdl_composite_texture_obtain(ctx, texture_id, target_w, target_h,
|
||||
&transform_ctx->target_in_cache);
|
||||
transform_ctx->target_rect.x = 0;
|
||||
transform_ctx->target_rect.y = 0;
|
||||
transform_ctx->target_rect.w = target_w;
|
||||
@@ -117,6 +118,11 @@ void lv_draw_sdl_layer_blend(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * lay
|
||||
void lv_draw_sdl_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
lv_draw_sdl_layer_ctx_t * transform_ctx = (lv_draw_sdl_layer_ctx_t *) layer_ctx;
|
||||
if(!transform_ctx->target_in_cache && transform_ctx->target != NULL) {
|
||||
LV_LOG_WARN("Texture is not cached, this will impact performance.");
|
||||
SDL_DestroyTexture(transform_ctx->target);
|
||||
}
|
||||
ctx->internals->transform_count -= 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ typedef struct _lv_draw_sdl_layer_ctx_t {
|
||||
SDL_Texture * orig_target;
|
||||
SDL_Texture * target;
|
||||
SDL_Rect target_rect;
|
||||
bool target_in_cache;
|
||||
lv_draw_layer_flags_t flags;
|
||||
} lv_draw_sdl_layer_ctx_t;
|
||||
/**********************
|
||||
|
||||
@@ -53,7 +53,7 @@ static SDL_Texture * line_texture_create(lv_draw_sdl_ctx_t * sdl_ctx, const lv_d
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
void lv_draw_sdl_draw_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t * dsc, const lv_point_t * point1,
|
||||
const lv_point_t * point2)
|
||||
const lv_point_t * point2, bool * in_cache)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * sdl_ctx = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
SDL_Renderer * renderer = sdl_ctx->renderer;
|
||||
@@ -68,7 +68,7 @@ void lv_draw_sdl_draw_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t *
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(sdl_ctx, &key, sizeof(key), NULL);
|
||||
if(!texture) {
|
||||
texture = line_texture_create(sdl_ctx, dsc, (lv_coord_t) length);
|
||||
lv_draw_sdl_texture_cache_put(sdl_ctx, &key, sizeof(key), texture);
|
||||
*in_cache = lv_draw_sdl_texture_cache_put(sdl_ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
|
||||
lv_area_t coords = {x1, y1, x2, y2};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user