refactor: disp->display, res->result/resolution, hor/ver->horizontal/vertical, txt->text, angle->rotation, zoom->scale

This commit is contained in:
Gabor Kiss-Vamosi
2023-09-18 22:57:30 +02:00
parent 57a83cb2ad
commit 0721884ee9
202 changed files with 1894 additions and 1814 deletions

View File

@@ -1026,8 +1026,8 @@ menu "LVGL configuration"
config LV_USE_BMP config LV_USE_BMP
bool "BMP decoder library" bool "BMP decoder library"
config LV_USE_SJPG config LV_USE_JPG
bool "JPG + split JPG decoder library" bool "JPG decoder library"
config LV_USE_GIF config LV_USE_GIF
bool "GIF decoder library" bool "GIF decoder library"

View File

@@ -9,7 +9,7 @@
#include "lv_demo_benchmark.h" #include "lv_demo_benchmark.h"
#if LV_USE_DEMO_BENCHMARK #if LV_USE_DEMO_BENCHMARK
#include "../../src/disp/lv_disp_private.h" #include "../../src/display/lv_display_private.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -74,7 +74,7 @@ static lv_style_t style_common;
static bool scene_with_opa = true; static bool scene_with_opa = true;
static uint32_t last_flush_cb_call; static uint32_t last_flush_cb_call;
static uint32_t render_start_time; static uint32_t render_start_time;
static void (*flush_cb_ori)(lv_disp_t *, const lv_area_t *, uint8_t *); static void (*flush_cb_ori)(lv_display_t *, const lv_area_t *, uint8_t *);
static uint32_t disp_ori_timer_period; static uint32_t disp_ori_timer_period;
static uint32_t anim_ori_timer_period; static uint32_t anim_ori_timer_period;
@@ -100,10 +100,10 @@ static void benchmark_event_remove(void);
static void show_scene_report(void); static void show_scene_report(void);
static void calc_scene_statistics(void); static void calc_scene_statistics(void);
static lv_res_t load_next_scene(void); static lv_result_t load_next_scene(void);
static void next_scene_timer_cb(lv_timer_t * timer); static void next_scene_timer_cb(lv_timer_t * timer);
static void single_scene_finsih_timer_cb(lv_timer_t * timer); static void single_scene_finsih_timer_cb(lv_timer_t * timer);
static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * pxmap); static void dummy_flush_cb(lv_display_t * drv, const lv_area_t * area, uint8_t * pxmap);
static void generate_report(void); static void generate_report(void);
static void rect_create(lv_style_t * style); static void rect_create(lv_style_t * style);
@@ -666,7 +666,7 @@ void lv_demo_benchmark(lv_demo_benchmark_mode_t _mode)
benchmark_init(); benchmark_init();
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) { if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
while(load_next_scene() == LV_RES_OK) { while(load_next_scene() == LV_RESULT_OK) {
uint32_t i; uint32_t i;
for(i = 0; i < RENDER_REPEAT_CNT; i++) { for(i = 0; i < RENDER_REPEAT_CNT; i++) {
/*Wait a little to be sure something happens with the animations*/ /*Wait a little to be sure something happens with the animations*/
@@ -733,9 +733,9 @@ void lv_demo_benchmark_run_scene(lv_demo_benchmark_mode_t _mode, uint16_t scene_
static void benchmark_init(void) static void benchmark_init(void)
{ {
lv_disp_t * disp = lv_disp_get_default(); lv_display_t * disp = lv_display_get_default();
lv_disp_add_event(disp, benchmark_event_cb, LV_EVENT_ALL, NULL); lv_display_add_event(disp, benchmark_event_cb, LV_EVENT_ALL, NULL);
flush_cb_ori = disp->flush_cb; flush_cb_ori = disp->flush_cb;
disp->flush_cb = dummy_flush_cb; disp->flush_cb = dummy_flush_cb;
@@ -785,12 +785,12 @@ static void benchmark_event_cb(lv_event_t * e)
static void benchmark_event_remove(void) static void benchmark_event_remove(void)
{ {
lv_disp_t * disp = lv_disp_get_default(); lv_display_t * disp = lv_display_get_default();
uint32_t i; uint32_t i;
for(i = 0; i < lv_disp_get_event_count(disp); i++) { for(i = 0; i < lv_display_get_event_count(disp); i++) {
lv_event_dsc_t * dsc = lv_disp_get_event_dsc(disp, i); lv_event_dsc_t * dsc = lv_display_get_event_dsc(disp, i);
if(lv_event_dsc_get_cb(dsc) == benchmark_event_cb) { if(lv_event_dsc_get_cb(dsc) == benchmark_event_cb) {
lv_disp_remove_event(disp, i); lv_display_remove_event(disp, i);
return; return;
} }
} }
@@ -827,9 +827,9 @@ static void calc_scene_statistics(void)
} }
} }
static lv_res_t load_next_scene(void) static lv_result_t load_next_scene(void)
{ {
if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RES_INV; if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RESULT_INVALID;
lv_obj_clean(scene_bg); lv_obj_clean(scene_bg);
@@ -841,14 +841,14 @@ static lv_res_t load_next_scene(void)
scene_with_opa = true; scene_with_opa = true;
} }
if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RES_INV; if(scene_act >= 0 && scenes[scene_act].create_cb == NULL) return LV_RESULT_INVALID;
last_flush_cb_call = 0; last_flush_cb_call = 0;
rnd_reset(); rnd_reset();
scenes[scene_act].create_cb(); scenes[scene_act].create_cb();
lv_label_set_text_fmt(title, "%s%s", scenes[scene_act].name, scene_with_opa ? " + opa" : ""); lv_label_set_text_fmt(title, "%s%s", scenes[scene_act].name, scene_with_opa ? " + opa" : "");
return LV_RES_OK; return LV_RESULT_OK;
} }
static void next_scene_timer_cb(lv_timer_t * timer) static void next_scene_timer_cb(lv_timer_t * timer)
@@ -857,9 +857,9 @@ static void next_scene_timer_cb(lv_timer_t * timer)
calc_scene_statistics(); calc_scene_statistics();
show_scene_report(); show_scene_report();
lv_res_t res = load_next_scene(); lv_result_t res = load_next_scene();
if(res == LV_RES_INV) { if(res == LV_RESULT_INVALID) {
lv_timer_del(timer); lv_timer_del(timer);
generate_report(); generate_report();
} }
@@ -870,7 +870,7 @@ static void single_scene_finsih_timer_cb(lv_timer_t * timer)
LV_UNUSED(timer); LV_UNUSED(timer);
calc_scene_statistics(); calc_scene_statistics();
lv_disp_t * disp = lv_disp_get_default(); lv_display_t * disp = lv_display_get_default();
disp->flush_cb = flush_cb_ori; disp->flush_cb = flush_cb_ori;
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) { if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
@@ -886,13 +886,13 @@ static void single_scene_finsih_timer_cb(lv_timer_t * timer)
lv_obj_invalidate(lv_scr_act()); lv_obj_invalidate(lv_scr_act());
} }
static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * pxmap) static void dummy_flush_cb(lv_display_t * drv, const lv_area_t * area, uint8_t * pxmap)
{ {
LV_UNUSED(area); LV_UNUSED(area);
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_AND_DRIVER) { if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_AND_DRIVER) {
/*Measure the time since render start after flushing*/ /*Measure the time since render start after flushing*/
bool last = lv_disp_flush_is_last(drv); bool last = lv_display_flush_is_last(drv);
flush_cb_ori(drv, area, pxmap); flush_cb_ori(drv, area, pxmap);
if(last) { if(last) {
@@ -908,7 +908,7 @@ static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * px
} }
} }
else if(mode == LV_DEMO_BENCHMARK_MODE_REAL) { else if(mode == LV_DEMO_BENCHMARK_MODE_REAL) {
bool last = lv_disp_flush_is_last(drv); bool last = lv_display_flush_is_last(drv);
flush_cb_ori(drv, area, pxmap); flush_cb_ori(drv, area, pxmap);
/*Measure the time since the previous last flush (full render)*/ /*Measure the time since the previous last flush (full render)*/
@@ -929,10 +929,10 @@ static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * px
} }
} }
else if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) { else if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
bool last = lv_disp_flush_is_last(drv); bool last = lv_display_flush_is_last(drv);
/*Just bypass the driver and measure the pure rendering time*/ /*Just bypass the driver and measure the pure rendering time*/
lv_disp_flush_ready(drv); lv_display_flush_ready(drv);
if(last) { if(last) {
uint32_t t = lv_tick_elaps(render_start_time); uint32_t t = lv_tick_elaps(render_start_time);
@@ -950,7 +950,7 @@ static void dummy_flush_cb(lv_disp_t * drv, const lv_area_t * area, uint8_t * px
static void generate_report(void) static void generate_report(void)
{ {
lv_disp_t * disp = lv_disp_get_default(); lv_display_t * disp = lv_display_get_default();
disp->flush_cb = flush_cb_ori; disp->flush_cb = flush_cb_ori;
if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) { if(mode == LV_DEMO_BENCHMARK_MODE_RENDER_ONLY) {
@@ -1114,7 +1114,7 @@ static void img_create(lv_style_t * style, const void * src, bool rotate, bool z
lv_image_set_src(obj, src); lv_image_set_src(obj, src);
lv_obj_set_style_image_recolor(obj, lv_color_hex(rnd_next(0, 0xFFFFF0)), 0); lv_obj_set_style_image_recolor(obj, lv_color_hex(rnd_next(0, 0xFFFFF0)), 0);
if(rotate) lv_image_set_angle(obj, rnd_next(0, 3599)); if(rotate) lv_image_set_rotation(obj, rnd_next(0, 3599));
if(zoom) lv_image_set_zoom(obj, rnd_next(IMG_ZOOM_MIN, IMG_ZOOM_MAX)); if(zoom) lv_image_set_zoom(obj, rnd_next(IMG_ZOOM_MIN, IMG_ZOOM_MAX));
lv_image_set_antialias(obj, aa); lv_image_set_antialias(obj, aa);

View File

@@ -249,8 +249,8 @@ static void inactive_timer_cb(lv_timer_t * t)
return; return;
} }
if(lv_disp_get_inactive_time(NULL) > 8000) { if(lv_display_get_inactive_time(NULL) > 8000) {
lv_disp_trig_activity(NULL); lv_display_trig_activity(NULL);
lv_obj_scroll_by(cont, 100, 0, LV_ANIM_ON); lv_obj_scroll_by(cont, 100, 0, LV_ANIM_ON);
lv_obj_add_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE); lv_obj_add_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
scrolled = true; scrolled = true;

View File

@@ -281,7 +281,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_var(&a, album_image_obj); lv_anim_set_var(&a, album_image_obj);
lv_anim_set_time(&a, 1000); lv_anim_set_time(&a, 1000);
lv_anim_set_delay(&a, INTRO_TIME + 1000); lv_anim_set_delay(&a, INTRO_TIME + 1000);
lv_anim_set_values(&a, 1, LV_ZOOM_NONE); lv_anim_set_values(&a, 1, LV_SCALE_NONE);
lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb); lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL); lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a); lv_anim_start(&a);
@@ -305,7 +305,7 @@ lv_obj_t * _lv_demo_music_main_create(lv_obj_t * parent)
lv_anim_set_var(&a, logo); lv_anim_set_var(&a, logo);
lv_anim_set_time(&a, 400); lv_anim_set_time(&a, 400);
lv_anim_set_delay(&a, INTRO_TIME + 800); lv_anim_set_delay(&a, INTRO_TIME + 800);
lv_anim_set_values(&a, LV_ZOOM_NONE, 10); lv_anim_set_values(&a, LV_SCALE_NONE, 10);
lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb); lv_anim_set_ready_cb(&a, lv_obj_del_anim_ready_cb);
lv_anim_start(&a); lv_anim_start(&a);
@@ -373,7 +373,7 @@ void _lv_demo_music_pause(void)
spectrum_i = 0; spectrum_i = 0;
lv_anim_del(spectrum_obj, spectrum_anim_cb); lv_anim_del(spectrum_obj, spectrum_anim_cb);
lv_obj_invalidate(spectrum_obj); lv_obj_invalidate(spectrum_obj);
lv_image_set_zoom(album_image_obj, LV_ZOOM_NONE); lv_image_set_zoom(album_image_obj, LV_SCALE_NONE);
if(sec_counter_timer) lv_timer_pause(sec_counter_timer); if(sec_counter_timer) lv_timer_pause(sec_counter_timer);
lv_obj_clear_state(play_obj, LV_STATE_CHECKED); lv_obj_clear_state(play_obj, LV_STATE_CHECKED);
} }
@@ -720,7 +720,7 @@ static void track_load(uint32_t id)
lv_anim_set_path_cb(&a, lv_anim_path_linear); lv_anim_set_path_cb(&a, lv_anim_path_linear);
lv_anim_set_var(&a, album_image_obj); lv_anim_set_var(&a, album_image_obj);
lv_anim_set_time(&a, 500); lv_anim_set_time(&a, 500);
lv_anim_set_values(&a, LV_ZOOM_NONE, LV_ZOOM_NONE / 2); lv_anim_set_values(&a, LV_SCALE_NONE, LV_SCALE_NONE / 2);
lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb); lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL); lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a); lv_anim_start(&a);
@@ -731,7 +731,7 @@ static void track_load(uint32_t id)
lv_anim_set_var(&a, album_image_obj); lv_anim_set_var(&a, album_image_obj);
lv_anim_set_time(&a, 500); lv_anim_set_time(&a, 500);
lv_anim_set_delay(&a, 100); lv_anim_set_delay(&a, 100);
lv_anim_set_values(&a, LV_ZOOM_NONE / 4, LV_ZOOM_NONE); lv_anim_set_values(&a, LV_SCALE_NONE / 4, LV_SCALE_NONE);
lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb); lv_anim_set_exec_cb(&a, _image_set_zoom_anim_cb);
lv_anim_set_ready_cb(&a, NULL); lv_anim_set_ready_cb(&a, NULL);
lv_anim_start(&a); lv_anim_start(&a);
@@ -924,7 +924,7 @@ static void spectrum_anim_cb(void * a, int32_t v)
} }
if(spectrum[spectrum_i][0] < 4) bar_rot += dir; if(spectrum[spectrum_i][0] < 4) bar_rot += dir;
lv_image_set_zoom(album_image_obj, LV_ZOOM_NONE + spectrum[spectrum_i][0]); lv_image_set_zoom(album_image_obj, LV_SCALE_NONE + spectrum[spectrum_i][0]);
} }
static void start_anim_cb(void * a, int32_t v) static void start_anim_cb(void * a, int32_t v)

View File

@@ -62,8 +62,8 @@ static void obj_test_task_cb(lv_timer_t * tmr)
switch(state) { switch(state) {
case -1: { case -1: {
lv_res_t res = lv_mem_test(); lv_result_t res = lv_mem_test();
if(res != LV_RES_OK) { if(res != LV_RESULT_OK) {
LV_LOG_ERROR("Memory integrity error"); LV_LOG_ERROR("Memory integrity error");
} }

View File

@@ -87,7 +87,7 @@ void lv_demo_transform(void)
card_to_transform = card_create(); card_to_transform = card_create();
lv_obj_center(card_to_transform); lv_obj_center(card_to_transform);
lv_coord_t disp_w = lv_disp_get_hor_res(NULL); lv_coord_t disp_w = lv_display_get_horizontal_resolution(NULL);
lv_obj_t * arc = lv_arc_create(lv_scr_act()); lv_obj_t * arc = lv_arc_create(lv_scr_act());
lv_obj_set_size(arc, disp_w - 20, disp_w - 20); lv_obj_set_size(arc, disp_w - 20, disp_w - 20);
lv_arc_set_range(arc, 0, 270); lv_arc_set_range(arc, 0, 270);
@@ -148,14 +148,14 @@ static void arc_event_cb(lv_event_t * e)
lv_obj_t * arc = lv_event_get_target(e); lv_obj_t * arc = lv_event_get_target(e);
int32_t v = lv_arc_get_angle_end(arc); int32_t v = lv_arc_get_angle_end(arc);
lv_obj_set_style_transform_angle(card_to_transform, v * 10, 0); lv_obj_set_style_transform_rotation(card_to_transform, v * 10, 0);
} }
static void slider_event_cb(lv_event_t * e) static void slider_event_cb(lv_event_t * e)
{ {
lv_obj_t * slider = lv_event_get_target(e); lv_obj_t * slider = lv_event_get_target(e);
int32_t v = lv_slider_get_value(slider); int32_t v = lv_slider_get_value(slider);
lv_obj_set_style_transform_zoom(card_to_transform, v, 0); lv_obj_set_style_transform_scale(card_to_transform, v, 0);
} }
#endif #endif

View File

@@ -1284,7 +1284,7 @@ static void slider_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%"LV_PRId32, lv_slider_get_value(obj)); lv_snprintf(buf, sizeof(buf), "%"LV_PRId32, lv_slider_get_value(obj));
lv_point_t text_size; lv_point_t text_size;
lv_txt_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE); lv_text_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t txt_area; lv_area_t txt_area;
txt_area.x1 = draw_task->area.x1 + lv_area_get_width(&draw_task->area) / 2 - text_size.x / 2; txt_area.x1 = draw_task->area.x1 + lv_area_get_width(&draw_task->area) / 2 - text_size.x / 2;
@@ -1437,7 +1437,7 @@ static void chart_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, ser->y_points[base_dsc->id2]); lv_snprintf(buf, sizeof(buf), "%"LV_PRIu32, ser->y_points[base_dsc->id2]);
lv_point_t text_size; lv_point_t text_size;
lv_txt_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE); lv_text_get_size(&text_size, buf, font_normal, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t txt_area; lv_area_t txt_area;
if(lv_chart_get_type(obj) == LV_CHART_TYPE_BAR) { if(lv_chart_get_type(obj) == LV_CHART_TYPE_BAR) {

View File

@@ -120,8 +120,8 @@ Move the object with this value in Y direction. Applied after layouts, aligns an
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### transform_zoom ### transform_scale
Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on Zoom an objects. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on
<ul> <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>Default</strong> 0</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -129,7 +129,7 @@ Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half s
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li>
</ul> </ul>
### transform_angle ### transform_rotation
Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg. Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg.
<ul> <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>Default</strong> 0</li>
@@ -327,8 +327,8 @@ Set the dithering mode of the gradient of the background. The possible values ar
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### bg_img_src ### bg_image_src
Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or an `LV_SYMBOL_...` Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `NULL`</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `NULL`</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>
@@ -336,7 +336,7 @@ Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> Yes</li>
</ul> </ul>
### bg_img_opa ### bg_image_opa
Set the opacity of the background image. 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. Set the opacity of the background image. 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> <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>Default</strong> `LV_OPA_COVER`</li>
@@ -345,7 +345,7 @@ Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP`
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### bg_img_recolor ### bg_image_recolor
Set a color to mix to the background image. Set a color to mix to the background image.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `0x000000`</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `0x000000`</li>
@@ -354,7 +354,7 @@ Set a color to mix to the background image.
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### bg_img_recolor_opa ### bg_image_recolor_opa
Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally. Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_TRANSP`</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `LV_OPA_TRANSP`</li>
@@ -363,7 +363,7 @@ Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### bg_img_tiled ### bg_image_tiled
If enabled the background image will be tiled. The possible values are `true` or `false`. If enabled the background image will be tiled. The possible values are `true` or `false`.
<ul> <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>Default</strong> 0</li>
@@ -519,7 +519,7 @@ Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means full
## Image ## Image
Properties to describe the images Properties to describe the images
### img_opa ### image_opa
Set the opacity of an image. 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. Set the opacity of an image. 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> <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>Default</strong> `LV_OPA_COVER`</li>
@@ -528,7 +528,7 @@ Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### img_recolor ### image_recolor
Set color to mixt to the image. Set color to mixt to the image.
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `0x000000`</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `0x000000`</li>
@@ -537,7 +537,7 @@ Set color to mixt to the image.
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### img_recolor_opa ### image_recolor_opa
Set the intensity of the color mixing. 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. Set the intensity of the color mixing. 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> <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>Default</strong> 0</li>
@@ -642,8 +642,8 @@ Set the opacity of the arcs.
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Ext. draw</strong> No</li>
</ul> </ul>
### arc_img_src ### arc_image_src
Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_img_dsc_t` or a path to a file Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file
<ul> <ul>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `NULL`</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Default</strong> `NULL`</li>
<li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li> <li style='display:inline; margin-right: 20px; margin-left: 0px'><strong>Inherited</strong> No</li>

View File

@@ -277,7 +277,7 @@
/*Maximum buffer size to allocate for rotation. /*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/ *Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024) #define LV_DISPLAY_ROT_MAX_BUF (10*1024)
/*Garbage Collector settings /*Garbage Collector settings
*Used if lvgl is bound to higher level language and the memory is managed by that language*/ *Used if lvgl is bound to higher level language and the memory is managed by that language*/
@@ -315,7 +315,7 @@
/*Define a custom attribute to `lv_timer_handler` function*/ /*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER #define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_disp_flush_ready` function*/ /*Define a custom attribute to `lv_display_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY #define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/ /*Required alignment size for buffers*/

View File

@@ -31,7 +31,7 @@ void lv_example_snapshot_1(void)
lv_obj_set_style_bg_color(snapshot_obj, lv_palette_main(LV_PALETTE_PURPLE), 0); lv_obj_set_style_bg_color(snapshot_obj, lv_palette_main(LV_PALETTE_PURPLE), 0);
lv_obj_set_style_bg_opa(snapshot_obj, LV_OPA_100, 0); lv_obj_set_style_bg_opa(snapshot_obj, LV_OPA_100, 0);
lv_image_set_zoom(snapshot_obj, 128); lv_image_set_zoom(snapshot_obj, 128);
lv_image_set_angle(snapshot_obj, 300); lv_image_set_rotation(snapshot_obj, 300);
/*Create the container and its children*/ /*Create the container and its children*/
lv_obj_t * container = lv_obj_create(root); lv_obj_t * container = lv_obj_create(root);
@@ -48,7 +48,7 @@ void lv_example_snapshot_1(void)
lv_image_set_src(img, &img_star); lv_image_set_src(img, &img_star);
lv_obj_set_style_bg_color(img, lv_color_black(), 0); lv_obj_set_style_bg_color(img, lv_color_black(), 0);
lv_obj_set_style_bg_opa(img, LV_OPA_COVER, 0); lv_obj_set_style_bg_opa(img, LV_OPA_COVER, 0);
// lv_obj_set_style_transform_zoom(img, 400, LV_STATE_PRESSED); // lv_obj_set_style_transform_scale(img, 400, LV_STATE_PRESSED);
lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE); lv_obj_add_flag(img, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_event(img, event_cb, LV_EVENT_PRESSED, snapshot_obj); lv_obj_add_event(img, event_cb, LV_EVENT_PRESSED, snapshot_obj);
lv_obj_add_event(img, event_cb, LV_EVENT_RELEASED, snapshot_obj); lv_obj_add_event(img, event_cb, LV_EVENT_RELEASED, snapshot_obj);

View File

@@ -44,7 +44,7 @@ root.set_style_bg_color(lv.palette_main(lv.PALETTE.LIGHT_BLUE), 0)
snapshot_obj = lv.image(root) snapshot_obj = lv.image(root)
snapshot_obj.set_style_bg_color(lv.palette_main(lv.PALETTE.PURPLE), 0) snapshot_obj.set_style_bg_color(lv.palette_main(lv.PALETTE.PURPLE), 0)
snapshot_obj.set_style_bg_opa(lv.OPA.COVER, 0) snapshot_obj.set_style_bg_opa(lv.OPA.COVER, 0)
snapshot_obj.set_zoom(128) snapshot_obj.set_scale(128)
# Create the container and its children # Create the container and its children
container = lv.obj(root) container = lv.obj(root)
@@ -59,7 +59,7 @@ for i in range(4):
image.set_src(image_star) image.set_src(image_star)
image.set_style_bg_color(lv.palette_main(lv.PALETTE.GREY), 0) image.set_style_bg_color(lv.palette_main(lv.PALETTE.GREY), 0)
image.set_style_bg_opa(lv.OPA.COVER, 0) image.set_style_bg_opa(lv.OPA.COVER, 0)
image.set_style_transform_zoom(400, lv.STATE.PRESSED) image.set_style_transform_scale(400, lv.STATE.PRESSED)
image.add_flag(image.FLAG.CLICKABLE) image.add_flag(image.FLAG.CLICKABLE)
image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.PRESSED, None) image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.PRESSED, None)
image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.RELEASED, None) image.add_event(lambda e: event_cb(e, snapshot_obj), lv.EVENT.RELEASED, None)

View File

@@ -34,7 +34,7 @@
**********************/ **********************/
static void disp_init(void); static void disp_init(void);
static void disp_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * px_map); static void disp_flush(lv_display_t * disp, const lv_area_t * area, lv_color_t * px_map);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -58,27 +58,27 @@ void lv_port_disp_init(void)
/*------------------------------------ /*------------------------------------
* Create a display and set a flush_cb * Create a display and set a flush_cb
* -----------------------------------*/ * -----------------------------------*/
lv_disp_t * disp = lv_disp_create(MY_DISP_HOR_RES, MY_DISP_VER_RES); lv_display_t * disp = lv_display_create(MY_DISP_HOR_RES, MY_DISP_VER_RES);
lv_disp_set_flush_cb(disp, disp_flush); lv_display_set_flush_cb(disp, disp_flush);
/* Example 1 /* Example 1
* One buffer for partial rendering*/ * One buffer for partial rendering*/
static lv_color_t buf_1_1[MY_DISP_HOR_RES * 10]; /*A buffer for 10 rows*/ static lv_color_t buf_1_1[MY_DISP_HOR_RES * 10]; /*A buffer for 10 rows*/
lv_disp_set_draw_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), LV_DISP_RENDER_MODE_PARTIAL); lv_display_set_draw_buffers(disp, buf_1_1, NULL, sizeof(buf_1_1), LV_DISPLAY_RENDER_MODE_PARTIAL);
/* Example 2 /* Example 2
* Two buffers for partial rendering * Two buffers for partial rendering
* In flush_cb DMA or similar hardware should be used to update the display in the background.*/ * In flush_cb DMA or similar hardware should be used to update the display in the background.*/
static lv_color_t buf_2_1[MY_DISP_HOR_RES * 10]; static lv_color_t buf_2_1[MY_DISP_HOR_RES * 10];
static lv_color_t buf_2_2[MY_DISP_HOR_RES * 10]; static lv_color_t buf_2_2[MY_DISP_HOR_RES * 10];
lv_disp_set_draw_buffers(disp, buf_2_1, buf_2_2, sizeof(buf_2_1), LV_DISP_RENDER_MODE_PARTIAL); lv_display_set_draw_buffers(disp, buf_2_1, buf_2_2, sizeof(buf_2_1), LV_DISPLAY_RENDER_MODE_PARTIAL);
/* Example 3 /* Example 3
* Two buffers screen sized buffer for double buffering. * Two buffers screen sized buffer for double buffering.
* Both LV_DISP_RENDER_MODE_DIRECT and LV_DISP_RENDER_MODE_FULL works, see their comments*/ * Both LV_DISPLAY_RENDER_MODE_DIRECT and LV_DISPLAY_RENDER_MODE_FULL works, see their comments*/
static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES]; static lv_color_t buf_3_1[MY_DISP_HOR_RES * MY_DISP_VER_RES];
static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES]; static lv_color_t buf_3_2[MY_DISP_HOR_RES * MY_DISP_VER_RES];
lv_disp_set_draw_buffers(disp, buf_3_1, buf_3_2, sizeof(buf_3_1), LV_DISP_RENDER_MODE_DIRECT); lv_display_set_draw_buffers(disp, buf_3_1, buf_3_2, sizeof(buf_3_1), LV_DISPLAY_RENDER_MODE_DIRECT);
} }
@@ -111,8 +111,8 @@ void disp_disable_update(void)
/*Flush the content of the internal buffer the specific area on the display. /*Flush the content of the internal buffer the specific area on the display.
*`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display. *`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display.
*You can use DMA or any hardware acceleration to do this operation in the background but *You can use DMA or any hardware acceleration to do this operation in the background but
*'lv_disp_flush_ready()' has to be called when it's finished.*/ *'lv_display_flush_ready()' has to be called when it's finished.*/
static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t * px_map) static void disp_flush(lv_display_t * disp_drv, const lv_area_t * area, lv_color_t * px_map)
{ {
if(disp_flush_enabled) { if(disp_flush_enabled) {
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/ /*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
@@ -130,7 +130,7 @@ static void disp_flush(lv_disp_t * disp_drv, const lv_area_t * area, lv_color_t
/*IMPORTANT!!! /*IMPORTANT!!!
*Inform the graphics library that you are ready with the flushing*/ *Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv); lv_display_flush_ready(disp_drv);
} }
#else /*Enable this file at the top*/ #else /*Enable this file at the top*/

View File

@@ -24,7 +24,7 @@ static void new_theme_init_and_set(void)
lv_style_set_border_width(&style_btn, 3); lv_style_set_border_width(&style_btn, 3);
/*Initialize the new theme from the current theme*/ /*Initialize the new theme from the current theme*/
lv_theme_t * th_act = lv_disp_get_theme(NULL); lv_theme_t * th_act = lv_display_get_theme(NULL);
static lv_theme_t th_new; static lv_theme_t th_new;
th_new = *th_act; th_new = *th_act;
@@ -33,7 +33,7 @@ static void new_theme_init_and_set(void)
lv_theme_set_apply_cb(&th_new, new_theme_apply_cb); lv_theme_set_apply_cb(&th_new, new_theme_apply_cb);
/*Assign the new theme to the current display*/ /*Assign the new theme to the current display*/
lv_disp_set_theme(NULL, &th_new); lv_display_set_theme(NULL, &th_new);
} }

View File

@@ -49,7 +49,7 @@ class ExampleStyle_14:
# Initialize the new theme from the current theme # Initialize the new theme from the current theme
self.th_new = NewTheme() self.th_new = NewTheme()
self.th_new.set_apply_cb(self.new_theme_apply_cb) self.th_new.set_apply_cb(self.new_theme_apply_cb)
lv.disp_get_default().set_theme(self.th_new) lv.display_get_default().set_theme(self.th_new)
exampleStyle_14 = ExampleStyle_14() exampleStyle_14 = ExampleStyle_14()

View File

@@ -35,8 +35,8 @@ void lv_example_style_15(void)
*The button and the label is rendered to a layer first and that layer is transformed*/ *The button and the label is rendered to a layer first and that layer is transformed*/
btn = lv_button_create(lv_scr_act()); btn = lv_button_create(lv_scr_act());
lv_obj_set_size(btn, 100, 40); lv_obj_set_size(btn, 100, 40);
lv_obj_set_style_transform_angle(btn, 150, 0); /*15 deg*/ lv_obj_set_style_transform_rotation(btn, 150, 0); /*15 deg*/
lv_obj_set_style_transform_zoom(btn, 256 + 64, 0); /*1.25x*/ lv_obj_set_style_transform_scale(btn, 256 + 64, 0); /*1.25x*/
lv_obj_set_style_transform_pivot_x(btn, 50, 0); lv_obj_set_style_transform_pivot_x(btn, 50, 0);
lv_obj_set_style_transform_pivot_y(btn, 20, 0); lv_obj_set_style_transform_pivot_y(btn, 20, 0);
lv_obj_set_style_opa(btn, LV_OPA_50, 0); lv_obj_set_style_opa(btn, LV_OPA_50, 0);

View File

@@ -26,8 +26,8 @@ label.center()
# The button and the label is rendered to a layer first and that layer is transformed # The button and the label is rendered to a layer first and that layer is transformed
button = lv.button(lv.scr_act()) button = lv.button(lv.scr_act())
button.set_size(100, 40) button.set_size(100, 40)
button.set_style_transform_angle(150, 0) # 15 deg button.set_style_transform_rotation(150, 0) # 15 deg
button.set_style_transform_zoom(256 + 64, 0) # 1.25x button.set_style_transform_scale(256 + 64, 0) # 1.25x
button.set_style_transform_pivot_x(50, 0) button.set_style_transform_pivot_x(50, 0)
button.set_style_transform_pivot_y(20, 0) button.set_style_transform_pivot_y(20, 0)
button.set_style_opa(lv.OPA._50, 0) button.set_style_opa(lv.OPA._50, 0)

View File

@@ -18,7 +18,7 @@ void lv_example_style_6(void)
lv_style_set_image_recolor(&style, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_image_recolor(&style, lv_palette_main(LV_PALETTE_BLUE));
lv_style_set_image_recolor_opa(&style, LV_OPA_50); lv_style_set_image_recolor_opa(&style, LV_OPA_50);
lv_style_set_transform_angle(&style, 300); lv_style_set_transform_rotation(&style, 300);
/*Create an object with the new style*/ /*Create an object with the new style*/
lv_obj_t * obj = lv_image_create(lv_scr_act()); lv_obj_t * obj = lv_image_create(lv_scr_act());

View File

@@ -26,7 +26,7 @@ style.set_border_color(lv.palette_main(lv.PALETTE.BLUE))
style.set_image_recolor(lv.palette_main(lv.PALETTE.BLUE)) style.set_image_recolor(lv.palette_main(lv.PALETTE.BLUE))
style.set_image_recolor_opa(lv.OPA._50) style.set_image_recolor_opa(lv.OPA._50)
style.set_transform_angle(300) style.set_transform_rotation(300)
# Create an object with the new style # Create an object with the new style
obj = lv.image(lv.scr_act()) obj = lv.image(lv.scr_act())

View File

@@ -18,7 +18,7 @@ static void event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj)); lv_snprintf(buf, sizeof(buf), "%d", (int)lv_bar_get_value(obj));
lv_point_t txt_size; lv_point_t txt_size;
lv_txt_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, lv_text_get_size(&txt_size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
label_dsc.flag); label_dsc.flag);
lv_area_t txt_area; lv_area_t txt_area;

View File

@@ -48,8 +48,8 @@ static void event_cb(lv_event_t * e)
if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) { if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) {
LV_IMAGE_DECLARE(img_star); LV_IMAGE_DECLARE(img_star);
lv_image_header_t header; lv_image_header_t header;
lv_res_t res = lv_image_decoder_get_info(&img_star, &header); lv_result_t res = lv_image_decoder_get_info(&img_star, &header);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
lv_area_t a; lv_area_t a;
a.x1 = 0; a.x1 = 0;

View File

@@ -5,7 +5,7 @@ def event_handler(e):
if code == lv.EVENT.VALUE_CHANGED: if code == lv.EVENT.VALUE_CHANGED:
source = e.get_current_target_obj() source = e.get_current_target_obj()
date = lv.calendar_date_t() date = lv.calendar_date_t()
if source.get_pressed_date(date) == lv.RES.OK: if source.get_pressed_date(date) == lv.RESULT.OK:
calendar.set_today_date(date.year, date.month, date.day) calendar.set_today_date(date.year, date.month, date.day)
print("Clicked date: %02d.%02d.%02d"%(date.day, date.month, date.year)) print("Clicked date: %02d.%02d.%02d"%(date.day, date.month, date.year))

View File

@@ -64,7 +64,7 @@ void lv_example_canvas_1(void)
lv_draw_image_dsc_t img_dsc; lv_draw_image_dsc_t img_dsc;
lv_draw_image_dsc_init(&img_dsc); lv_draw_image_dsc_init(&img_dsc);
img_dsc.angle = 120; img_dsc.rotation = 120;
img_dsc.src = &img; img_dsc.src = &img;
img_dsc.pivot.x = CANVAS_WIDTH / 2; img_dsc.pivot.x = CANVAS_WIDTH / 2;
img_dsc.pivot.y = CANVAS_HEIGHT / 2; img_dsc.pivot.y = CANVAS_HEIGHT / 2;

View File

@@ -72,7 +72,7 @@ canvas.fill_bg(lv.palette_lighten(lv.PALETTE.GREY, 3), lv.OPA.COVER)
image_dsc = lv.draw_image_dsc_t() image_dsc = lv.draw_image_dsc_t()
image_dsc.init(); image_dsc.init();
image_dsc.angle = 120; image_dsc.rotation = 120;
image_dsc.src = image; image_dsc.src = image;
image_dsc.pivot.x = _CANVAS_WIDTH // 2; image_dsc.pivot.x = _CANVAS_WIDTH // 2;
image_dsc.pivot.y = _CANVAS_HEIGHT // 2; image_dsc.pivot.y = _CANVAS_HEIGHT // 2;

View File

@@ -84,13 +84,13 @@ void lv_example_chart_5(void)
lv_obj_t * slider; lv_obj_t * slider;
slider = lv_slider_create(lv_scr_act()); slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, LV_ZOOM_NONE, LV_ZOOM_NONE * 10); lv_slider_set_range(slider, LV_SCALE_NONE, LV_SCALE_NONE * 10);
lv_obj_add_event(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_event(slider, slider_x_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(slider, 200, 10); lv_obj_set_size(slider, 200, 10);
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_BOTTOM_MID, 0, 20);
slider = lv_slider_create(lv_scr_act()); slider = lv_slider_create(lv_scr_act());
lv_slider_set_range(slider, LV_ZOOM_NONE, LV_ZOOM_NONE * 10); lv_slider_set_range(slider, LV_SCALE_NONE, LV_SCALE_NONE * 10);
lv_obj_add_event(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_event(slider, slider_y_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
lv_obj_set_size(slider, 10, 150); lv_obj_set_size(slider, 10, 150);
lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0); lv_obj_align_to(slider, chart, LV_ALIGN_OUT_RIGHT_MID, 20, 0);

View File

@@ -76,13 +76,13 @@ chart.set_point_count(pcnt)
chart.set_ext_y_array(ser, ecg_sample) chart.set_ext_y_array(ser, ecg_sample)
slider = lv.slider(lv.scr_act()) slider = lv.slider(lv.scr_act())
slider.set_range(lv.ZOOM_NONE, lv.ZOOM_NONE * 10) slider.set_range(lv.SCALE_NONE, lv.SCALE_NONE * 10)
slider.add_event(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.add_event(slider_x_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(200,10) slider.set_size(200,10)
slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20) slider.align_to(chart, lv.ALIGN.OUT_BOTTOM_MID, 0, 20)
slider = lv.slider(lv.scr_act()) slider = lv.slider(lv.scr_act())
slider.set_range(lv.ZOOM_NONE, lv.ZOOM_NONE * 10) slider.set_range(lv.SCALE_NONE, lv.SCALE_NONE * 10)
slider.add_event(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None) slider.add_event(slider_y_event_cb, lv.EVENT.VALUE_CHANGED, None)
slider.set_size(10, 150) slider.set_size(10, 150)
slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0) slider.align_to(chart, lv.ALIGN.OUT_RIGHT_MID, 20, 0)

View File

@@ -32,7 +32,7 @@ void lv_example_dropdown_3(void)
/*Use a custom image as down icon and flip it when the list is opened*/ /*Use a custom image as down icon and flip it when the list is opened*/
LV_IMAGE_DECLARE(img_caret_down) LV_IMAGE_DECLARE(img_caret_down)
lv_dropdown_set_symbol(dropdown, &img_caret_down); lv_dropdown_set_symbol(dropdown, &img_caret_down);
lv_obj_set_style_transform_angle(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED); lv_obj_set_style_transform_rotation(dropdown, 1800, LV_PART_INDICATOR | LV_STATE_CHECKED);
/*In a menu we don't need to show the last clicked item*/ /*In a menu we don't need to show the last clicked item*/
lv_dropdown_set_selected_highlight(dropdown, false); lv_dropdown_set_selected_highlight(dropdown, false);

View File

@@ -37,7 +37,7 @@ dropdown.set_text("Menu")
# Use a custom image as down icon and flip it when the list is opened # Use a custom image as down icon and flip it when the list is opened
# LV_IMAGE_DECLARE(image_caret_down) # LV_IMAGE_DECLARE(image_caret_down)
dropdown.set_symbol(image_caret_down_argb) dropdown.set_symbol(image_caret_down_argb)
dropdown.set_style_transform_angle(1800, lv.PART.INDICATOR | lv.STATE.CHECKED) dropdown.set_style_transform_rotation(1800, lv.PART.INDICATOR | lv.STATE.CHECKED)
# In a menu we don't need to show the last clicked item # In a menu we don't need to show the last clicked item
dropdown.set_selected_highlight(False) dropdown.set_selected_highlight(False)

View File

@@ -3,7 +3,7 @@
static void set_angle(void * img, int32_t v) static void set_angle(void * img, int32_t v)
{ {
lv_image_set_angle(img, v); lv_image_set_rotation(img, v);
} }
static void set_zoom(void * img, int32_t v) static void set_zoom(void * img, int32_t v)

View File

@@ -5,7 +5,7 @@ void lv_example_menu_1(void)
{ {
/*Create a menu object*/ /*Create a menu object*/
lv_obj_t * menu = lv_menu_create(lv_scr_act()); lv_obj_t * menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL)); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu); lv_obj_center(menu);
lv_obj_t * cont; lv_obj_t * cont;

View File

@@ -17,7 +17,7 @@ void lv_example_menu_2(void)
lv_obj_t * menu = lv_menu_create(lv_scr_act()); lv_obj_t * menu = lv_menu_create(lv_scr_act());
lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED); lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED);
lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu); lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu);
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL)); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu); lv_obj_center(menu);
lv_obj_t * cont; lv_obj_t * cont;

View File

@@ -5,7 +5,7 @@ void lv_example_menu_3(void)
{ {
/*Create a menu object*/ /*Create a menu object*/
lv_obj_t * menu = lv_menu_create(lv_scr_act()); lv_obj_t * menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL)); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu); lv_obj_center(menu);
/*Modify the header*/ /*Modify the header*/

View File

@@ -32,7 +32,7 @@ void lv_example_menu_4(void)
{ {
/*Create a menu object*/ /*Create a menu object*/
menu = lv_menu_create(lv_scr_act()); menu = lv_menu_create(lv_scr_act());
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL)); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu); lv_obj_center(menu);
lv_obj_t * cont; lv_obj_t * cont;

View File

@@ -30,7 +30,7 @@ void lv_example_menu_5(void)
} }
lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED); lv_menu_set_mode_root_back_button(menu, LV_MENU_ROOT_BACK_BUTTON_ENABLED);
lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu); lv_obj_add_event(menu, back_event_handler, LV_EVENT_CLICKED, menu);
lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL)); lv_obj_set_size(menu, lv_display_get_horizontal_resolution(NULL), lv_display_get_vertical_resolution(NULL));
lv_obj_center(menu); lv_obj_center(menu);
lv_obj_t * cont; lv_obj_t * cont;

View File

@@ -7,7 +7,7 @@
void lv_example_scale_5(void) void lv_example_scale_5(void)
{ {
lv_obj_t * scale = lv_scale_create(lv_scr_act()); lv_obj_t * scale = lv_scale_create(lv_scr_act());
lv_obj_set_size(scale, lv_disp_get_hor_res(NULL) / 2, lv_disp_get_ver_res(NULL) / 2); lv_obj_set_size(scale, lv_display_get_horizontal_resolution(NULL) / 2, lv_display_get_vertical_resolution(NULL) / 2);
lv_scale_set_label_show(scale, true); lv_scale_set_label_show(scale, true);
lv_scale_set_total_tick_count(scale, 10); lv_scale_set_total_tick_count(scale, 10);

View File

@@ -40,7 +40,7 @@ static void slider_event_cb(lv_event_t * e)
lv_snprintf(buf, sizeof(buf), "%d - %d", (int)lv_slider_get_left_value(obj), (int)lv_slider_get_value(obj)); lv_snprintf(buf, sizeof(buf), "%d - %d", (int)lv_slider_get_left_value(obj), (int)lv_slider_get_value(obj));
lv_point_t label_size; lv_point_t label_size;
lv_txt_get_size(&label_size, buf, LV_FONT_DEFAULT, 0, 0, LV_COORD_MAX, 0); lv_text_get_size(&label_size, buf, LV_FONT_DEFAULT, 0, 0, LV_COORD_MAX, 0);
lv_area_t label_area; lv_area_t label_area;
label_area.x1 = 0; label_area.x1 = 0;
label_area.x2 = label_size.x - 1; label_area.x2 = label_size.x - 1;

View File

@@ -12,7 +12,7 @@ def slider_event_cb(e):
if base_dsc.part == lv.PART.INDICATOR: if base_dsc.part == lv.PART.INDICATOR:
label_text = "{:d} - {:d}".format(obj.get_left_value(),slider.get_value()) label_text = "{:d} - {:d}".format(obj.get_left_value(),slider.get_value())
label_size = lv.point_t() label_size = lv.point_t()
lv.txt_get_size(label_size, label_text, lv.font_default(), 0, 0, lv.COORD.MAX, 0) lv.text_get_size(label_size, label_text, lv.font_default(), 0, 0, lv.COORD.MAX, 0)
# print(label_size.x,label_size.y) # print(label_size.x,label_size.y)
label_area = lv.area_t() label_area = lv.area_t()
label_area.x1 = dsc.area.x1 + dsc.area.get_width() // 2 - label_size.x // 2 label_area.x1 = dsc.area.x1 + dsc.area.get_width() // 2 - label_size.x // 2

View File

@@ -239,7 +239,7 @@
/*Maximum buffer size to allocate for rotation. /*Maximum buffer size to allocate for rotation.
*Only used if software rotation is enabled in the display driver.*/ *Only used if software rotation is enabled in the display driver.*/
#define LV_DISP_ROT_MAX_BUF (10*1024) #define LV_DISPLAY_ROT_MAX_BUF (10*1024)
#define LV_ENABLE_GLOBAL_CUSTOM 0 #define LV_ENABLE_GLOBAL_CUSTOM 0
#if LV_ENABLE_GLOBAL_CUSTOM #if LV_ENABLE_GLOBAL_CUSTOM
@@ -278,7 +278,7 @@
/*Define a custom attribute to `lv_timer_handler` function*/ /*Define a custom attribute to `lv_timer_handler` function*/
#define LV_ATTRIBUTE_TIMER_HANDLER #define LV_ATTRIBUTE_TIMER_HANDLER
/*Define a custom attribute to `lv_disp_flush_ready` function*/ /*Define a custom attribute to `lv_display_flush_ready` function*/
#define LV_ATTRIBUTE_FLUSH_READY #define LV_ATTRIBUTE_FLUSH_READY
/*Required alignment size for buffers*/ /*Required alignment size for buffers*/
@@ -721,7 +721,7 @@
#define LV_USE_SDL 0 #define LV_USE_SDL 0
#if LV_USE_SDL #if LV_USE_SDL
#define LV_SDL_INCLUDE_PATH <SDL2/SDL.h> #define LV_SDL_INCLUDE_PATH <SDL2/SDL.h>
#define LV_SDL_RENDER_MODE LV_DISP_RENDER_MODE_DIRECT /*LV_DISP_RENDER_MODE_DIRECT is recommended for best performance*/ #define LV_SDL_RENDER_MODE LV_DISPLAY_RENDER_MODE_DIRECT /*LV_DISPLAY_RENDER_MODE_DIRECT is recommended for best performance*/
#define LV_SDL_BUF_COUNT 1 /*1 or 2*/ #define LV_SDL_BUF_COUNT 1 /*1 or 2*/
#define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/ #define LV_SDL_FULLSCREEN 0 /*1: Make the window full screen by default*/
#define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL widows are closed*/ #define LV_SDL_DIRECT_EXIT 1 /*1: Exit the application when all SDL widows are closed*/
@@ -732,7 +732,7 @@
#if LV_USE_LINUX_FBDEV #if LV_USE_LINUX_FBDEV
#define LV_LINUX_FBDEV_BSD 0 #define LV_LINUX_FBDEV_BSD 0
#define LV_LINUX_FBDEV_NUTTX 0 #define LV_LINUX_FBDEV_NUTTX 0
#define LV_LINUX_FBDEV_RENDER_MODE LV_DISP_RENDER_MODE_PARTIAL #define LV_LINUX_FBDEV_RENDER_MODE LV_DISPLAY_RENDER_MODE_PARTIAL
#define LV_LINUX_FBDEV_BUFFER_COUNT 0 #define LV_LINUX_FBDEV_BUFFER_COUNT 0
#define LV_LINUX_FBDEV_BUFFER_SIZE 60 #define LV_LINUX_FBDEV_BUFFER_SIZE 60
#endif #endif

8
lvgl.h
View File

@@ -40,7 +40,7 @@ extern "C" {
#include "src/core/lv_group.h" #include "src/core/lv_group.h"
#include "src/indev/lv_indev.h" #include "src/indev/lv_indev.h"
#include "src/core/lv_refr.h" #include "src/core/lv_refr.h"
#include "src/disp/lv_disp.h" #include "src/display/lv_display.h"
#include "src/font/lv_font.h" #include "src/font/lv_font.h"
#include "src/font/lv_font_loader.h" #include "src/font/lv_font_loader.h"
@@ -114,9 +114,9 @@ extern "C" {
#include "src/dev/sdl/lv_sdl_mousewheel.h" #include "src/dev/sdl/lv_sdl_mousewheel.h"
#include "src/dev/sdl/lv_sdl_keyboard.h" #include "src/dev/sdl/lv_sdl_keyboard.h"
#include "src/dev/disp/drm/lv_linux_drm.h" #include "src/dev/display/drm/lv_linux_drm.h"
#include "src/dev/disp/fb/lv_linux_fbdev.h" #include "src/dev/display/fb/lv_linux_fbdev.h"
#include "src/dev/disp/lcd/lv_nuttx_lcd.h" #include "src/dev/display/lcd/lv_nuttx_lcd.h"
#include "src/dev/input/touchscreen/lv_nuttx_touchscreen.h" #include "src/dev/input/touchscreen/lv_nuttx_touchscreen.h"

View File

@@ -58,11 +58,11 @@ props = [
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." }, 'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
{'name': 'TRANSFORM_ZOOM', {'name': 'TRANSFORM_SCALE',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1, 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Zoom an objects. The value 256 (or `LV_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on" }, 'dsc': "Zoom an objects. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
{'name': 'TRANSFORM_ANGLE', {'name': 'TRANSFORM_ROTATION',
'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1, 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
'dsc': "Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."}, 'dsc': "Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
@@ -149,23 +149,23 @@ props = [
'style_type': 'num', 'var_type': 'lv_dither_mode_t', 'default':'`LV_DITHER_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_dither_mode_t', 'default':'`LV_DITHER_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the dithering mode of the gradient of the background. The possible values are `LV_DITHER_NONE/ORDERED/ERR_DIFF`."}, 'dsc': "Set the dithering mode of the gradient of the background. The possible values are `LV_DITHER_NONE/ORDERED/ERR_DIFF`."},
{'name': 'BG_IMG_SRC', {'name': 'BG_IMAGE_SRC',
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 1, 'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
'dsc': "Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`"}, 'dsc': "Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`"},
{'name': 'BG_IMG_OPA', {'name': 'BG_IMAGE_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the background image. 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."}, 'dsc': "Set the opacity of the background image. 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': 'BG_IMG_RECOLOR', {'name': 'BG_IMAGE_RECOLOR',
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1, 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set a color to mix to the background image."}, 'dsc': "Set a color to mix to the background image."},
{'name': 'BG_IMG_RECOLOR_OPA', {'name': 'BG_IMAGE_RECOLOR_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_opa_t', 'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally."}, 'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally."},
{'name': 'BG_IMG_TILED', {'name': 'BG_IMAGE_TILED',
'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'bool', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "If enabled the background image will be tiled. The possible values are `true` or `false`."}, 'dsc': "If enabled the background image will be tiled. The possible values are `true` or `false`."},
@@ -233,15 +233,15 @@ props = [
'dsc': "Set the opacity of the shadow. 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."}, 'dsc': "Set the opacity of the shadow. 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."},
{'section': 'Image', 'dsc':'Properties to describe the images' }, {'section': 'Image', 'dsc':'Properties to describe the images' },
{'name': 'IMG_OPA', {'name': 'IMAGE_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of an image. 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."}, 'dsc': "Set the opacity of an image. 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': 'IMG_RECOLOR', {'name': 'IMAGE_RECOLOR',
'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1, 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
'dsc': "Set color to mixt to the image."}, 'dsc': "Set color to mixt to the image."},
{'name': 'IMG_RECOLOR_OPA', {'name': 'IMAGE_RECOLOR_OPA',
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the intensity of the color mixing. 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."}, 'dsc': "Set the intensity of the color mixing. 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."},
@@ -287,7 +287,7 @@ props = [
'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'num', 'var_type': 'lv_opa_t' , 'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set the opacity of the arcs."}, 'dsc': "Set the opacity of the arcs."},
{'name': 'ARC_IMG_SRC', {'name': 'ARC_IMAGE_SRC',
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file"}, 'dsc': "Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file"},

View File

@@ -49,7 +49,7 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
struct _lv_disp_t; struct _lv_display_t;
struct _lv_group_t; struct _lv_group_t;
struct _my_theme_t; struct _my_theme_t;
struct _lv_indev_t; struct _lv_indev_t;
@@ -68,8 +68,8 @@ typedef struct _lv_global_t {
bool inited; bool inited;
lv_ll_t disp_ll; lv_ll_t disp_ll;
struct _lv_disp_t * disp_refresh; struct _lv_display_t * disp_refresh;
struct _lv_disp_t * disp_default; struct _lv_display_t * disp_default;
lv_ll_t style_trans_ll; lv_ll_t style_trans_ll;
bool style_refresh; bool style_refresh;

View File

@@ -246,8 +246,8 @@ void lv_group_focus_obj(lv_obj_t * obj)
_LV_LL_READ(&g->obj_ll, i) { _LV_LL_READ(&g->obj_ll, i) {
if(*i == obj) { if(*i == obj) {
if(g->obj_focus != NULL && obj != *g->obj_focus) { /*Do not defocus if the same object needs to be focused again*/ if(g->obj_focus != NULL && obj != *g->obj_focus) { /*Do not defocus if the same object needs to be focused again*/
lv_res_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g)); lv_result_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g));
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
lv_obj_invalidate(*g->obj_focus); lv_obj_invalidate(*g->obj_focus);
} }
@@ -255,8 +255,8 @@ void lv_group_focus_obj(lv_obj_t * obj)
if(g->obj_focus != NULL) { if(g->obj_focus != NULL) {
if(g->focus_cb) g->focus_cb(g); if(g->focus_cb) g->focus_cb(g);
lv_res_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_FOCUSED, get_indev(g)); lv_result_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_FOCUSED, get_indev(g));
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
lv_obj_invalidate(*g->obj_focus); lv_obj_invalidate(*g->obj_focus);
} }
break; break;
@@ -288,12 +288,12 @@ void lv_group_focus_freeze(lv_group_t * group, bool en)
else group->frozen = 1; else group->frozen = 1;
} }
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c) lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c)
{ {
lv_obj_t * act = lv_group_get_focused(group); lv_obj_t * act = lv_group_get_focused(group);
if(act == NULL) return LV_RES_OK; if(act == NULL) return LV_RESULT_OK;
if(lv_obj_has_state(act, LV_STATE_DISABLED)) return LV_RES_OK; if(lv_obj_has_state(act, LV_STATE_DISABLED)) return LV_RESULT_OK;
return lv_obj_send_event(act, LV_EVENT_KEY, &c); return lv_obj_send_event(act, LV_EVENT_KEY, &c);
} }
@@ -319,8 +319,8 @@ void lv_group_set_editing(lv_group_t * group, bool edit)
lv_obj_t * focused = lv_group_get_focused(group); lv_obj_t * focused = lv_group_get_focused(group);
if(focused) { if(focused) {
lv_res_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group)); lv_result_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
lv_obj_invalidate(focused); lv_obj_invalidate(focused);
} }
@@ -449,15 +449,15 @@ static bool focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *)
if(obj_next == group->obj_focus) return focus_changed; /*There's only one visible object and it's already focused*/ if(obj_next == group->obj_focus) return focus_changed; /*There's only one visible object and it's already focused*/
if(group->obj_focus) { if(group->obj_focus) {
lv_res_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group)); lv_result_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_DEFOCUSED, get_indev(group));
if(res != LV_RES_OK) return focus_changed; if(res != LV_RESULT_OK) return focus_changed;
lv_obj_invalidate(*group->obj_focus); lv_obj_invalidate(*group->obj_focus);
} }
group->obj_focus = obj_next; group->obj_focus = obj_next;
lv_res_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group)); lv_result_t res = lv_obj_send_event(*group->obj_focus, LV_EVENT_FOCUSED, get_indev(group));
if(res != LV_RES_OK) return focus_changed; if(res != LV_RESULT_OK) return focus_changed;
lv_obj_invalidate(*group->obj_focus); lv_obj_invalidate(*group->obj_focus);

View File

@@ -178,7 +178,7 @@ void lv_group_focus_freeze(lv_group_t * group, bool en);
* @param c a character (use LV_KEY_.. to navigate) * @param c a character (use LV_KEY_.. to navigate)
* @return result of focused object in group. * @return result of focused object in group.
*/ */
lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c); lv_result_t lv_group_send_data(lv_group_t * group, uint32_t c);
/** /**
* Set a function for a group which will be called when a new object is focused * Set a function for a group which will be called when a new object is focused

View File

@@ -11,8 +11,8 @@
#include "../indev/lv_indev_private.h" #include "../indev/lv_indev_private.h"
#include "lv_refr.h" #include "lv_refr.h"
#include "lv_group.h" #include "lv_group.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../themes/lv_theme.h" #include "../themes/lv_theme.h"
#include "../misc/lv_assert.h" #include "../misc/lv_assert.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
@@ -42,7 +42,7 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
static void lv_obj_draw(lv_event_t * e); static void lv_obj_draw(lv_event_t * e);
static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e); static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e);
static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer); static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer);
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc); static lv_result_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc);
static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find); static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_find);
static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state); static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state);
@@ -259,7 +259,7 @@ const lv_obj_class_t * lv_obj_get_class(const lv_obj_t * obj)
bool lv_obj_is_valid(const lv_obj_t * obj) bool lv_obj_is_valid(const lv_obj_t * obj)
{ {
lv_disp_t * disp = lv_disp_get_next(NULL); lv_display_t * disp = lv_display_get_next(NULL);
while(disp) { while(disp) {
uint32_t i; uint32_t i;
for(i = 0; i < disp->screen_cnt; i++) { for(i = 0; i < disp->screen_cnt; i++) {
@@ -268,7 +268,7 @@ bool lv_obj_is_valid(const lv_obj_t * obj)
if(found) return true; if(found) return true;
} }
disp = lv_disp_get_next(disp); disp = lv_display_get_next(disp);
} }
return false; return false;
@@ -435,8 +435,8 @@ static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer)
if(lv_area_get_size(&hor_area) <= 0 && lv_area_get_size(&ver_area) <= 0) return; if(lv_area_get_size(&hor_area) <= 0 && lv_area_get_size(&ver_area) <= 0) return;
lv_draw_rect_dsc_t draw_dsc; lv_draw_rect_dsc_t draw_dsc;
lv_res_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc); lv_result_t sb_res = scrollbar_init_draw_dsc(obj, &draw_dsc);
if(sb_res != LV_RES_OK) return; if(sb_res != LV_RESULT_OK) return;
if(lv_area_get_size(&hor_area) > 0) { if(lv_area_get_size(&hor_area) > 0) {
draw_dsc.base.id1 = 0; draw_dsc.base.id1 = 0;
@@ -452,9 +452,9 @@ static void draw_scrollbar(lv_obj_t * obj, lv_layer_t * layer)
* Initialize the draw descriptor for the scrollbar * Initialize the draw descriptor for the scrollbar
* @param obj pointer to an object * @param obj pointer to an object
* @param dsc the draw descriptor to initialize * @param dsc the draw descriptor to initialize
* @return LV_RES_OK: the scrollbar is visible; LV_RES_INV: the scrollbar is not visible * @return LV_RESULT_OK: the scrollbar is visible; LV_RESULT_INVALID: the scrollbar is not visible
*/ */
static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc) static lv_result_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc)
{ {
lv_draw_rect_dsc_init(dsc); lv_draw_rect_dsc_init(dsc);
dsc->bg_opa = lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR); dsc->bg_opa = lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR);
@@ -495,10 +495,10 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP || dsc->shadow_opa != LV_OPA_TRANSP) { if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP || dsc->shadow_opa != LV_OPA_TRANSP) {
dsc->radius = lv_obj_get_style_radius(obj, LV_PART_SCROLLBAR); dsc->radius = lv_obj_get_style_radius(obj, LV_PART_SCROLLBAR);
return LV_RES_OK; return LV_RESULT_OK;
} }
else { else {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
} }
@@ -519,8 +519,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
if(!(lv_obj_get_state(obj) & LV_STATE_CHECKED)) lv_obj_add_state(obj, LV_STATE_CHECKED); 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); else lv_obj_clear_state(obj, LV_STATE_CHECKED);
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL); lv_result_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
} }
} }
else if(code == LV_EVENT_PRESS_LOST) { else if(code == LV_EVENT_PRESS_LOST) {
@@ -545,8 +545,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
/*With Enter LV_EVENT_RELEASED will send VALUE_CHANGE event*/ /*With Enter LV_EVENT_RELEASED will send VALUE_CHANGE event*/
if(c != LV_KEY_ENTER) { if(c != LV_KEY_ENTER) {
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL); lv_result_t res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
} }
} }
else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_WITH_ARROW) && !lv_obj_is_editable(obj)) { else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_WITH_ARROW) && !lv_obj_is_editable(obj)) {

View File

@@ -8,8 +8,8 @@
*********************/ *********************/
#include "lv_obj.h" #include "lv_obj.h"
#include "../themes/lv_theme.h" #include "../themes/lv_theme.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
/********************* /*********************
@@ -56,7 +56,7 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
/*Create a screen*/ /*Create a screen*/
if(parent == NULL) { if(parent == NULL) {
LV_TRACE_OBJ_CREATE("creating a screen"); LV_TRACE_OBJ_CREATE("creating a screen");
lv_disp_t * disp = lv_disp_get_default(); lv_display_t * disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("No display created yet. No place to assign the new screen"); LV_LOG_WARN("No display created yet. No place to assign the new screen");
lv_free(obj); lv_free(obj);
@@ -74,8 +74,8 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
/*Set coordinates to full screen size*/ /*Set coordinates to full screen size*/
obj->coords.x1 = 0; obj->coords.x1 = 0;
obj->coords.y1 = 0; obj->coords.y1 = 0;
obj->coords.x2 = lv_disp_get_hor_res(NULL) - 1; obj->coords.x2 = lv_display_get_horizontal_resolution(NULL) - 1;
obj->coords.y2 = lv_disp_get_ver_res(NULL) - 1; obj->coords.y2 = lv_display_get_vertical_resolution(NULL) - 1;
} }
/*Create a normal object*/ /*Create a normal object*/
else { else {

View File

@@ -8,7 +8,7 @@
*********************/ *********************/
#include "lv_obj_draw.h" #include "lv_obj_draw.h"
#include "lv_obj.h" #include "lv_obj.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../indev/lv_indev.h" #include "../indev/lv_indev.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
@@ -186,8 +186,8 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc
} }
if(draw_dsc->opa <= LV_OPA_MIN) return; if(draw_dsc->opa <= LV_OPA_MIN) return;
draw_dsc->angle = 0; draw_dsc->rotation = 0;
draw_dsc->zoom = LV_ZOOM_NONE; draw_dsc->zoom = LV_SCALE_NONE;
draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2; draw_dsc->pivot.x = lv_area_get_width(&obj->coords) / 2;
draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2; draw_dsc->pivot.y = lv_area_get_height(&obj->coords) / 2;

View File

@@ -22,7 +22,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t event_send_core(lv_event_t * e); static lv_result_t event_send_core(lv_event_t * e);
static bool event_is_bubbled(lv_event_t * e); static bool event_is_bubbled(lv_event_t * e);
/********************** /**********************
@@ -42,9 +42,9 @@ static bool event_is_bubbled(lv_event_t * e);
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param) lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * param)
{ {
if(obj == NULL) return LV_RES_OK; if(obj == NULL) return LV_RESULT_OK;
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -61,7 +61,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
_lv_event_push(&e); _lv_event_push(&e);
/*Send the event*/ /*Send the event*/
lv_res_t res = event_send_core(&e); lv_result_t res = event_send_core(&e);
/*Remove this element from the list*/ /*Remove this element from the list*/
_lv_event_pop(&e); _lv_event_pop(&e);
@@ -70,7 +70,7 @@ lv_res_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * pa
} }
lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e) lv_result_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
{ {
const lv_obj_class_t * base; const lv_obj_class_t * base;
if(class_p == NULL) base = ((lv_obj_t *)e->current_target)->class_p; if(class_p == NULL) base = ((lv_obj_t *)e->current_target)->class_p;
@@ -79,16 +79,16 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e)
/*Find a base in which call the ancestor's event handler_cb if set*/ /*Find a base in which call the ancestor's event handler_cb if set*/
while(base && base->event_cb == NULL) base = base->base_class; while(base && base->event_cb == NULL) base = base->base_class;
if(base == NULL) return LV_RES_OK; if(base == NULL) return LV_RESULT_OK;
if(base->event_cb == NULL) return LV_RES_OK; if(base->event_cb == NULL) return LV_RESULT_OK;
/*Call the actual event callback*/ /*Call the actual event callback*/
e->user_data = NULL; e->user_data = NULL;
base->event_cb(base, e); base->event_cb(base, e);
lv_res_t res = LV_RES_OK; lv_result_t res = LV_RESULT_OK;
/*Stop if the object is deleted*/ /*Stop if the object is deleted*/
if(e->deleted) res = LV_RES_INV; if(e->deleted) res = LV_RESULT_INVALID;
return res; return res;
} }
@@ -285,7 +285,7 @@ lv_draw_task_t * lv_event_get_draw_task(lv_event_t * e)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static lv_res_t event_send_core(lv_event_t * e) static lv_result_t event_send_core(lv_event_t * e)
{ {
EVENT_TRACE("Sending event %d to %p with %p param", e->code, (void *)e->original_target, e->param); EVENT_TRACE("Sending event %d to %p with %p param", e->code, (void *)e->original_target, e->param);
@@ -293,28 +293,28 @@ static lv_res_t event_send_core(lv_event_t * e)
lv_indev_t * indev_act = lv_indev_get_act(); lv_indev_t * indev_act = lv_indev_get_act();
if(indev_act) { if(indev_act) {
if(indev_act->feedback_cb) indev_act->feedback_cb(indev_act, e); if(indev_act->feedback_cb) indev_act->feedback_cb(indev_act, e);
if(e->stop_processing) return LV_RES_OK; if(e->stop_processing) return LV_RESULT_OK;
if(e->deleted) return LV_RES_INV; if(e->deleted) return LV_RESULT_INVALID;
} }
lv_obj_t * target = e->current_target; lv_obj_t * target = e->current_target;
lv_res_t res = LV_RES_OK; lv_result_t res = LV_RESULT_OK;
lv_event_list_t * list = target->spec_attr ? &target->spec_attr->event_list : NULL; lv_event_list_t * list = target->spec_attr ? &target->spec_attr->event_list : NULL;
res = lv_event_send(list, e, true); res = lv_event_send(list, e, true);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
res = lv_obj_event_base(NULL, e); res = lv_obj_event_base(NULL, e);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
res = lv_event_send(list, e, false); res = lv_event_send(list, e, false);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
lv_obj_t * parent = lv_obj_get_parent(e->current_target); lv_obj_t * parent = lv_obj_get_parent(e->current_target);
if(parent && event_is_bubbled(e)) { if(parent && event_is_bubbled(e)) {
e->current_target = parent; e->current_target = parent;
res = event_send_core(e); res = event_send_core(e);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
} }
return res; return res;

View File

@@ -67,17 +67,17 @@ typedef struct {
* @param obj pointer to an object * @param obj pointer to an object
* @param event_code the type of the event from `lv_event_t` * @param event_code the type of the event from `lv_event_t`
* @param param arbitrary data depending on the widget type and the event. (Usually `NULL`) * @param param arbitrary data depending on the widget type and the event. (Usually `NULL`)
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event_code * @return LV_RESULT_OK: `obj` was not deleted in the event; LV_RESULT_INVALID: `obj` was deleted in the event_code
*/ */
lv_res_t lv_obj_send_event(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param); lv_result_t lv_obj_send_event(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param);
/** /**
* Used by the widgets internally to call the ancestor widget types's event handler * Used by the widgets internally to call the ancestor widget types's event handler
* @param class_p pointer to the class of the widget (NOT the ancestor class) * @param class_p pointer to the class of the widget (NOT the ancestor class)
* @param e pointer to the event descriptor * @param e pointer to the event descriptor
* @return LV_RES_OK: the target object was not deleted in the event; LV_RES_INV: it was deleted in the event_code * @return LV_RESULT_OK: the target object was not deleted in the event; LV_RESULT_INVALID: it was deleted in the event_code
*/ */
lv_res_t lv_obj_event_base(const struct _lv_obj_class_t * class_p, lv_event_t * e); lv_result_t lv_obj_event_base(const struct _lv_obj_class_t * class_p, lv_event_t * e);
/** /**
* Get the current target of the event. It's the object which event handler being called. * Get the current target of the event. It's the object which event handler being called.

View File

@@ -7,8 +7,8 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_obj.h" #include "lv_obj.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "lv_refr.h" #include "lv_refr.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
@@ -54,12 +54,12 @@ void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_x; lv_result_t res_x;
lv_style_value_t v_x; lv_style_value_t v_x;
res_x = lv_obj_get_local_style_prop(obj, LV_STYLE_X, &v_x, 0); res_x = lv_obj_get_local_style_prop(obj, LV_STYLE_X, &v_x, 0);
if((res_x == LV_RES_OK && v_x.num != x) || res_x == LV_RES_INV) { if((res_x == LV_RESULT_OK && v_x.num != x) || res_x == LV_RESULT_INVALID) {
lv_obj_set_style_x(obj, x, 0); lv_obj_set_style_x(obj, x, 0);
} }
} }
@@ -68,12 +68,12 @@ void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_y; lv_result_t res_y;
lv_style_value_t v_y; lv_style_value_t v_y;
res_y = lv_obj_get_local_style_prop(obj, LV_STYLE_Y, &v_y, 0); res_y = lv_obj_get_local_style_prop(obj, LV_STYLE_Y, &v_y, 0);
if((res_y == LV_RES_OK && v_y.num != y) || res_y == LV_RES_INV) { if((res_y == LV_RESULT_OK && v_y.num != y) || res_y == LV_RESULT_INVALID) {
lv_obj_set_style_y(obj, y, 0); lv_obj_set_style_y(obj, y, 0);
} }
} }
@@ -215,12 +215,12 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w) void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_w; lv_result_t res_w;
lv_style_value_t v_w; lv_style_value_t v_w;
res_w = lv_obj_get_local_style_prop(obj, LV_STYLE_WIDTH, &v_w, 0); res_w = lv_obj_get_local_style_prop(obj, LV_STYLE_WIDTH, &v_w, 0);
if((res_w == LV_RES_OK && v_w.num != w) || res_w == LV_RES_INV) { if((res_w == LV_RESULT_OK && v_w.num != w) || res_w == LV_RESULT_INVALID) {
lv_obj_set_style_width(obj, w, 0); lv_obj_set_style_width(obj, w, 0);
} }
} }
@@ -228,12 +228,12 @@ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w)
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h) void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
lv_res_t res_h; lv_result_t res_h;
lv_style_value_t v_h; lv_style_value_t v_h;
res_h = lv_obj_get_local_style_prop(obj, LV_STYLE_HEIGHT, &v_h, 0); res_h = lv_obj_get_local_style_prop(obj, LV_STYLE_HEIGHT, &v_h, 0);
if((res_h == LV_RES_OK && v_h.num != h) || res_h == LV_RES_INV) { if((res_h == LV_RESULT_OK && v_h.num != h) || res_h == LV_RESULT_INVALID) {
lv_obj_set_style_height(obj, h, 0); lv_obj_set_style_height(obj, h, 0);
} }
} }
@@ -282,8 +282,8 @@ void lv_obj_mark_layout_as_dirty(lv_obj_t * obj)
scr->scr_layout_inv = 1; scr->scr_layout_inv = 1;
/*Make the display refreshing*/ /*Make the display refreshing*/
lv_disp_t * disp = lv_obj_get_disp(scr); lv_display_t * disp = lv_obj_get_disp(scr);
lv_disp_send_event(disp, LV_EVENT_REFR_REQUEST, NULL); lv_display_send_event(disp, LV_EVENT_REFR_REQUEST, NULL);
} }
void lv_obj_update_layout(const lv_obj_t * obj) void lv_obj_update_layout(const lv_obj_t * obj)
@@ -802,8 +802,8 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
lv_disp_t * disp = lv_obj_get_disp(obj); lv_display_t * disp = lv_obj_get_disp(obj);
if(!lv_disp_is_invalidation_enabled(disp)) return; if(!lv_display_is_invalidation_enabled(disp)) return;
lv_area_t area_tmp; lv_area_t area_tmp;
lv_area_copy(&area_tmp, area); lv_area_copy(&area_tmp, area);
@@ -834,12 +834,12 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
/*Invalidate the object only if it belongs to the current or previous or one of the layers'*/ /*Invalidate the object only if it belongs to the current or previous or one of the layers'*/
lv_obj_t * obj_scr = lv_obj_get_screen(obj); lv_obj_t * obj_scr = lv_obj_get_screen(obj);
lv_disp_t * disp = lv_obj_get_disp(obj_scr); lv_display_t * disp = lv_obj_get_disp(obj_scr);
if(obj_scr != lv_disp_get_scr_act(disp) && if(obj_scr != lv_display_get_scr_act(disp) &&
obj_scr != lv_disp_get_scr_prev(disp) && obj_scr != lv_display_get_scr_prev(disp) &&
obj_scr != lv_disp_get_layer_bottom(disp) && obj_scr != lv_display_get_layer_bottom(disp) &&
obj_scr != lv_disp_get_layer_top(disp) && obj_scr != lv_display_get_layer_top(disp) &&
obj_scr != lv_disp_get_layer_sys(disp)) { obj_scr != lv_display_get_layer_sys(disp)) {
return false; return false;
} }
@@ -1118,10 +1118,10 @@ static void layout_update_core(lv_obj_t * obj)
static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv) static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
{ {
lv_coord_t angle = lv_obj_get_style_transform_angle(obj, 0); lv_coord_t angle = lv_obj_get_style_transform_rotation(obj, 0);
lv_coord_t zoom = lv_obj_get_style_transform_zoom_safe(obj, 0); lv_coord_t zoom = lv_obj_get_style_transform_scale_safe(obj, 0);
if(angle == 0 && zoom == LV_ZOOM_NONE) return; if(angle == 0 && zoom == LV_SCALE_NONE) return;
lv_point_t pivot = { lv_point_t pivot = {
.x = lv_obj_get_style_transform_pivot_x(obj, 0), .x = lv_obj_get_style_transform_pivot_x(obj, 0),

View File

@@ -10,7 +10,7 @@
#include "lv_obj.h" #include "lv_obj.h"
#include "../indev/lv_indev.h" #include "../indev/lv_indev.h"
#include "../indev/lv_indev_scroll.h" #include "../indev/lv_indev_scroll.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -306,14 +306,14 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
{ {
if(dx == 0 && dy == 0) return; if(dx == 0 && dy == 0) return;
if(anim_en == LV_ANIM_ON) { if(anim_en == LV_ANIM_ON) {
lv_disp_t * d = lv_obj_get_disp(obj); lv_display_t * d = lv_obj_get_disp(obj);
lv_anim_t a; lv_anim_t a;
lv_anim_init(&a); lv_anim_init(&a);
lv_anim_set_var(&a, obj); lv_anim_set_var(&a, obj);
lv_anim_set_ready_cb(&a, scroll_anim_ready_cb); lv_anim_set_ready_cb(&a, scroll_anim_ready_cb);
if(dx) { if(dx) {
uint32_t t = lv_anim_speed_to_time((lv_disp_get_hor_res(d) * 2) >> 2, 0, dx); uint32_t t = lv_anim_speed_to_time((lv_display_get_horizontal_resolution(d) * 2) >> 2, 0, dx);
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN; if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX; if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
lv_anim_set_time(&a, t); lv_anim_set_time(&a, t);
@@ -322,14 +322,14 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
lv_anim_set_exec_cb(&a, scroll_x_anim); lv_anim_set_exec_cb(&a, scroll_x_anim);
lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
lv_res_t res; lv_result_t res;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, &a); res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, &a);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
lv_anim_start(&a); lv_anim_start(&a);
} }
if(dy) { if(dy) {
uint32_t t = lv_anim_speed_to_time((lv_disp_get_ver_res(d) * 2) >> 2, 0, dy); uint32_t t = lv_anim_speed_to_time((lv_display_get_vertical_resolution(d) * 2) >> 2, 0, dy);
if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN; if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN;
if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX; if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX;
lv_anim_set_time(&a, t); lv_anim_set_time(&a, t);
@@ -338,9 +338,9 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
lv_anim_set_exec_cb(&a, scroll_y_anim); lv_anim_set_exec_cb(&a, scroll_y_anim);
lv_anim_set_path_cb(&a, lv_anim_path_ease_out); lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
lv_res_t res; lv_result_t res;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, &a); res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, &a);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
lv_anim_start(&a); lv_anim_start(&a);
} }
} }
@@ -349,15 +349,15 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab
lv_anim_del(obj, scroll_y_anim); lv_anim_del(obj, scroll_y_anim);
lv_anim_del(obj, scroll_x_anim); lv_anim_del(obj, scroll_x_anim);
lv_res_t res; lv_result_t res;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, NULL); res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, NULL);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
res = _lv_obj_scroll_by_raw(obj, dx, dy); res = _lv_obj_scroll_by_raw(obj, dx, dy);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
res = lv_obj_send_event(obj, LV_EVENT_SCROLL_END, NULL); res = lv_obj_send_event(obj, LV_EVENT_SCROLL_END, NULL);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
} }
} }
@@ -411,9 +411,9 @@ void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en)
} }
} }
lv_res_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
{ {
if(x == 0 && y == 0) return LV_RES_OK; if(x == 0 && y == 0) return LV_RESULT_OK;
lv_obj_allocate_spec_attr(obj); lv_obj_allocate_spec_attr(obj);
@@ -421,10 +421,10 @@ lv_res_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
obj->spec_attr->scroll.y += y; obj->spec_attr->scroll.y += y;
lv_obj_move_children_by(obj, x, y, true); lv_obj_move_children_by(obj, x, y, true);
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_SCROLL, NULL); lv_result_t res = lv_obj_send_event(obj, LV_EVENT_SCROLL, NULL);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
lv_obj_invalidate(obj); lv_obj_invalidate(obj);
return LV_RES_OK; return LV_RESULT_OK;
} }
@@ -785,9 +785,9 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
bool y_del = lv_anim_del(parent, scroll_y_anim); bool y_del = lv_anim_del(parent, scroll_y_anim);
bool x_del = lv_anim_del(parent, scroll_x_anim); bool x_del = lv_anim_del(parent, scroll_x_anim);
if(y_del || x_del) { if(y_del || x_del) {
lv_res_t res; lv_result_t res;
res = lv_obj_send_event(parent, LV_EVENT_SCROLL_END, NULL); res = lv_obj_send_event(parent, LV_EVENT_SCROLL_END, NULL);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
} }
if((scroll_dir & LV_DIR_LEFT) == 0 && x_scroll < 0) x_scroll = 0; if((scroll_dir & LV_DIR_LEFT) == 0 && x_scroll < 0) x_scroll = 0;

View File

@@ -265,10 +265,10 @@ void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t an
* @param obj pointer to an object to scroll * @param obj pointer to an object to scroll
* @param x pixels to scroll horizontally * @param x pixels to scroll horizontally
* @param y pixels to scroll vertically * @param y pixels to scroll vertically
* @return `LV_RES_INV`: to object was deleted in `LV_EVENT_SCROLL`; * @return `LV_RESULT_INVALID`: to object was deleted in `LV_EVENT_SCROLL`;
* `LV_RES_OK`: if the object is still valid * `LV_RESULT_OK`: if the object is still valid
*/ */
lv_res_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y); lv_result_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
/** /**
* Tell whether an object is being scrolled or not at this moment * Tell whether an object is being scrolled or not at this moment

View File

@@ -7,8 +7,8 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_obj.h" #include "lv_obj.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../misc/lv_color.h" #include "../misc/lv_color.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
@@ -246,14 +246,14 @@ void lv_obj_remove_style_all(struct _lv_obj_t * obj)
void lv_obj_report_style_change(lv_style_t * style) void lv_obj_report_style_change(lv_style_t * style)
{ {
if(!style_refr) return; if(!style_refr) return;
lv_disp_t * d = lv_disp_get_next(NULL); lv_display_t * d = lv_display_get_next(NULL);
while(d) { while(d) {
uint32_t i; uint32_t i;
for(i = 0; i < d->screen_cnt; i++) { for(i = 0; i < d->screen_cnt; i++) {
report_style_change_core(style, d->screens[i]); report_style_change_core(style, d->screens[i]);
} }
d = lv_disp_get_next(d); d = lv_display_get_next(d);
} }
} }
@@ -319,9 +319,9 @@ static inline lv_style_value_t lv_style_prop_get_default_inlined(lv_style_prop_t
const lv_color_t black = LV_COLOR_MAKE(0x00, 0x00, 0x00); const lv_color_t black = LV_COLOR_MAKE(0x00, 0x00, 0x00);
const lv_color_t white = LV_COLOR_MAKE(0xff, 0xff, 0xff); const lv_color_t white = LV_COLOR_MAKE(0xff, 0xff, 0xff);
switch(prop) { switch(prop) {
case LV_STYLE_TRANSFORM_ZOOM: case LV_STYLE_TRANSFORM_SCALE:
return (lv_style_value_t) { return (lv_style_value_t) {
.num = LV_ZOOM_NONE .num = LV_SCALE_NONE
}; };
case LV_STYLE_BG_COLOR: case LV_STYLE_BG_COLOR:
return (lv_style_value_t) { return (lv_style_value_t) {
@@ -497,8 +497,8 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty
/*The style is not found*/ /*The style is not found*/
if(i == obj->style_cnt) return false; if(i == obj->style_cnt) return false;
lv_res_t res = lv_style_remove_prop((lv_style_t *)obj->styles[i].style, prop); lv_result_t res = lv_style_remove_prop((lv_style_t *)obj->styles[i].style, prop);
if(res == LV_RES_OK) { if(res == LV_RESULT_OK) {
full_cache_refresh(obj, lv_obj_style_get_selector_part(selector)); full_cache_refresh(obj, lv_obj_style_get_selector_part(selector));
lv_obj_refresh_style(obj, selector, prop); lv_obj_refresh_style(obj, selector, prop);
} }
@@ -606,8 +606,8 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
else if(lv_style_get_prop(style, LV_STYLE_MIN_HEIGHT, &v)) layout_diff = true; else if(lv_style_get_prop(style, LV_STYLE_MIN_HEIGHT, &v)) layout_diff = true;
else if(lv_style_get_prop(style, LV_STYLE_MAX_HEIGHT, &v)) layout_diff = true; else if(lv_style_get_prop(style, LV_STYLE_MAX_HEIGHT, &v)) layout_diff = true;
else if(lv_style_get_prop(style, LV_STYLE_BORDER_WIDTH, &v)) layout_diff = true; else if(lv_style_get_prop(style, LV_STYLE_BORDER_WIDTH, &v)) layout_diff = true;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ANGLE, &v)) layout_diff = true; else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ROTATION, &v)) layout_diff = true;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ZOOM, &v)) layout_diff = true; else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE, &v)) layout_diff = true;
if(layout_diff) { if(layout_diff) {
return _LV_STYLE_STATE_CMP_DIFF_LAYOUT; return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
@@ -616,8 +616,8 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
/*Check for draw pad changes*/ /*Check for draw pad changes*/
if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ANGLE, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ROTATION, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ZOOM, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
@@ -1041,8 +1041,8 @@ static void trans_anim_ready_cb(lv_anim_t * a)
static lv_layer_type_t calculate_layer_type(lv_obj_t * obj) 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_rotation(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_transform_scale(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
if(lv_obj_get_style_opa_layered(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_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE; if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
return LV_LAYER_TYPE_NONE; return LV_LAYER_TYPE_NONE;

View File

@@ -313,9 +313,9 @@ static inline lv_coord_t lv_obj_get_style_space_bottom(const struct _lv_obj_t *
lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt); 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) static inline lv_coord_t lv_obj_get_style_transform_scale_safe(const struct _lv_obj_t * obj, uint32_t part)
{ {
int16_t zoom = lv_obj_get_style_transform_zoom(obj, part); int16_t zoom = lv_obj_get_style_transform_scale(obj, part);
return zoom != 0 ? zoom : 1; return zoom != 0 ? zoom : 1;
} }

View File

@@ -114,20 +114,20 @@ void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_s
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_Y, v, selector); lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_Y, v, selector);
} }
void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) void lv_obj_set_style_transform_scale(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
{ {
lv_style_value_t v = { lv_style_value_t v = {
.num = (int32_t)value .num = (int32_t)value
}; };
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ZOOM, v, selector); lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_SCALE, v, selector);
} }
void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
{ {
lv_style_value_t v = { lv_style_value_t v = {
.num = (int32_t)value .num = (int32_t)value
}; };
lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ANGLE, v, selector); lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ROTATION, v, selector);
} }
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)

View File

@@ -92,15 +92,15 @@ static inline lv_coord_t lv_obj_get_style_translate_y(const struct _lv_obj_t * o
return (lv_coord_t)v.num; return (lv_coord_t)v.num;
} }
static inline lv_coord_t lv_obj_get_style_transform_zoom(const struct _lv_obj_t * obj, uint32_t part) static inline lv_coord_t lv_obj_get_style_transform_scale(const struct _lv_obj_t * obj, uint32_t part)
{ {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ZOOM); lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE);
return (lv_coord_t)v.num; return (lv_coord_t)v.num;
} }
static inline lv_coord_t lv_obj_get_style_transform_angle(const struct _lv_obj_t * obj, uint32_t part) static inline lv_coord_t lv_obj_get_style_transform_rotation(const struct _lv_obj_t * obj, uint32_t part)
{ {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ANGLE); lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ROTATION);
return (lv_coord_t)v.num; return (lv_coord_t)v.num;
} }
@@ -718,8 +718,8 @@ void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, lv_coord_t value,
void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_zoom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_transform_scale(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_angle(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
@@ -785,8 +785,6 @@ void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool 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(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_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_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, 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_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_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);

View File

@@ -11,8 +11,8 @@
#include "lv_obj.h" #include "lv_obj.h"
#include "../indev/lv_indev.h" #include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h" #include "../indev/lv_indev_private.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../misc/lv_anim.h" #include "../misc/lv_anim.h"
#include "../misc/lv_async.h" #include "../misc/lv_async.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
@@ -60,7 +60,7 @@ void lv_obj_del(lv_obj_t * obj)
lv_obj_scrollbar_invalidate(par); lv_obj_scrollbar_invalidate(par);
} }
lv_disp_t * disp = NULL; lv_display_t * disp = NULL;
bool act_scr_del = false; bool act_scr_del = false;
if(par == NULL) { if(par == NULL) {
disp = lv_obj_get_disp(obj); disp = lv_obj_get_disp(obj);
@@ -282,7 +282,7 @@ lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj)
return (lv_obj_t *)act_par; return (lv_obj_t *)act_par;
} }
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj) lv_display_t * lv_obj_get_disp(const lv_obj_t * obj)
{ {
LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_OBJ(obj, MY_CLASS);
@@ -291,7 +291,7 @@ lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj)
if(obj->parent == NULL) scr = obj; /*`obj` is a screen*/ if(obj->parent == NULL) scr = obj; /*`obj` is a screen*/
else scr = lv_obj_get_screen(obj); /*get the screen of `obj`*/ else scr = lv_obj_get_screen(obj); /*get the screen of `obj`*/
lv_disp_t * d; lv_display_t * d;
lv_ll_t * disp_head = disp_ll_p; lv_ll_t * disp_head = disp_ll_p;
_LV_LL_READ(disp_head, d) { _LV_LL_READ(disp_head, d) {
uint32_t i; uint32_t i;
@@ -378,8 +378,8 @@ static void obj_del_core(lv_obj_t * obj)
obj->is_deleting = true; obj->is_deleting = true;
/*Let the user free the resources used in `LV_EVENT_DELETE`*/ /*Let the user free the resources used in `LV_EVENT_DELETE`*/
lv_res_t res = lv_obj_send_event(obj, LV_EVENT_DELETE, NULL); lv_result_t res = lv_obj_send_event(obj, LV_EVENT_DELETE, NULL);
if(res == LV_RES_INV) { if(res == LV_RESULT_INVALID) {
obj->is_deleting = false; obj->is_deleting = false;
return; return;
} }
@@ -416,8 +416,8 @@ static void obj_del_core(lv_obj_t * obj)
} }
/*Delete all pending async del-s*/ /*Delete all pending async del-s*/
lv_res_t async_cancel_res = LV_RES_OK; lv_result_t async_cancel_res = LV_RESULT_OK;
while(async_cancel_res == LV_RES_OK) { while(async_cancel_res == LV_RESULT_OK) {
async_cancel_res = lv_async_call_cancel(lv_obj_del_async_cb, obj); async_cancel_res = lv_async_call_cancel(lv_obj_del_async_cb, obj);
} }
@@ -426,7 +426,7 @@ static void obj_del_core(lv_obj_t * obj)
/*Remove the screen for the screen list*/ /*Remove the screen for the screen list*/
if(obj->parent == NULL) { if(obj->parent == NULL) {
lv_disp_t * disp = lv_obj_get_disp(obj); lv_display_t * disp = lv_obj_get_disp(obj);
uint32_t i; uint32_t i;
/*Find the screen in the list*/ /*Find the screen in the list*/
for(i = 0; i < disp->screen_cnt; i++) { for(i = 0; i < disp->screen_cnt; i++) {
@@ -462,13 +462,13 @@ static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb
lv_obj_tree_walk_res_t res = LV_OBJ_TREE_WALK_NEXT; lv_obj_tree_walk_res_t res = LV_OBJ_TREE_WALK_NEXT;
if(obj == NULL) { if(obj == NULL) {
lv_disp_t * disp = lv_disp_get_next(NULL); lv_display_t * disp = lv_display_get_next(NULL);
while(disp) { while(disp) {
uint32_t i; uint32_t i;
for(i = 0; i < disp->screen_cnt; i++) { for(i = 0; i < disp->screen_cnt; i++) {
walk_core(disp->screens[i], cb, user_data); walk_core(disp->screens[i], cb, user_data);
} }
disp = lv_disp_get_next(disp); disp = lv_display_get_next(disp);
} }
return LV_OBJ_TREE_WALK_END; /*The value doesn't matter as it wasn't called recursively*/ return LV_OBJ_TREE_WALK_END; /*The value doesn't matter as it wasn't called recursively*/
} }

View File

@@ -16,7 +16,7 @@ extern "C" {
#include <stddef.h> #include <stddef.h>
#include <stdbool.h> #include <stdbool.h>
#include "../misc/lv_anim.h" #include "../misc/lv_anim.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -28,7 +28,7 @@ extern "C" {
**********************/ **********************/
struct _lv_obj_t; struct _lv_obj_t;
struct _lv_disp_t; struct _lv_display_t;
struct _lv_obj_class_t; struct _lv_obj_class_t;
typedef enum { typedef enum {
@@ -118,7 +118,7 @@ struct _lv_obj_t * lv_obj_get_screen(const struct _lv_obj_t * obj);
* @param obj pointer to an object * @param obj pointer to an object
* @return pointer to the object's display * @return pointer to the object's display
*/ */
struct _lv_disp_t * lv_obj_get_disp(const struct _lv_obj_t * obj); struct _lv_display_t * lv_obj_get_disp(const struct _lv_obj_t * obj);
/** /**
* Get the parent of an object * Get the parent of an object

View File

@@ -8,8 +8,8 @@
*********************/ *********************/
#include <stddef.h> #include <stddef.h>
#include "lv_refr.h" #include "lv_refr.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../tick/lv_tick.h" #include "../tick/lv_tick.h"
#include "../misc/lv_timer.h" #include "../misc/lv_timer.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
@@ -40,9 +40,9 @@ static void refr_area_part(lv_layer_t * layer);
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj); static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj);
static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj); static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj);
static void refr_obj(lv_layer_t * layer, lv_obj_t * obj); static void refr_obj(lv_layer_t * layer, lv_obj_t * obj);
static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area_h); static uint32_t get_max_row(lv_display_t * disp, lv_coord_t area_w, lv_coord_t area_h);
static void draw_buf_flush(lv_disp_t * disp); static void draw_buf_flush(lv_display_t * disp);
static void call_flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * px_map); static void call_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -68,19 +68,19 @@ void _lv_refr_init(void)
{ {
} }
void lv_refr_now(lv_disp_t * disp) void lv_refr_now(lv_display_t * disp)
{ {
lv_anim_refr_now(); lv_anim_refr_now();
if(disp) { if(disp) {
if(disp->refr_timer) _lv_disp_refr_timer(disp->refr_timer); if(disp->refr_timer) _lv_display_refr_timer(disp->refr_timer);
} }
else { else {
lv_disp_t * d; lv_display_t * d;
d = lv_disp_get_next(NULL); d = lv_display_get_next(NULL);
while(d) { while(d) {
if(d->refr_timer) _lv_disp_refr_timer(d->refr_timer); if(d->refr_timer) _lv_display_refr_timer(d->refr_timer);
d = lv_disp_get_next(d); d = lv_display_get_next(d);
} }
} }
} }
@@ -248,11 +248,11 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj)
* @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas) * @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas)
* only one display) * only one display)
*/ */
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p) void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) return; if(!disp) return;
if(!lv_disp_is_invalidation_enabled(disp)) return; if(!lv_display_is_invalidation_enabled(disp)) return;
LV_ASSERT_MSG(!disp->rendering_in_progress, "Invalidate area is not allowed during rendering."); LV_ASSERT_MSG(!disp->rendering_in_progress, "Invalidate area is not allowed during rendering.");
@@ -265,8 +265,8 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
lv_area_t scr_area; lv_area_t scr_area;
scr_area.x1 = 0; scr_area.x1 = 0;
scr_area.y1 = 0; scr_area.y1 = 0;
scr_area.x2 = lv_disp_get_hor_res(disp) - 1; scr_area.x2 = lv_display_get_horizontal_resolution(disp) - 1;
scr_area.y2 = lv_disp_get_ver_res(disp) - 1; scr_area.y2 = lv_display_get_vertical_resolution(disp) - 1;
lv_area_t com_area; lv_area_t com_area;
bool suc; bool suc;
@@ -275,15 +275,15 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
if(suc == false) return; /*Out of the screen*/ if(suc == false) return; /*Out of the screen*/
/*If there were at least 1 invalid area in full refresh mode, redraw the whole screen*/ /*If there were at least 1 invalid area in full refresh mode, redraw the whole screen*/
if(disp->render_mode == LV_DISP_RENDER_MODE_FULL) { if(disp->render_mode == LV_DISPLAY_RENDER_MODE_FULL) {
disp->inv_areas[0] = scr_area; disp->inv_areas[0] = scr_area;
disp->inv_p = 1; disp->inv_p = 1;
lv_disp_send_event(disp, LV_EVENT_REFR_REQUEST, NULL); lv_display_send_event(disp, LV_EVENT_REFR_REQUEST, NULL);
return; return;
} }
lv_res_t res = lv_disp_send_event(disp, LV_EVENT_INVALIDATE_AREA, &com_area); lv_result_t res = lv_display_send_event(disp, LV_EVENT_INVALIDATE_AREA, &com_area);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
/*Save only if this area is not in one of the saved areas*/ /*Save only if this area is not in one of the saved areas*/
uint16_t i; uint16_t i;
@@ -300,14 +300,14 @@ void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
lv_area_copy(&disp->inv_areas[disp->inv_p], tmp_area_p); lv_area_copy(&disp->inv_areas[disp->inv_p], tmp_area_p);
disp->inv_p++; disp->inv_p++;
lv_disp_send_event(disp, LV_EVENT_REFR_REQUEST, NULL); lv_display_send_event(disp, LV_EVENT_REFR_REQUEST, NULL);
} }
/** /**
* Get the display which is being refreshed * Get the display which is being refreshed
* @return the display being refreshed * @return the display being refreshed
*/ */
lv_disp_t * _lv_refr_get_disp_refreshing(void) lv_display_t * _lv_refr_get_disp_refreshing(void)
{ {
return disp_refr; return disp_refr;
} }
@@ -316,7 +316,7 @@ lv_disp_t * _lv_refr_get_disp_refreshing(void)
* Called periodically to handle the refreshing * Called periodically to handle the refreshing
* @param tmr pointer to the timer itself * @param tmr pointer to the timer itself
*/ */
void _lv_disp_refr_timer(lv_timer_t * tmr) void _lv_display_refr_timer(lv_timer_t * tmr)
{ {
LV_PROFILER_BEGIN; LV_PROFILER_BEGIN;
REFR_TRACE("begin"); REFR_TRACE("begin");
@@ -332,7 +332,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
#endif #endif
} }
else { else {
disp_refr = lv_disp_get_default(); disp_refr = lv_display_get_default();
} }
if(disp_refr == NULL) { if(disp_refr == NULL) {
@@ -349,7 +349,7 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
return; return;
} }
lv_disp_send_event(disp_refr, LV_EVENT_REFR_START, NULL); lv_display_send_event(disp_refr, LV_EVENT_REFR_START, NULL);
/*Refresh the screen's layout if required*/ /*Refresh the screen's layout if required*/
lv_obj_update_layout(disp_refr->act_scr); lv_obj_update_layout(disp_refr->act_scr);
@@ -374,9 +374,10 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
/*If refresh happened ...*/ /*If refresh happened ...*/
/*Call monitor cb if present*/ /*Call monitor cb if present*/
lv_disp_send_event(disp_refr, LV_EVENT_RENDER_READY, NULL); lv_display_send_event(disp_refr, LV_EVENT_RENDER_READY, NULL);
if(!lv_disp_is_double_buffered(disp_refr) || disp_refr->render_mode != LV_DISP_RENDER_MODE_DIRECT) goto refr_clean_up; if(!lv_display_is_double_buffered(disp_refr) ||
disp_refr->render_mode != LV_DISPLAY_RENDER_MODE_DIRECT) goto refr_clean_up;
/*With double buffered direct mode synchronize the rendered areas to the other buffer*/ /*With double buffered direct mode synchronize the rendered areas to the other buffer*/
/*We need to wait for ready here to not mess up the active screen*/ /*We need to wait for ready here to not mess up the active screen*/
@@ -389,8 +390,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
? disp_refr->buf_2 ? disp_refr->buf_2
: disp_refr->buf_1; : disp_refr->buf_1;
lv_coord_t stride = lv_draw_buf_width_to_stride(lv_disp_get_hor_res(disp_refr), lv_coord_t stride = lv_draw_buf_width_to_stride(lv_display_get_horizontal_resolution(disp_refr),
lv_disp_get_color_format(disp_refr)); lv_display_get_color_format(disp_refr));
uint32_t i; uint32_t i;
for(i = 0; i < disp_refr->inv_p; i++) { for(i = 0; i < disp_refr->inv_p; i++) {
if(disp_refr->inv_area_joined[i]) continue; if(disp_refr->inv_area_joined[i]) continue;
@@ -413,7 +414,7 @@ refr_finish:
_lv_draw_sw_mask_cleanup(); _lv_draw_sw_mask_cleanup();
#endif #endif
lv_disp_send_event(disp_refr, LV_EVENT_REFR_FINISH, NULL); lv_display_send_event(disp_refr, LV_EVENT_REFR_FINISH, NULL);
REFR_TRACE("finished"); REFR_TRACE("finished");
LV_PROFILER_END; LV_PROFILER_END;
@@ -479,7 +480,7 @@ static void refr_invalid_areas(void)
} }
/*Notify the display driven rendering has started*/ /*Notify the display driven rendering has started*/
lv_disp_send_event(disp_refr, LV_EVENT_RENDER_START, NULL); lv_display_send_event(disp_refr, LV_EVENT_RENDER_START, NULL);
disp_refr->last_area = 0; disp_refr->last_area = 0;
disp_refr->last_part = 0; disp_refr->last_part = 0;
@@ -510,21 +511,21 @@ static void refr_area(const lv_area_t * area_p)
/*With full refresh just redraw directly into the buffer*/ /*With full refresh just redraw directly into the buffer*/
/*In direct mode draw directly on the absolute coordinates of the buffer*/ /*In direct mode draw directly on the absolute coordinates of the buffer*/
if(disp_refr->render_mode != LV_DISP_RENDER_MODE_PARTIAL) { if(disp_refr->render_mode != LV_DISPLAY_RENDER_MODE_PARTIAL) {
layer->draw_buf.width = lv_disp_get_hor_res(disp_refr); layer->draw_buf.width = lv_display_get_horizontal_resolution(disp_refr);
layer->draw_buf.height = lv_disp_get_ver_res(disp_refr); layer->draw_buf.height = lv_display_get_vertical_resolution(disp_refr);
layer->draw_buf_ofs.x = 0; layer->draw_buf_ofs.x = 0;
layer->draw_buf_ofs.y = 0; layer->draw_buf_ofs.y = 0;
lv_area_t disp_area; lv_area_t disp_area;
lv_area_set(&disp_area, 0, 0, lv_disp_get_hor_res(disp_refr) - 1, lv_area_set(&disp_area, 0, 0, lv_display_get_horizontal_resolution(disp_refr) - 1,
lv_disp_get_ver_res(disp_refr) - 1); lv_display_get_vertical_resolution(disp_refr) - 1);
if(disp_refr->render_mode == LV_DISP_RENDER_MODE_FULL) { if(disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_FULL) {
disp_refr->last_part = 1; disp_refr->last_part = 1;
layer->clip_area = disp_area; layer->clip_area = disp_area;
refr_area_part(layer); refr_area_part(layer);
} }
else if(disp_refr->render_mode == LV_DISP_RENDER_MODE_DIRECT) { else if(disp_refr->render_mode == LV_DISPLAY_RENDER_MODE_DIRECT) {
disp_refr->last_part = disp_refr->last_area; disp_refr->last_part = disp_refr->last_area;
layer->clip_area = *area_p; layer->clip_area = *area_p;
refr_area_part(layer); refr_area_part(layer);
@@ -536,8 +537,8 @@ static void refr_area(const lv_area_t * area_p)
/*Calculate the max row num*/ /*Calculate the max row num*/
lv_coord_t w = lv_area_get_width(area_p); lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = lv_area_get_height(area_p); lv_coord_t h = lv_area_get_height(area_p);
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_coord_t y2 = area_p->y2 >= lv_display_get_vertical_resolution(disp_refr) ?
lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2; lv_display_get_vertical_resolution(disp_refr) - 1 : area_p->y2;
int32_t max_row = get_max_row(disp_refr, w, h); int32_t max_row = get_max_row(disp_refr, w, h);
@@ -586,7 +587,7 @@ static void refr_area_part(lv_layer_t * layer)
/* In single buffered mode wait here until the buffer is freed. /* In single buffered mode wait here until the buffer is freed.
* Else we would draw into the buffer while it's still being transferred to the display*/ * Else we would draw into the buffer while it's still being transferred to the display*/
if(!lv_disp_is_double_buffered(disp_refr)) { if(!lv_display_is_double_buffered(disp_refr)) {
while(disp_refr->flushing); while(disp_refr->flushing);
} }
/*If the screen is transparent initialize it when the flushing is ready*/ /*If the screen is transparent initialize it when the flushing is ready*/
@@ -598,14 +599,14 @@ static void refr_area_part(lv_layer_t * layer)
lv_obj_t * top_prev_scr = NULL; lv_obj_t * top_prev_scr = NULL;
/*Get the most top object which is not covered by others*/ /*Get the most top object which is not covered by others*/
top_act_scr = lv_refr_get_top_obj(&layer->clip_area, lv_disp_get_scr_act(disp_refr)); top_act_scr = lv_refr_get_top_obj(&layer->clip_area, lv_display_get_scr_act(disp_refr));
if(disp_refr->prev_scr) { if(disp_refr->prev_scr) {
top_prev_scr = lv_refr_get_top_obj(&layer->clip_area, disp_refr->prev_scr); top_prev_scr = lv_refr_get_top_obj(&layer->clip_area, disp_refr->prev_scr);
} }
/*Draw a bottom layer background if there is no top object*/ /*Draw a bottom layer background if there is no top object*/
if(top_act_scr == NULL && top_prev_scr == NULL) { if(top_act_scr == NULL && top_prev_scr == NULL) {
refr_obj_and_children(layer, lv_disp_get_layer_bottom(disp_refr)); refr_obj_and_children(layer, lv_display_get_layer_bottom(disp_refr));
} }
if(disp_refr->draw_prev_over_act) { if(disp_refr->draw_prev_over_act) {
@@ -630,8 +631,8 @@ static void refr_area_part(lv_layer_t * layer)
} }
/*Also refresh top and sys layer unconditionally*/ /*Also refresh top and sys layer unconditionally*/
refr_obj_and_children(layer, lv_disp_get_layer_top(disp_refr)); refr_obj_and_children(layer, lv_display_get_layer_top(disp_refr));
refr_obj_and_children(layer, lv_disp_get_layer_sys(disp_refr)); refr_obj_and_children(layer, lv_display_get_layer_sys(disp_refr));
draw_buf_flush(disp_refr); draw_buf_flush(disp_refr);
} }
@@ -687,7 +688,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
/*Normally always will be a top_obj (at least the screen) /*Normally always will be a top_obj (at least the screen)
*but in special cases (e.g. if the screen has alpha) it won't. *but in special cases (e.g. if the screen has alpha) it won't.
*In this case use the screen directly*/ *In this case use the screen directly*/
if(top_obj == NULL) top_obj = lv_disp_get_scr_act(disp_refr); if(top_obj == NULL) top_obj = lv_display_get_scr_act(disp_refr);
if(top_obj == NULL) return; /*Shouldn't happen*/ if(top_obj == NULL) return; /*Shouldn't happen*/
/*Refresh the top object and its children*/ /*Refresh the top object and its children*/
@@ -729,7 +730,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
} }
static lv_res_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type_t layer_type, static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type_t layer_type,
lv_area_t * layer_area_out) lv_area_t * layer_area_out)
{ {
lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj);
@@ -744,7 +745,7 @@ static lv_res_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type
lv_area_t tranf_coords = obj_coords_ext; lv_area_t tranf_coords = obj_coords_ext;
lv_obj_get_transformed_area(obj, &tranf_coords, false, false); lv_obj_get_transformed_area(obj, &tranf_coords, false, false);
if(!_lv_area_intersect(&clip_coords_for_obj, &layer->clip_area, &tranf_coords)) { if(!_lv_area_intersect(&clip_coords_for_obj, &layer->clip_area, &tranf_coords)) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
/*Transform back (inverse) the transformed area. /*Transform back (inverse) the transformed area.
@@ -753,7 +754,7 @@ static lv_res_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type
lv_area_t inverse_clip_coords_for_obj = clip_coords_for_obj; lv_area_t inverse_clip_coords_for_obj = clip_coords_for_obj;
lv_obj_get_transformed_area(obj, &inverse_clip_coords_for_obj, false, true); lv_obj_get_transformed_area(obj, &inverse_clip_coords_for_obj, false, true);
if(!_lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, &obj_coords_ext)) { if(!_lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, &obj_coords_ext)) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
*layer_area_out = inverse_clip_coords_for_obj; *layer_area_out = inverse_clip_coords_for_obj;
@@ -762,16 +763,16 @@ static lv_res_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type
else if(layer_type == LV_LAYER_TYPE_SIMPLE) { else if(layer_type == LV_LAYER_TYPE_SIMPLE) {
lv_area_t clip_coords_for_obj; lv_area_t clip_coords_for_obj;
if(!_lv_area_intersect(&clip_coords_for_obj, &layer->clip_area, &obj_coords_ext)) { if(!_lv_area_intersect(&clip_coords_for_obj, &layer->clip_area, &obj_coords_ext)) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
*layer_area_out = clip_coords_for_obj; *layer_area_out = clip_coords_for_obj;
} }
else { else {
LV_LOG_WARN("Unhandled layer type"); LV_LOG_WARN("Unhandled layer type");
return LV_RES_INV; return LV_RESULT_INVALID;
} }
return LV_RES_OK; return LV_RESULT_OK;
} }
static bool alpha_test_area_on_obj(lv_obj_t * obj, const lv_area_t * area) static bool alpha_test_area_on_obj(lv_obj_t * obj, const lv_area_t * area)
@@ -802,8 +803,8 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
if(opa < LV_OPA_MIN) return; if(opa < LV_OPA_MIN) return;
lv_area_t layer_area_full; lv_area_t layer_area_full;
lv_res_t res = layer_get_area(layer, obj, layer_type, &layer_area_full); lv_result_t res = layer_get_area(layer, obj, layer_type, &layer_area_full);
if(res != LV_RES_OK) return; if(res != LV_RESULT_OK) return;
/*Simple layers can be subdivied into smaller layers*/ /*Simple layers can be subdivied into smaller layers*/
uint32_t max_rgb_row_height = lv_area_get_height(&layer_area_full); uint32_t max_rgb_row_height = lv_area_get_height(&layer_area_full);
@@ -842,10 +843,10 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
layer_draw_dsc.pivot.y = obj->coords.y1 + lv_obj_get_style_transform_pivot_y(obj, 0) - new_layer->draw_buf_ofs.y; layer_draw_dsc.pivot.y = obj->coords.y1 + lv_obj_get_style_transform_pivot_y(obj, 0) - new_layer->draw_buf_ofs.y;
layer_draw_dsc.opa = opa; layer_draw_dsc.opa = opa;
layer_draw_dsc.angle = lv_obj_get_style_transform_angle(obj, 0); layer_draw_dsc.rotation = lv_obj_get_style_transform_rotation(obj, 0);
while(layer_draw_dsc.angle > 3600) layer_draw_dsc.angle -= 3600; while(layer_draw_dsc.rotation > 3600) layer_draw_dsc.rotation -= 3600;
while(layer_draw_dsc.angle < 0) layer_draw_dsc.angle += 3600; while(layer_draw_dsc.rotation < 0) layer_draw_dsc.rotation += 3600;
layer_draw_dsc.zoom = lv_obj_get_style_transform_zoom(obj, 0); layer_draw_dsc.zoom = lv_obj_get_style_transform_scale(obj, 0);
layer_draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0); layer_draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0);
layer_draw_dsc.antialias = disp_refr->antialiasing; layer_draw_dsc.antialias = disp_refr->antialiasing;
layer_draw_dsc.src = new_layer; layer_draw_dsc.src = new_layer;
@@ -858,7 +859,7 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
} }
static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area_h) static uint32_t get_max_row(lv_display_t * disp, lv_coord_t area_w, lv_coord_t area_h)
{ {
bool has_alpha = lv_color_format_has_alpha(disp->color_format); bool has_alpha = lv_color_format_has_alpha(disp->color_format);
uint32_t px_size_disp = lv_color_format_get_size(disp->color_format); uint32_t px_size_disp = lv_color_format_get_size(disp->color_format);
@@ -876,7 +877,7 @@ static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area
lv_coord_t h_tmp = max_row; lv_coord_t h_tmp = max_row;
do { do {
tmp.y2 = h_tmp - 1; tmp.y2 = h_tmp - 1;
lv_disp_send_event(disp_refr, LV_EVENT_INVALIDATE_AREA, &tmp); lv_display_send_event(disp_refr, LV_EVENT_INVALIDATE_AREA, &tmp);
/*If this height fits into `max_row` then fine*/ /*If this height fits into `max_row` then fine*/
if(lv_area_get_height(&tmp) <= max_row) break; if(lv_area_get_height(&tmp) <= max_row) break;
@@ -900,7 +901,7 @@ static uint32_t get_max_row(lv_disp_t * disp, lv_coord_t area_w, lv_coord_t area
/** /**
* Flush the content of the draw buffer * Flush the content of the draw buffer
*/ */
static void draw_buf_flush(lv_disp_t * disp) static void draw_buf_flush(lv_display_t * disp)
{ {
/*Flush the rendered content to the display*/ /*Flush the rendered content to the display*/
lv_layer_t * layer = disp->layer_head; lv_layer_t * layer = disp->layer_head;
@@ -914,7 +915,7 @@ static void draw_buf_flush(lv_disp_t * disp)
* and driver is ready to receive the new buffer. * and driver is ready to receive the new buffer.
* If we need to wait here it means that the content of one buffer is being sent to display * If we need to wait here it means that the content of one buffer is being sent to display
* and other buffer already contains the new rendered image. */ * and other buffer already contains the new rendered image. */
if(lv_disp_is_double_buffered(disp)) { if(lv_display_is_double_buffered(disp)) {
while(disp->flushing); while(disp->flushing);
} }
@@ -927,7 +928,7 @@ static void draw_buf_flush(lv_disp_t * disp)
if(disp->flush_cb) { if(disp->flush_cb) {
/*Rotate the buffer to the display's native orientation if necessary*/ /*Rotate the buffer to the display's native orientation if necessary*/
if(disp->rotation != LV_DISP_ROTATION_0 && disp->sw_rotate) { if(disp->rotation != LV_DISPLAY_ROTATION_0 && disp->sw_rotate) {
LV_LOG_WARN("SW rotation is not supported now"); LV_LOG_WARN("SW rotation is not supported now");
call_flush_cb(disp, &disp->refreshed_area, layer->draw_buf.buf); call_flush_cb(disp, &disp->refreshed_area, layer->draw_buf.buf);
} }
@@ -936,7 +937,7 @@ static void draw_buf_flush(lv_disp_t * disp)
} }
} }
/*If there are 2 buffers swap them. With direct mode swap only on the last area*/ /*If there are 2 buffers swap them. With direct mode swap only on the last area*/
if(lv_disp_is_double_buffered(disp) && (disp->render_mode != LV_DISP_RENDER_MODE_DIRECT || flushing_last)) { if(lv_display_is_double_buffered(disp) && (disp->render_mode != LV_DISPLAY_RENDER_MODE_DIRECT || flushing_last)) {
if(disp->buf_act == disp->buf_1) { if(disp->buf_act == disp->buf_1) {
disp->buf_act = disp->buf_2; disp->buf_act = disp->buf_2;
} }
@@ -946,7 +947,7 @@ static void draw_buf_flush(lv_disp_t * disp)
} }
} }
static void call_flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * px_map) static void call_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map)
{ {
LV_PROFILER_BEGIN; LV_PROFILER_BEGIN;
REFR_TRACE("Calling flush_cb on (%d;%d)(%d;%d) area with %p image pointer", REFR_TRACE("Calling flush_cb on (%d;%d)(%d;%d) area with %p image pointer",
@@ -962,9 +963,9 @@ static void call_flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * px
// if(disp->layer_head->buffer_convert) disp->layer_head->buffer_convert(disp->layer_head); // if(disp->layer_head->buffer_convert) disp->layer_head->buffer_convert(disp->layer_head);
lv_disp_send_event(disp, LV_EVENT_FLUSH_START, &offset_area); lv_display_send_event(disp, LV_EVENT_FLUSH_START, &offset_area);
disp->flush_cb(disp, &offset_area, px_map); disp->flush_cb(disp, &offset_area, px_map);
lv_disp_send_event(disp, LV_EVENT_FLUSH_FINISH, &offset_area); lv_display_send_event(disp, LV_EVENT_FLUSH_FINISH, &offset_area);
LV_PROFILER_END; LV_PROFILER_END;
} }

View File

@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_obj.h" #include "lv_obj.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include <stdbool.h> #include <stdbool.h>
/********************* /*********************
@@ -53,7 +53,7 @@ void _lv_refr_init(void);
* (e.g. progress bar) this function can be called when the screen should be updated. * (e.g. progress bar) this function can be called when the screen should be updated.
* @param disp pointer to display to refresh. NULL to refresh all displays. * @param disp pointer to display to refresh. NULL to refresh all displays.
*/ */
void lv_refr_now(lv_disp_t * disp); void lv_refr_now(lv_display_t * disp);
/** /**
* Redrawn on object an all its children using the passed draw context * Redrawn on object an all its children using the passed draw context
@@ -68,19 +68,19 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj);
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is * @param disp pointer to display where the area should be invalidated (NULL can be used if there is
* only one display) * only one display)
*/ */
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p); void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p);
/** /**
* Get the display which is being refreshed * Get the display which is being refreshed
* @return the display being refreshed * @return the display being refreshed
*/ */
lv_disp_t * _lv_refr_get_disp_refreshing(void); lv_display_t * _lv_refr_get_disp_refreshing(void);
/** /**
* Called periodically to handle the refreshing * Called periodically to handle the refreshing
* @param timer pointer to the timer itself * @param timer pointer to the timer itself
*/ */
void _lv_disp_refr_timer(lv_timer_t * timer); void _lv_display_refr_timer(lv_timer_t * timer);
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS

View File

@@ -99,7 +99,7 @@ static int drm_setup(drm_dev_t * drm_dev, const char * device_path, int64_t conn
static int drm_allocate_dumb(drm_dev_t * drm_dev, drm_buffer_t * buf); static int drm_allocate_dumb(drm_dev_t * drm_dev, drm_buffer_t * buf);
static int drm_setup_buffers(drm_dev_t * drm_dev); static int drm_setup_buffers(drm_dev_t * drm_dev);
static void drm_wait_vsync(drm_dev_t * drm_dev); static void drm_wait_vsync(drm_dev_t * drm_dev);
static void drm_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p); static void drm_flush(lv_display_t * disp, const lv_area_t * area, lv_color_t * color_p);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -121,28 +121,28 @@ static void drm_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * col
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
lv_disp_t * lv_linux_drm_create(void) lv_display_t * lv_linux_drm_create(void)
{ {
drm_dev_t * drm_dev = lv_malloc(sizeof(drm_dev_t)); drm_dev_t * drm_dev = lv_malloc(sizeof(drm_dev_t));
LV_ASSERT_MALLOC(drm_dev); LV_ASSERT_MALLOC(drm_dev);
if(drm_dev == NULL) return NULL; if(drm_dev == NULL) return NULL;
lv_memzero(drm_dev, sizeof(drm_dev_t)); lv_memzero(drm_dev, sizeof(drm_dev_t));
lv_disp_t * disp = lv_disp_create(800, 480); lv_display_t * disp = lv_display_create(800, 480);
if(disp == NULL) { if(disp == NULL) {
lv_free(drm_dev); lv_free(drm_dev);
return NULL; return NULL;
} }
drm_dev->fd = -1; drm_dev->fd = -1;
lv_disp_set_driver_data(disp, drm_dev); lv_display_set_driver_data(disp, drm_dev);
lv_disp_set_flush_cb(disp, drm_flush); lv_display_set_flush_cb(disp, drm_flush);
return disp; return disp;
} }
void lv_linux_drm_set_file(lv_disp_t * disp, const char * file, int64_t connector_id) void lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t connector_id)
{ {
drm_dev_t * drm_dev = lv_disp_get_driver_data(disp); drm_dev_t * drm_dev = lv_display_get_driver_data(disp);
int ret; int ret;
ret = drm_setup(drm_dev, file, connector_id, DRM_FOURCC); ret = drm_setup(drm_dev, file, connector_id, DRM_FOURCC);
@@ -168,14 +168,14 @@ void lv_linux_drm_set_file(lv_disp_t * disp, const char * file, int64_t connecto
uint32_t draw_buf_size = hor_res * ver_res / 4; /*1/4 screen sized buffer has the same performance */ uint32_t draw_buf_size = hor_res * ver_res / 4; /*1/4 screen sized buffer has the same performance */
lv_color_t * draw_buf = malloc(draw_buf_size * sizeof(lv_color_t)); lv_color_t * draw_buf = malloc(draw_buf_size * sizeof(lv_color_t));
lv_disp_set_draw_buffers(disp, draw_buf, NULL, draw_buf_size, LV_DISP_RENDER_MODE_PARTIAL); lv_display_set_draw_buffers(disp, draw_buf, NULL, draw_buf_size, LV_DISPLAY_RENDER_MODE_PARTIAL);
lv_disp_set_res(disp, hor_res, ver_res); lv_display_set_res(disp, hor_res, ver_res);
if(width) { if(width) {
lv_disp_set_dpi(disp, DIV_ROUND_UP(hor_res * 25400, width * 1000)); lv_display_set_dpi(disp, DIV_ROUND_UP(hor_res * 25400, width * 1000));
} }
LV_LOG_INFO("Resolution is set to %dx%d at %ddpi", hor_res, ver_res, lv_disp_get_dpi(disp)); LV_LOG_INFO("Resolution is set to %dx%d at %ddpi", hor_res, ver_res, lv_display_get_dpi(disp));
} }
/********************** /**********************
@@ -827,9 +827,9 @@ static void drm_wait_vsync(drm_dev_t * drm_dev)
drm_dev->req = NULL; drm_dev->req = NULL;
} }
static void drm_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * color_p) static void drm_flush(lv_display_t * disp, const lv_area_t * area, lv_color_t * color_p)
{ {
drm_dev_t * drm_dev = lv_disp_get_driver_data(disp); drm_dev_t * drm_dev = lv_display_get_driver_data(disp);
drm_buffer_t * fbuf = drm_dev->cur_bufs[1]; drm_buffer_t * fbuf = drm_dev->cur_bufs[1];
uint32_t w = (area->x2 - area->x1 + 1); uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1); uint32_t h = (area->y2 - area->y1 + 1);
@@ -865,7 +865,7 @@ static void drm_flush(lv_disp_t * disp, const lv_area_t * area, lv_color_t * col
drm_dev->cur_bufs[0] = fbuf; drm_dev->cur_bufs[0] = fbuf;
lv_disp_flush_ready(disp); lv_display_flush_ready(disp);
} }
#endif /*LV_USE_LINUX_DRM*/ #endif /*LV_USE_LINUX_DRM*/

View File

@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#if LV_USE_LINUX_DRM #if LV_USE_LINUX_DRM
@@ -29,9 +29,9 @@ extern "C" {
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
lv_disp_t * lv_linux_drm_create(void); lv_display_t * lv_linux_drm_create(void);
void lv_linux_drm_set_file(lv_disp_t * disp, const char * file, int64_t connector_id); void lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t connector_id);
/********************** /**********************
* MACROS * MACROS

View File

@@ -69,7 +69,7 @@ typedef struct {
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * color_p); static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * color_p);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -91,33 +91,33 @@ static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * color_p
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
lv_disp_t * lv_linux_fbdev_create(void) lv_display_t * lv_linux_fbdev_create(void)
{ {
lv_linux_fb_t * dsc = lv_malloc(sizeof(lv_linux_fb_t)); lv_linux_fb_t * dsc = lv_malloc(sizeof(lv_linux_fb_t));
LV_ASSERT_MALLOC(dsc); LV_ASSERT_MALLOC(dsc);
if(dsc == NULL) return NULL; if(dsc == NULL) return NULL;
lv_memzero(dsc, sizeof(lv_linux_fb_t)); lv_memzero(dsc, sizeof(lv_linux_fb_t));
lv_disp_t * disp = lv_disp_create(800, 480); lv_display_t * disp = lv_display_create(800, 480);
if(disp == NULL) { if(disp == NULL) {
lv_free(dsc); lv_free(dsc);
return NULL; return NULL;
} }
dsc->fbfd = -1; dsc->fbfd = -1;
lv_disp_set_driver_data(disp, dsc); lv_display_set_driver_data(disp, dsc);
lv_disp_set_flush_cb(disp, flush_cb); lv_display_set_flush_cb(disp, flush_cb);
return disp; return disp;
} }
void lv_linux_fbdev_set_file(lv_disp_t * disp, const char * file) void lv_linux_fbdev_set_file(lv_display_t * disp, const char * file)
{ {
char * devname = lv_malloc(lv_strlen(file) + 1); char * devname = lv_malloc(lv_strlen(file) + 1);
LV_ASSERT_MALLOC(devname); LV_ASSERT_MALLOC(devname);
if(devname == NULL) return; if(devname == NULL) return;
lv_strcpy(devname, file); lv_strcpy(devname, file);
lv_linux_fb_t * dsc = lv_disp_get_driver_data(disp); lv_linux_fb_t * dsc = lv_display_get_driver_data(disp);
dsc->devname = devname; dsc->devname = devname;
if(dsc->fbfd > 0) close(dsc->fbfd); if(dsc->fbfd > 0) close(dsc->fbfd);
@@ -209,39 +209,39 @@ void lv_linux_fbdev_set_file(lv_disp_t * disp, const char * file)
if(LV_LINUX_FBDEV_BUFFER_COUNT == 2) { if(LV_LINUX_FBDEV_BUFFER_COUNT == 2) {
draw_buf_2 = lv_malloc(draw_buf_size); draw_buf_2 = lv_malloc(draw_buf_size);
} }
lv_disp_set_draw_buffers(disp, draw_buf, draw_buf_2, draw_buf_size, LV_LINUX_FBDEV_RENDER_MODE); lv_display_set_draw_buffers(disp, draw_buf, draw_buf_2, draw_buf_size, LV_LINUX_FBDEV_RENDER_MODE);
lv_disp_set_res(disp, hor_res, ver_res); lv_display_set_resolution(disp, hor_res, ver_res);
if(width) { if(width) {
lv_disp_set_dpi(disp, DIV_ROUND_UP(hor_res * 254, width * 10)); lv_display_set_dpi(disp, DIV_ROUND_UP(hor_res * 254, width * 10));
} }
LV_LOG_INFO("Resolution is set to %dx%d at %ddpi", hor_res, ver_res, lv_disp_get_dpi(disp)); LV_LOG_INFO("Resolution is set to %dx%d at %ddpi", hor_res, ver_res, lv_display_get_dpi(disp));
} }
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * color_p) static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * color_p)
{ {
lv_linux_fb_t * dsc = lv_disp_get_driver_data(disp); lv_linux_fb_t * dsc = lv_display_get_driver_data(disp);
if(dsc->fbp == NULL || if(dsc->fbp == NULL ||
area->x2 < 0 || area->y2 < 0 || area->x2 < 0 || area->y2 < 0 ||
area->x1 > (int32_t)dsc->vinfo.xres - 1 || area->y1 > (int32_t)dsc->vinfo.yres - 1) { area->x1 > (int32_t)dsc->vinfo.xres - 1 || area->y1 > (int32_t)dsc->vinfo.yres - 1) {
lv_disp_flush_ready(disp); lv_display_flush_ready(disp);
return; return;
} }
lv_coord_t w = lv_area_get_width(area); lv_coord_t w = lv_area_get_width(area);
uint32_t px_size = lv_color_format_get_size(lv_disp_get_color_format(disp)); uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
uint32_t color_pos = (area->x1 + dsc->vinfo.xoffset) * px_size + area->y1 * dsc->finfo.line_length; uint32_t color_pos = (area->x1 + dsc->vinfo.xoffset) * px_size + area->y1 * dsc->finfo.line_length;
uint32_t fb_pos = color_pos + dsc->vinfo.yoffset * dsc->finfo.line_length; uint32_t fb_pos = color_pos + dsc->vinfo.yoffset * dsc->finfo.line_length;
uint8_t * fbp = (uint8_t *)dsc->fbp; uint8_t * fbp = (uint8_t *)dsc->fbp;
int32_t y; int32_t y;
if(LV_LINUX_FBDEV_RENDER_MODE == LV_DISP_RENDER_MODE_DIRECT) { if(LV_LINUX_FBDEV_RENDER_MODE == LV_DISPLAY_RENDER_MODE_DIRECT) {
for(y = area->y1; y <= area->y2; y++) { for(y = area->y1; y <= area->y2; y++) {
lv_memcpy(&fbp[fb_pos], &color_p[color_pos], w * px_size); lv_memcpy(&fbp[fb_pos], &color_p[color_pos], w * px_size);
fb_pos += dsc->finfo.line_length; fb_pos += dsc->finfo.line_length;
@@ -266,7 +266,7 @@ static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * color_p
ioctl(dsc->fbfd, FBIO_UPDATE, (unsigned long)((uintptr_t)&fb_area)); ioctl(dsc->fbfd, FBIO_UPDATE, (unsigned long)((uintptr_t)&fb_area));
#endif #endif
lv_disp_flush_ready(disp); lv_display_flush_ready(disp);
} }
#endif /*LV_USE_LINUX_FBDEV*/ #endif /*LV_USE_LINUX_FBDEV*/

View File

@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#if LV_USE_LINUX_FBDEV #if LV_USE_LINUX_FBDEV
@@ -29,9 +29,9 @@ extern "C" {
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
lv_disp_t * lv_linux_fbdev_create(void); lv_display_t * lv_linux_fbdev_create(void);
void lv_linux_fbdev_set_file(lv_disp_t * disp, const char * file); void lv_linux_fbdev_set_file(lv_display_t * disp, const char * file);
/********************** /**********************
* MACROS * MACROS

View File

@@ -32,7 +32,7 @@
typedef struct { typedef struct {
int fd; int fd;
lv_disp_t * disp; lv_display_t * disp;
struct lcddev_area_s area; struct lcddev_area_s area;
struct lcddev_area_align_s align_info; struct lcddev_area_align_s align_info;
} lv_nuttx_lcd_t; } lv_nuttx_lcd_t;
@@ -43,9 +43,9 @@ typedef struct {
static lv_coord_t align_round_up(lv_coord_t v, uint16_t align); static lv_coord_t align_round_up(lv_coord_t v, uint16_t align);
static void rounder_cb(lv_event_t * e); static void rounder_cb(lv_event_t * e);
static void flush_cb(lv_disp_t * disp, const lv_area_t * area_p, static void flush_cb(lv_display_t * disp, const lv_area_t * area_p,
uint8_t * color_p); uint8_t * color_p);
static lv_disp_t * lcd_init(int fd, int hor_res, int ver_res); static lv_display_t * lcd_init(int fd, int hor_res, int ver_res);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -59,11 +59,11 @@ static lv_disp_t * lcd_init(int fd, int hor_res, int ver_res);
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
lv_disp_t * lv_nuttx_lcd_create(const char * dev_path) lv_display_t * lv_nuttx_lcd_create(const char * dev_path)
{ {
struct fb_videoinfo_s vinfo; struct fb_videoinfo_s vinfo;
struct lcd_planeinfo_s pinfo; struct lcd_planeinfo_s pinfo;
lv_disp_t * disp; lv_display_t * disp;
int fd; int fd;
int ret; int ret;
@@ -130,7 +130,7 @@ static void rounder_cb(lv_event_t * e)
area->y2 = area->y1 + h - 1; area->y2 = area->y1 + h - 1;
} }
static void flush_cb(lv_disp_t * disp, const lv_area_t * area_p, static void flush_cb(lv_display_t * disp, const lv_area_t * area_p,
uint8_t * color_p) uint8_t * color_p)
{ {
lv_nuttx_lcd_t * lcd = disp->user_data; lv_nuttx_lcd_t * lcd = disp->user_data;
@@ -141,10 +141,10 @@ static void flush_cb(lv_disp_t * disp, const lv_area_t * area_p,
lcd->area.col_end = area_p->x2; lcd->area.col_end = area_p->x2;
lcd->area.data = (uint8_t *)color_p; lcd->area.data = (uint8_t *)color_p;
ioctl(lcd->fd, LCDDEVIO_PUTAREA, (unsigned long) & (lcd->area)); ioctl(lcd->fd, LCDDEVIO_PUTAREA, (unsigned long) & (lcd->area));
lv_disp_flush_ready(disp); lv_display_flush_ready(disp);
} }
static lv_disp_t * lcd_init(int fd, int hor_res, int ver_res) static lv_display_t * lcd_init(int fd, int hor_res, int ver_res)
{ {
lv_color_t * draw_buf = NULL; lv_color_t * draw_buf = NULL;
lv_color_t * draw_buf_2 = NULL; lv_color_t * draw_buf_2 = NULL;
@@ -156,19 +156,19 @@ static lv_disp_t * lcd_init(int fd, int hor_res, int ver_res)
} }
lv_memzero(lcd, sizeof(lv_nuttx_lcd_t)); lv_memzero(lcd, sizeof(lv_nuttx_lcd_t));
lv_disp_t * disp = lv_disp_create(hor_res, ver_res); lv_display_t * disp = lv_display_create(hor_res, ver_res);
if(disp == NULL) { if(disp == NULL) {
lv_free(lcd); lv_free(lcd);
return NULL; return NULL;
} }
uint32_t px_size = lv_color_format_get_size(lv_disp_get_color_format(disp)); uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
#if LV_NUTTX_LCD_BUFFER_COUNT > 0 #if LV_NUTTX_LCD_BUFFER_COUNT > 0
uint32_t buf_size = hor_res * ver_res * px_size; uint32_t buf_size = hor_res * ver_res * px_size;
lv_disp_render_mode_t render_mode = LV_DISP_RENDER_MODE_FULL; lv_display_render_mode_t render_mode = LV_DISPLAY_RENDER_MODE_FULL;
#else #else
uint32_t buf_size = hor_res * LV_NUTTX_LCD_BUFFER_SIZE * px_size; uint32_t buf_size = hor_res * LV_NUTTX_LCD_BUFFER_SIZE * px_size;
lv_disp_render_mode_t render_mode = LV_DISP_RENDER_MODE_PARTIAL; lv_display_render_mode_t render_mode = LV_DISPLAY_RENDER_MODE_PARTIAL;
#endif #endif
draw_buf = lv_malloc(buf_size); draw_buf = lv_malloc(buf_size);
@@ -194,8 +194,8 @@ static lv_disp_t * lcd_init(int fd, int hor_res, int ver_res)
} }
lcd->disp = disp; lcd->disp = disp;
lv_disp_set_draw_buffers(lcd->disp, draw_buf, draw_buf_2, buf_size, render_mode); lv_display_set_draw_buffers(lcd->disp, draw_buf, draw_buf_2, buf_size, render_mode);
lv_disp_set_flush_cb(lcd->disp, flush_cb); lv_display_set_flush_cb(lcd->disp, flush_cb);
lv_event_add(&lcd->disp->event_list, rounder_cb, LV_EVENT_INVALIDATE_AREA, lcd); lv_event_add(&lcd->disp->event_list, rounder_cb, LV_EVENT_INVALIDATE_AREA, lcd);
lcd->disp->user_data = lcd; lcd->disp->user_data = lcd;

View File

@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#if LV_USE_NUTTX_LCD #if LV_USE_NUTTX_LCD
@@ -30,7 +30,7 @@ extern "C" {
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
lv_disp_t * lv_nuttx_lcd_create(const char * dev_path); lv_display_t * lv_nuttx_lcd_create(const char * dev_path);
/********************** /**********************
* MACROS * MACROS

View File

@@ -13,7 +13,7 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#if LV_USE_TFT_ESPI #if LV_USE_TFT_ESPI
@@ -28,7 +28,7 @@ extern "C" {
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
lv_disp_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes); lv_display_t * lv_tft_espi_create(uint32_t hor_res, uint32_t ver_res, void * buf, uint32_t buf_size_bytes);
/********************** /**********************
* MACROS * MACROS

View File

@@ -96,7 +96,7 @@ static void touchscreen_read(lv_indev_t * drv, lv_indev_data_t * data)
uint8_t touch_flags = sample.point[0].flags; uint8_t touch_flags = sample.point[0].flags;
if(touch_flags & TOUCH_DOWN || touch_flags & TOUCH_MOVE) { if(touch_flags & TOUCH_DOWN || touch_flags & TOUCH_MOVE) {
const lv_disp_t * disp_drv = drv->disp; const lv_display_t * disp_drv = drv->disp;
lv_coord_t ver_max = disp_drv->ver_res - 1; lv_coord_t ver_max = disp_drv->ver_res - 1;
lv_coord_t hor_max = disp_drv->hor_res - 1; lv_coord_t hor_max = disp_drv->hor_res - 1;

View File

@@ -101,7 +101,7 @@ void _lv_sdl_keyboard_handler(SDL_Event * event)
return; return;
} }
lv_disp_t * disp = _lv_sdl_get_disp_from_win_id(win_id); lv_display_t * disp = _lv_sdl_get_disp_from_win_id(win_id);
/*Find a suitable indev*/ /*Find a suitable indev*/
lv_indev_t * indev = lv_indev_get_next(NULL); lv_indev_t * indev = lv_indev_get_next(NULL);

View File

@@ -99,7 +99,7 @@ void _lv_sdl_mouse_handler(SDL_Event * event)
return; return;
} }
lv_disp_t * disp = _lv_sdl_get_disp_from_win_id(win_id); lv_display_t * disp = _lv_sdl_get_disp_from_win_id(win_id);
/*Find a suitable indev*/ /*Find a suitable indev*/
lv_indev_t * indev = lv_indev_get_next(NULL); lv_indev_t * indev = lv_indev_get_next(NULL);
@@ -114,8 +114,8 @@ void _lv_sdl_mouse_handler(SDL_Event * event)
lv_sdl_mouse_t * indev_dev = lv_indev_get_driver_data(indev); lv_sdl_mouse_t * indev_dev = lv_indev_get_driver_data(indev);
if(indev_dev == NULL) return; if(indev_dev == NULL) return;
lv_coord_t hor_res = lv_disp_get_hor_res(disp); lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp);
lv_coord_t ver_res = lv_disp_get_ver_res(disp); lv_coord_t ver_res = lv_display_get_vertical_resolution(disp);
uint8_t zoom = lv_sdl_window_get_zoom(disp); uint8_t zoom = lv_sdl_window_get_zoom(disp);
switch(event->type) { switch(event->type) {

View File

@@ -84,7 +84,7 @@ void _lv_sdl_mousewheel_handler(SDL_Event * event)
return; return;
} }
lv_disp_t * disp = _lv_sdl_get_disp_from_win_id(win_id); lv_display_t * disp = _lv_sdl_get_disp_from_win_id(win_id);
/*Find a suitable indev*/ /*Find a suitable indev*/
lv_indev_t * indev = lv_indev_get_next(NULL); lv_indev_t * indev = lv_indev_get_next(NULL);

View File

@@ -36,18 +36,18 @@ typedef struct {
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * color_p); static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * color_p);
static void window_create(lv_disp_t * disp); static void window_create(lv_display_t * disp);
static void window_update(lv_disp_t * disp); static void window_update(lv_display_t * disp);
static void clean_up(lv_disp_t * disp); static void clean_up(lv_display_t * disp);
static void texture_resize(lv_disp_t * disp); static void texture_resize(lv_display_t * disp);
static void sdl_event_handler(lv_timer_t * t); static void sdl_event_handler(lv_timer_t * t);
static void release_disp_cb(lv_event_t * e); static void release_disp_cb(lv_event_t * e);
/*********************** /***********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
***********************/ ***********************/
lv_disp_t * _lv_sdl_get_disp_from_win_id(uint32_t win_id); lv_display_t * _lv_sdl_get_disp_from_win_id(uint32_t win_id);
void _lv_sdl_mouse_handler(SDL_Event * event); void _lv_sdl_mouse_handler(SDL_Event * event);
void _lv_sdl_mousewheel_handler(SDL_Event * event); void _lv_sdl_mousewheel_handler(SDL_Event * event);
void _lv_sdl_keyboard_handler(SDL_Event * event); void _lv_sdl_keyboard_handler(SDL_Event * event);
@@ -68,7 +68,7 @@ static lv_timer_t * event_handler_timer;
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
lv_disp_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res) lv_display_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res)
{ {
if(!inited) { if(!inited) {
SDL_Init(SDL_INIT_VIDEO); SDL_Init(SDL_INIT_VIDEO);
@@ -83,67 +83,69 @@ lv_disp_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res)
if(dsc == NULL) return NULL; if(dsc == NULL) return NULL;
lv_memzero(dsc, sizeof(lv_sdl_window_t)); lv_memzero(dsc, sizeof(lv_sdl_window_t));
lv_disp_t * disp = lv_disp_create(hor_res, ver_res); lv_display_t * disp = lv_display_create(hor_res, ver_res);
if(disp == NULL) { if(disp == NULL) {
lv_free(dsc); lv_free(dsc);
return NULL; return NULL;
} }
lv_disp_add_event(disp, release_disp_cb, LV_EVENT_DELETE, disp); lv_display_add_event(disp, release_disp_cb, LV_EVENT_DELETE, disp);
lv_disp_set_driver_data(disp, dsc); lv_display_set_driver_data(disp, dsc);
window_create(disp); window_create(disp);
lv_disp_set_flush_cb(disp, flush_cb); lv_display_set_flush_cb(disp, flush_cb);
if(LV_SDL_RENDER_MODE == LV_DISP_RENDER_MODE_PARTIAL) { if(LV_SDL_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) {
uint8_t * buf1 = malloc(32 * 1024); uint8_t * buf1 = malloc(32 * 1024);
uint8_t * buf2 = NULL; uint8_t * buf2 = NULL;
#if LV_SDL_BUF_COUNT == 2 #if LV_SDL_BUF_COUNT == 2
buf2 = malloc(32 * 1024); buf2 = malloc(32 * 1024);
#endif #endif
lv_disp_set_draw_buffers(disp, buf1, buf2, lv_display_set_draw_buffers(disp, buf1, buf2,
32 * 1024, LV_DISP_RENDER_MODE_PARTIAL); 32 * 1024, LV_DISPLAY_RENDER_MODE_PARTIAL);
} }
/*LV_DISP_RENDER_MODE_DIRECT or FULL */ /*LV_DISPLAY_RENDER_MODE_DIRECT or FULL */
else { else {
uint32_t stride = lv_draw_buf_width_to_stride(lv_disp_get_hor_res(disp), lv_disp_get_color_format(disp)); uint32_t stride = lv_draw_buf_width_to_stride(lv_display_get_horizontal_resolution(disp),
lv_disp_set_draw_buffers(disp, dsc->fb1, dsc->fb2, stride * lv_disp_get_ver_res(disp), LV_SDL_RENDER_MODE); lv_display_get_color_format(disp));
lv_display_set_draw_buffers(disp, dsc->fb1, dsc->fb2, stride * lv_display_get_vertical_resolution(disp),
LV_SDL_RENDER_MODE);
} }
lv_disp_add_event(disp, res_chg_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL); lv_display_add_event(disp, res_chg_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL);
return disp; return disp;
} }
void lv_sdl_window_set_zoom(lv_disp_t * disp, uint8_t zoom) void lv_sdl_window_set_zoom(lv_display_t * disp, uint8_t zoom)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
dsc->zoom = zoom; dsc->zoom = zoom;
lv_disp_send_event(disp, LV_EVENT_RESOLUTION_CHANGED, NULL); lv_display_send_event(disp, LV_EVENT_RESOLUTION_CHANGED, NULL);
lv_refr_now(disp); lv_refr_now(disp);
} }
uint8_t lv_sdl_window_get_zoom(lv_disp_t * disp) uint8_t lv_sdl_window_get_zoom(lv_display_t * disp)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
return dsc->zoom; return dsc->zoom;
} }
lv_disp_t * _lv_sdl_get_disp_from_win_id(uint32_t win_id) lv_display_t * _lv_sdl_get_disp_from_win_id(uint32_t win_id)
{ {
lv_disp_t * disp = lv_disp_get_next(NULL); lv_display_t * disp = lv_display_get_next(NULL);
if(win_id == UINT32_MAX) return disp; if(win_id == UINT32_MAX) return disp;
while(disp) { while(disp) {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
if(SDL_GetWindowID(dsc->window) == win_id) { if(SDL_GetWindowID(dsc->window) == win_id) {
return disp; return disp;
} }
disp = lv_disp_get_next(disp); disp = lv_display_get_next(disp);
} }
return NULL; return NULL;
} }
void lv_sdl_window_set_title(lv_disp_t * disp, const char * title) void lv_sdl_window_set_title(lv_display_t * disp, const char * title)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
SDL_SetWindowTitle(dsc->window, title); SDL_SetWindowTitle(dsc->window, title);
} }
@@ -161,15 +163,15 @@ void lv_sdl_quit()
**********************/ **********************/
static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * px_map) static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
if(LV_SDL_RENDER_MODE == LV_DISP_RENDER_MODE_PARTIAL) { if(LV_SDL_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) {
int32_t y; int32_t y;
uint8_t * fb_tmp = dsc->fb_act; uint8_t * fb_tmp = dsc->fb_act;
uint32_t px_size = lv_color_format_get_size(lv_disp_get_color_format(disp)); uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
uint32_t px_map_stride = lv_area_get_width(area) * px_size; uint32_t px_map_stride = lv_area_get_width(area) * px_size;
lv_coord_t fb_stride = lv_disp_get_hor_res(disp) * px_size; lv_coord_t fb_stride = lv_display_get_horizontal_resolution(disp) * px_size;
fb_tmp += area->y1 * fb_stride; fb_tmp += area->y1 * fb_stride;
fb_tmp += area->x1 * px_size; fb_tmp += area->x1 * px_size;
for(y = area->y1; y <= area->y2; y++) { for(y = area->y1; y <= area->y2; y++) {
@@ -181,15 +183,15 @@ static void flush_cb(lv_disp_t * disp, const lv_area_t * area, uint8_t * px_map)
/* TYPICALLY YOU DO NOT NEED THIS /* TYPICALLY YOU DO NOT NEED THIS
* If it was the last part to refresh update the texture of the window.*/ * If it was the last part to refresh update the texture of the window.*/
if(lv_disp_flush_is_last(disp)) { if(lv_display_flush_is_last(disp)) {
if(LV_SDL_RENDER_MODE != LV_DISP_RENDER_MODE_PARTIAL) { if(LV_SDL_RENDER_MODE != LV_DISPLAY_RENDER_MODE_PARTIAL) {
dsc->fb_act = px_map; dsc->fb_act = px_map;
} }
window_update(disp); window_update(disp);
} }
/*IMPORTANT! It must be called to tell the system the flush is ready*/ /*IMPORTANT! It must be called to tell the system the flush is ready*/
lv_disp_flush_ready(disp); lv_display_flush_ready(disp);
} }
/** /**
@@ -208,9 +210,9 @@ static void sdl_event_handler(lv_timer_t * t)
_lv_sdl_keyboard_handler(&event); _lv_sdl_keyboard_handler(&event);
if(event.type == SDL_WINDOWEVENT) { if(event.type == SDL_WINDOWEVENT) {
lv_disp_t * disp = _lv_sdl_get_disp_from_win_id(event.window.windowID); lv_display_t * disp = _lv_sdl_get_disp_from_win_id(event.window.windowID);
if(disp == NULL) continue; if(disp == NULL) continue;
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
switch(event.window.event) { switch(event.window.event) {
#if SDL_VERSION_ATLEAST(2, 0, 5) #if SDL_VERSION_ATLEAST(2, 0, 5)
@@ -221,7 +223,7 @@ static void sdl_event_handler(lv_timer_t * t)
break; break;
case SDL_WINDOWEVENT_RESIZED: case SDL_WINDOWEVENT_RESIZED:
dsc->ignore_size_chg = 1; dsc->ignore_size_chg = 1;
lv_disp_set_res(disp, event.window.data1 / dsc->zoom, event.window.data2 / dsc->zoom); lv_display_set_resolution(disp, event.window.data1 / dsc->zoom, event.window.data2 / dsc->zoom);
dsc->ignore_size_chg = 0; dsc->ignore_size_chg = 0;
lv_refr_now(disp); lv_refr_now(disp);
break; break;
@@ -243,9 +245,9 @@ static void sdl_event_handler(lv_timer_t * t)
} }
} }
static void clean_up(lv_disp_t * disp) static void clean_up(lv_display_t * disp)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
SDL_DestroyTexture(dsc->texture); SDL_DestroyTexture(dsc->texture);
SDL_DestroyRenderer(dsc->renderer); SDL_DestroyRenderer(dsc->renderer);
SDL_DestroyWindow(dsc->window); SDL_DestroyWindow(dsc->window);
@@ -253,9 +255,9 @@ static void clean_up(lv_disp_t * disp)
lv_free(dsc); lv_free(dsc);
} }
static void window_create(lv_disp_t * disp) static void window_create(lv_display_t * disp)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
dsc->zoom = 1; dsc->zoom = 1;
int flag = SDL_WINDOW_RESIZABLE; int flag = SDL_WINDOW_RESIZABLE;
@@ -263,15 +265,15 @@ static void window_create(lv_disp_t * disp)
flag |= SDL_WINDOW_FULLSCREEN; flag |= SDL_WINDOW_FULLSCREEN;
#endif #endif
lv_coord_t hor_res = lv_disp_get_hor_res(disp); lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp);
lv_coord_t ver_res = lv_disp_get_ver_res(disp); lv_coord_t ver_res = lv_display_get_vertical_resolution(disp);
dsc->window = SDL_CreateWindow("LVGL Simulator", dsc->window = SDL_CreateWindow("LVGL Simulator",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
hor_res * dsc->zoom, ver_res * dsc->zoom, flag); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/ hor_res * dsc->zoom, ver_res * dsc->zoom, flag); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/
dsc->renderer = SDL_CreateRenderer(dsc->window, -1, SDL_RENDERER_SOFTWARE); dsc->renderer = SDL_CreateRenderer(dsc->window, -1, SDL_RENDERER_SOFTWARE);
texture_resize(disp); texture_resize(disp);
uint32_t px_size = lv_color_format_get_size(lv_disp_get_color_format(disp)); uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
lv_memset(dsc->fb1, 0xff, hor_res * ver_res * px_size); lv_memset(dsc->fb1, 0xff, hor_res * ver_res * px_size);
#if LV_SDL_DIRECT_MODE_2_BUF #if LV_SDL_DIRECT_MODE_2_BUF
lv_memset(dsc->fb2, 0xff, hor_res * ver_res * px_size); lv_memset(dsc->fb2, 0xff, hor_res * ver_res * px_size);
@@ -281,11 +283,11 @@ static void window_create(lv_disp_t * disp)
texture_resize(disp); texture_resize(disp);
} }
static void window_update(lv_disp_t * disp) static void window_update(lv_display_t * disp)
{ {
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
lv_coord_t hor_res = lv_disp_get_hor_res(disp); lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp);
uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_disp_get_color_format(disp)); uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_display_get_color_format(disp));
SDL_UpdateTexture(dsc->texture, NULL, dsc->fb_act, stride); SDL_UpdateTexture(dsc->texture, NULL, dsc->fb_act, stride);
SDL_RenderClear(dsc->renderer); SDL_RenderClear(dsc->renderer);
@@ -295,17 +297,17 @@ static void window_update(lv_disp_t * disp)
SDL_RenderPresent(dsc->renderer); SDL_RenderPresent(dsc->renderer);
} }
static void texture_resize(lv_disp_t * disp) static void texture_resize(lv_display_t * disp)
{ {
lv_coord_t hor_res = lv_disp_get_hor_res(disp); lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp);
lv_coord_t ver_res = lv_disp_get_ver_res(disp); lv_coord_t ver_res = lv_display_get_vertical_resolution(disp);
uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_disp_get_color_format(disp)); uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_display_get_color_format(disp));
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
dsc->fb1 = realloc(dsc->fb1, stride * ver_res); dsc->fb1 = realloc(dsc->fb1, stride * ver_res);
memset(dsc->fb1, 0x00, stride * ver_res); memset(dsc->fb1, 0x00, stride * ver_res);
if(LV_SDL_RENDER_MODE == LV_DISP_RENDER_MODE_PARTIAL) { if(LV_SDL_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) {
dsc->fb_act = dsc->fb1; dsc->fb_act = dsc->fb1;
} }
else { else {
@@ -313,7 +315,7 @@ static void texture_resize(lv_disp_t * disp)
dsc->fb2 = realloc(dsc->fb2, stride * ver_res); dsc->fb2 = realloc(dsc->fb2, stride * ver_res);
memset(dsc->fb2, 0x00, stride * ver_res); memset(dsc->fb2, 0x00, stride * ver_res);
#endif #endif
lv_disp_set_draw_buffers(disp, dsc->fb1, dsc->fb2, stride * ver_res, LV_SDL_RENDER_MODE); lv_display_set_draw_buffers(disp, dsc->fb1, dsc->fb2, stride * ver_res, LV_SDL_RENDER_MODE);
} }
if(dsc->texture) SDL_DestroyTexture(dsc->texture); if(dsc->texture) SDL_DestroyTexture(dsc->texture);
@@ -335,11 +337,11 @@ static void texture_resize(lv_disp_t * disp)
static void res_chg_event_cb(lv_event_t * e) static void res_chg_event_cb(lv_event_t * e)
{ {
lv_disp_t * disp = lv_event_get_target(e); lv_display_t * disp = lv_event_get_target(e);
int32_t hor_res = lv_disp_get_hor_res(disp); int32_t hor_res = lv_display_get_horizontal_resolution(disp);
int32_t ver_res = lv_disp_get_ver_res(disp); int32_t ver_res = lv_display_get_vertical_resolution(disp);
lv_sdl_window_t * dsc = lv_disp_get_driver_data(disp); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
if(dsc->ignore_size_chg == false) { if(dsc->ignore_size_chg == false) {
SDL_SetWindowSize(dsc->window, hor_res * dsc->zoom, ver_res * dsc->zoom); SDL_SetWindowSize(dsc->window, hor_res * dsc->zoom, ver_res * dsc->zoom);
} }
@@ -349,7 +351,7 @@ static void res_chg_event_cb(lv_event_t * e)
static void release_disp_cb(lv_event_t * e) static void release_disp_cb(lv_event_t * e)
{ {
lv_disp_t * disp = (lv_disp_t *) lv_event_get_user_data(e); lv_display_t * disp = (lv_display_t *) lv_event_get_user_data(e);
clean_up(disp); clean_up(disp);
} }

View File

@@ -14,7 +14,7 @@ extern "C" {
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../disp/lv_disp.h" #include "../../display/lv_display.h"
#include "../../indev/lv_indev.h" #include "../../indev/lv_indev.h"
#if LV_USE_SDL #if LV_USE_SDL
@@ -31,15 +31,15 @@ extern "C" {
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
lv_disp_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res); lv_display_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res);
void lv_sdl_window_set_zoom(lv_disp_t * disp, uint8_t zoom); void lv_sdl_window_set_zoom(lv_display_t * disp, uint8_t zoom);
uint8_t lv_sdl_window_get_zoom(lv_disp_t * disp); uint8_t lv_sdl_window_get_zoom(lv_display_t * disp);
lv_disp_t * _lv_sdl_get_disp_from_win_id(uint32_t win_id); lv_display_t * _lv_sdl_get_disp_from_win_id(uint32_t win_id);
void lv_sdl_window_set_title(lv_disp_t * disp, const char * title); void lv_sdl_window_set_title(lv_display_t * disp, const char * title);
void lv_sdl_quit(); void lv_sdl_quit();

View File

@@ -6,10 +6,10 @@
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_disp.h" #include "lv_display.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../core/lv_refr.h" #include "../core/lv_refr.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
#include "../themes/lv_theme.h" #include "../themes/lv_theme.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
@@ -33,7 +33,7 @@
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_obj_tree_walk_res_t invalidate_layout_cb(lv_obj_t * obj, void * user_data); static lv_obj_tree_walk_res_t invalidate_layout_cb(lv_obj_t * obj, void * user_data);
static void update_resolution(lv_disp_t * disp); static void update_resolution(lv_display_t * disp);
static void scr_load_internal(lv_obj_t * scr); static void scr_load_internal(lv_obj_t * scr);
static void scr_load_anim_start(lv_anim_t * a); static void scr_load_anim_start(lv_anim_t * a);
static void opa_scale_anim(void * obj, int32_t v); static void opa_scale_anim(void * obj, int32_t v);
@@ -55,13 +55,13 @@ static void disp_event_cb(lv_event_t * e);
* GLOBAL FUNCTIONS * GLOBAL FUNCTIONS
**********************/ **********************/
lv_disp_t * lv_disp_create(lv_coord_t hor_res, lv_coord_t ver_res) lv_display_t * lv_display_create(lv_coord_t hor_res, lv_coord_t ver_res)
{ {
lv_disp_t * disp = _lv_ll_ins_head(disp_ll_p); lv_display_t * disp = _lv_ll_ins_head(disp_ll_p);
LV_ASSERT_MALLOC(disp); LV_ASSERT_MALLOC(disp);
if(!disp) return NULL; if(!disp) return NULL;
lv_memzero(disp, sizeof(lv_disp_t)); lv_memzero(disp, sizeof(lv_display_t));
disp->hor_res = hor_res; disp->hor_res = hor_res;
disp->ver_res = ver_res; disp->ver_res = ver_res;
@@ -84,11 +84,11 @@ lv_disp_t * lv_disp_create(lv_coord_t hor_res, lv_coord_t ver_res)
disp->inv_en_cnt = 1; disp->inv_en_cnt = 1;
lv_disp_t * disp_def_tmp = disp_def; lv_display_t * disp_def_tmp = disp_def;
disp_def = disp; /*Temporarily change the default screen to create the default screens on the disp_def = disp; /*Temporarily change the default screen to create the default screens on the
new display*/ new display*/
/*Create a refresh timer*/ /*Create a refresh timer*/
disp->refr_timer = lv_timer_create(_lv_disp_refr_timer, LV_DEF_REFR_PERIOD, disp); disp->refr_timer = lv_timer_create(_lv_display_refr_timer, LV_DEF_REFR_PERIOD, disp);
LV_ASSERT_MALLOC(disp->refr_timer); LV_ASSERT_MALLOC(disp->refr_timer);
if(disp->refr_timer == NULL) { if(disp->refr_timer == NULL) {
lv_free(disp); lv_free(disp);
@@ -124,7 +124,7 @@ lv_disp_t * lv_disp_create(lv_coord_t hor_res, lv_coord_t ver_res)
disp_def = disp_def_tmp; /*Revert the default display*/ disp_def = disp_def_tmp; /*Revert the default display*/
if(disp_def == NULL) disp_def = disp; /*Initialize the default display*/ if(disp_def == NULL) disp_def = disp; /*Initialize the default display*/
lv_disp_add_event(disp, disp_event_cb, LV_EVENT_REFR_REQUEST, NULL); lv_display_add_event(disp, disp_event_cb, LV_EVENT_REFR_REQUEST, NULL);
lv_timer_ready(disp->refr_timer); /*Be sure the screen will be refreshed immediately on start up*/ lv_timer_ready(disp->refr_timer); /*Be sure the screen will be refreshed immediately on start up*/
@@ -132,12 +132,12 @@ lv_disp_t * lv_disp_create(lv_coord_t hor_res, lv_coord_t ver_res)
} }
void lv_disp_remove(lv_disp_t * disp) void lv_display_remove(lv_display_t * disp)
{ {
bool was_default = false; bool was_default = false;
if(disp == lv_disp_get_default()) was_default = true; if(disp == lv_display_get_default()) was_default = true;
lv_disp_send_event(disp, LV_EVENT_DELETE, NULL); lv_display_send_event(disp, LV_EVENT_DELETE, NULL);
lv_event_remove_all(&(disp->event_list)); lv_event_remove_all(&(disp->event_list));
/*Detach the input devices*/ /*Detach the input devices*/
@@ -173,20 +173,20 @@ void lv_disp_remove(lv_disp_t * disp)
if(disp->refr_timer) lv_timer_del(disp->refr_timer); if(disp->refr_timer) lv_timer_del(disp->refr_timer);
lv_free(disp); lv_free(disp);
if(was_default) lv_disp_set_default(_lv_ll_get_head(disp_ll_p)); if(was_default) lv_display_set_default(_lv_ll_get_head(disp_ll_p));
} }
void lv_disp_set_default(lv_disp_t * disp) void lv_display_set_default(lv_display_t * disp)
{ {
disp_def = disp; disp_def = disp;
} }
lv_disp_t * lv_disp_get_default(void) lv_display_t * lv_display_get_default(void)
{ {
return disp_def; return disp_def;
} }
lv_disp_t * lv_disp_get_next(lv_disp_t * disp) lv_display_t * lv_display_get_next(lv_display_t * disp)
{ {
if(disp == NULL) if(disp == NULL)
return _lv_ll_get_head(disp_ll_p); return _lv_ll_get_head(disp_ll_p);
@@ -198,9 +198,9 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp)
* RESOLUTION * RESOLUTION
*--------------------*/ *--------------------*/
void lv_disp_set_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t ver_res) void lv_display_set_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
if(disp->hor_res == hor_res && disp->ver_res == ver_res) return; if(disp->hor_res == hor_res && disp->ver_res == ver_res) return;
@@ -211,9 +211,9 @@ void lv_disp_set_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t ver_res)
update_resolution(disp); update_resolution(disp);
} }
void lv_disp_set_physical_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t ver_res) void lv_display_set_physical_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->physical_hor_res = hor_res; disp->physical_hor_res = hor_res;
@@ -223,9 +223,9 @@ void lv_disp_set_physical_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t v
} }
void lv_disp_set_offset(lv_disp_t * disp, lv_coord_t x, lv_coord_t y) void lv_display_set_offset(lv_display_t * disp, lv_coord_t x, lv_coord_t y)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->offset_x = x; disp->offset_x = x;
@@ -235,25 +235,25 @@ void lv_disp_set_offset(lv_disp_t * disp, lv_coord_t x, lv_coord_t y)
} }
void lv_disp_set_dpi(lv_disp_t * disp, lv_coord_t dpi) void lv_display_set_dpi(lv_display_t * disp, lv_coord_t dpi)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->dpi = dpi; disp->dpi = dpi;
} }
lv_coord_t lv_disp_get_hor_res(const lv_disp_t * disp) lv_coord_t lv_display_get_horizontal_resolution(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
return 0; return 0;
} }
else { else {
switch(disp->rotation) { switch(disp->rotation) {
case LV_DISP_ROTATION_90: case LV_DISPLAY_ROTATION_90:
case LV_DISP_ROTATION_270: case LV_DISPLAY_ROTATION_270:
return disp->ver_res; return disp->ver_res;
default: default:
return disp->hor_res; return disp->hor_res;
@@ -261,17 +261,17 @@ lv_coord_t lv_disp_get_hor_res(const lv_disp_t * disp)
} }
} }
lv_coord_t lv_disp_get_ver_res(const lv_disp_t * disp) lv_coord_t lv_display_get_vertical_resolution(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
return 0; return 0;
} }
else { else {
switch(disp->rotation) { switch(disp->rotation) {
case LV_DISP_ROTATION_90: case LV_DISPLAY_ROTATION_90:
case LV_DISP_ROTATION_270: case LV_DISPLAY_ROTATION_270:
return disp->hor_res; return disp->hor_res;
default: default:
return disp->ver_res; return disp->ver_res;
@@ -279,17 +279,17 @@ lv_coord_t lv_disp_get_ver_res(const lv_disp_t * disp)
} }
} }
lv_coord_t lv_disp_get_physical_hor_res(const lv_disp_t * disp) lv_coord_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
return 0; return 0;
} }
else { else {
switch(disp->rotation) { switch(disp->rotation) {
case LV_DISP_ROTATION_90: case LV_DISPLAY_ROTATION_90:
case LV_DISP_ROTATION_270: case LV_DISPLAY_ROTATION_270:
return disp->physical_ver_res > 0 ? disp->physical_ver_res : disp->ver_res; return disp->physical_ver_res > 0 ? disp->physical_ver_res : disp->ver_res;
default: default:
return disp->physical_hor_res > 0 ? disp->physical_hor_res : disp->hor_res; return disp->physical_hor_res > 0 ? disp->physical_hor_res : disp->hor_res;
@@ -297,17 +297,17 @@ lv_coord_t lv_disp_get_physical_hor_res(const lv_disp_t * disp)
} }
} }
lv_coord_t lv_disp_get_physical_ver_res(const lv_disp_t * disp) lv_coord_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
return 0; return 0;
} }
else { else {
switch(disp->rotation) { switch(disp->rotation) {
case LV_DISP_ROTATION_90: case LV_DISPLAY_ROTATION_90:
case LV_DISP_ROTATION_270: case LV_DISPLAY_ROTATION_270:
return disp->physical_hor_res > 0 ? disp->physical_hor_res : disp->hor_res; return disp->physical_hor_res > 0 ? disp->physical_hor_res : disp->hor_res;
default: default:
return disp->physical_ver_res > 0 ? disp->physical_ver_res : disp->ver_res; return disp->physical_ver_res > 0 ? disp->physical_ver_res : disp->ver_res;
@@ -315,51 +315,51 @@ lv_coord_t lv_disp_get_physical_ver_res(const lv_disp_t * disp)
} }
} }
lv_coord_t lv_disp_get_offset_x(const lv_disp_t * disp) lv_coord_t lv_display_get_offset_x(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
return 0; return 0;
} }
else { else {
switch(disp->rotation) { switch(disp->rotation) {
case LV_DISP_ROTATION_90: case LV_DISPLAY_ROTATION_90:
return disp->offset_y; return disp->offset_y;
case LV_DISP_ROTATION_180: case LV_DISPLAY_ROTATION_180:
return lv_disp_get_physical_hor_res(disp) - disp->offset_x; return lv_display_get_physical_horizontal_resolution(disp) - disp->offset_x;
case LV_DISP_ROTATION_270: case LV_DISPLAY_ROTATION_270:
return lv_disp_get_physical_hor_res(disp) - disp->offset_y; return lv_display_get_physical_horizontal_resolution(disp) - disp->offset_y;
default: default:
return disp->offset_x; return disp->offset_x;
} }
} }
} }
lv_coord_t lv_disp_get_offset_y(const lv_disp_t * disp) lv_coord_t lv_display_get_offset_y(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
return 0; return 0;
} }
else { else {
switch(disp->rotation) { switch(disp->rotation) {
case LV_DISP_ROTATION_90: case LV_DISPLAY_ROTATION_90:
return disp->offset_x; return disp->offset_x;
case LV_DISP_ROTATION_180: case LV_DISPLAY_ROTATION_180:
return lv_disp_get_physical_ver_res(disp) - disp->offset_y; return lv_display_get_physical_vertical_resolution(disp) - disp->offset_y;
case LV_DISP_ROTATION_270: case LV_DISPLAY_ROTATION_270:
return lv_disp_get_physical_ver_res(disp) - disp->offset_x; return lv_display_get_physical_vertical_resolution(disp) - disp->offset_x;
default: default:
return disp->offset_y; return disp->offset_y;
} }
} }
} }
lv_coord_t lv_disp_get_dpi(const lv_disp_t * disp) lv_coord_t lv_display_get_dpi(const lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return LV_DPI_DEF; /*Do not return 0 because it might be a divider*/ if(disp == NULL) return LV_DPI_DEF; /*Do not return 0 because it might be a divider*/
return disp->dpi; return disp->dpi;
} }
@@ -368,10 +368,10 @@ lv_coord_t lv_disp_get_dpi(const lv_disp_t * disp)
* BUFFERING * BUFFERING
*--------------------*/ *--------------------*/
void lv_disp_set_draw_buffers(lv_disp_t * disp, void * buf1, void * buf2, uint32_t buf_size_in_bytes, void lv_display_set_draw_buffers(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size_in_bytes,
lv_disp_render_mode_t render_mode) lv_display_render_mode_t render_mode)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->buf_1 = buf1; disp->buf_1 = buf1;
@@ -381,60 +381,60 @@ void lv_disp_set_draw_buffers(lv_disp_t * disp, void * buf1, void * buf2, uint32
disp->render_mode = render_mode; disp->render_mode = render_mode;
} }
void lv_disp_set_flush_cb(lv_disp_t * disp, lv_disp_flush_cb_t flush_cb) void lv_display_set_flush_cb(lv_display_t * disp, lv_display_flush_cb_t flush_cb)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->flush_cb = flush_cb; disp->flush_cb = flush_cb;
} }
void lv_disp_set_color_format(lv_disp_t * disp, lv_color_format_t color_format) void lv_display_set_color_format(lv_display_t * disp, lv_color_format_t color_format)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->color_format = color_format; disp->color_format = color_format;
disp->layer_head->draw_buf.color_format = color_format; disp->layer_head->draw_buf.color_format = color_format;
} }
lv_color_format_t lv_disp_get_color_format(lv_disp_t * disp) lv_color_format_t lv_display_get_color_format(lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return LV_COLOR_FORMAT_UNKNOWN; if(disp == NULL) return LV_COLOR_FORMAT_UNKNOWN;
return disp->color_format; return disp->color_format;
} }
void lv_disp_set_antialiasing(lv_disp_t * disp, bool en) void lv_display_set_antialiasing(lv_display_t * disp, bool en)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->antialiasing = en; disp->antialiasing = en;
} }
bool lv_disp_get_antialiasing(lv_disp_t * disp) bool lv_display_get_antialiasing(lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return false; if(disp == NULL) return false;
return disp->antialiasing; return disp->antialiasing;
} }
LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_t * disp) LV_ATTRIBUTE_FLUSH_READY void lv_display_flush_ready(lv_display_t * disp)
{ {
disp->flushing = 0; disp->flushing = 0;
disp->flushing_last = 0; disp->flushing_last = 0;
} }
LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_t * disp) LV_ATTRIBUTE_FLUSH_READY bool lv_display_flush_is_last(lv_display_t * disp)
{ {
return disp->flushing_last; return disp->flushing_last;
} }
bool lv_disp_is_double_buffered(lv_disp_t * disp) bool lv_display_is_double_buffered(lv_display_t * disp)
{ {
return disp->buf_2 != NULL; return disp->buf_2 != NULL;
} }
@@ -443,9 +443,9 @@ bool lv_disp_is_double_buffered(lv_disp_t * disp)
* SCREENS * SCREENS
*--------------------*/ *--------------------*/
lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp) lv_obj_t * lv_display_get_scr_act(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("no display registered to get its active screen"); LV_LOG_WARN("no display registered to get its active screen");
return NULL; return NULL;
@@ -454,9 +454,9 @@ lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp)
return disp->act_scr; return disp->act_scr;
} }
lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp) lv_obj_t * lv_display_get_scr_prev(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("no display registered to get its previous screen"); LV_LOG_WARN("no display registered to get its previous screen");
return NULL; return NULL;
@@ -465,14 +465,14 @@ lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp)
return disp->prev_scr; return disp->prev_scr;
} }
void lv_disp_load_scr(lv_obj_t * scr) void lv_display_load_scr(lv_obj_t * scr)
{ {
lv_scr_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, false); lv_scr_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, false);
} }
lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp) lv_obj_t * lv_display_get_layer_top(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("lv_layer_top: no display registered to get its top layer"); LV_LOG_WARN("lv_layer_top: no display registered to get its top layer");
return NULL; return NULL;
@@ -481,9 +481,9 @@ lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp)
return disp->top_layer; return disp->top_layer;
} }
lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp) lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("lv_layer_sys: no display registered to get its sys. layer"); LV_LOG_WARN("lv_layer_sys: no display registered to get its sys. layer");
return NULL; return NULL;
@@ -492,9 +492,9 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp)
return disp->sys_layer; return disp->sys_layer;
} }
lv_obj_t * lv_disp_get_layer_bottom(lv_disp_t * disp) lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("lv_layer_bottom: no display registered to get its bottom layer"); LV_LOG_WARN("lv_layer_bottom: no display registered to get its bottom layer");
return NULL; return NULL;
@@ -505,7 +505,7 @@ lv_obj_t * lv_disp_get_layer_bottom(lv_disp_t * disp)
void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del) void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t time, uint32_t delay, bool auto_del)
{ {
lv_disp_t * d = lv_obj_get_disp(new_scr); lv_display_t * d = lv_obj_get_disp(new_scr);
lv_obj_t * act_scr = lv_scr_act(); lv_obj_t * act_scr = lv_scr_act();
if(act_scr == new_scr || d->scr_to_load == new_scr) { if(act_scr == new_scr || d->scr_to_load == new_scr) {
@@ -578,47 +578,47 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
break; break;
case LV_SCR_LOAD_ANIM_OVER_LEFT: case LV_SCR_LOAD_ANIM_OVER_LEFT:
lv_anim_set_exec_cb(&a_new, set_x_anim); lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0); lv_anim_set_values(&a_new, lv_display_get_horizontal_resolution(d), 0);
break; break;
case LV_SCR_LOAD_ANIM_OVER_RIGHT: case LV_SCR_LOAD_ANIM_OVER_RIGHT:
lv_anim_set_exec_cb(&a_new, set_x_anim); lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0); lv_anim_set_values(&a_new, -lv_display_get_horizontal_resolution(d), 0);
break; break;
case LV_SCR_LOAD_ANIM_OVER_TOP: case LV_SCR_LOAD_ANIM_OVER_TOP:
lv_anim_set_exec_cb(&a_new, set_y_anim); lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0); lv_anim_set_values(&a_new, lv_display_get_vertical_resolution(d), 0);
break; break;
case LV_SCR_LOAD_ANIM_OVER_BOTTOM: case LV_SCR_LOAD_ANIM_OVER_BOTTOM:
lv_anim_set_exec_cb(&a_new, set_y_anim); lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0); lv_anim_set_values(&a_new, -lv_display_get_vertical_resolution(d), 0);
break; break;
case LV_SCR_LOAD_ANIM_MOVE_LEFT: case LV_SCR_LOAD_ANIM_MOVE_LEFT:
lv_anim_set_exec_cb(&a_new, set_x_anim); lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, lv_disp_get_hor_res(d), 0); lv_anim_set_values(&a_new, lv_display_get_horizontal_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_x_anim); lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d)); lv_anim_set_values(&a_old, 0, -lv_display_get_horizontal_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_MOVE_RIGHT: case LV_SCR_LOAD_ANIM_MOVE_RIGHT:
lv_anim_set_exec_cb(&a_new, set_x_anim); lv_anim_set_exec_cb(&a_new, set_x_anim);
lv_anim_set_values(&a_new, -lv_disp_get_hor_res(d), 0); lv_anim_set_values(&a_new, -lv_display_get_horizontal_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_x_anim); lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d)); lv_anim_set_values(&a_old, 0, lv_display_get_horizontal_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_MOVE_TOP: case LV_SCR_LOAD_ANIM_MOVE_TOP:
lv_anim_set_exec_cb(&a_new, set_y_anim); lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, lv_disp_get_ver_res(d), 0); lv_anim_set_values(&a_new, lv_display_get_vertical_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_y_anim); lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d)); lv_anim_set_values(&a_old, 0, -lv_display_get_vertical_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_MOVE_BOTTOM: case LV_SCR_LOAD_ANIM_MOVE_BOTTOM:
lv_anim_set_exec_cb(&a_new, set_y_anim); lv_anim_set_exec_cb(&a_new, set_y_anim);
lv_anim_set_values(&a_new, -lv_disp_get_ver_res(d), 0); lv_anim_set_values(&a_new, -lv_display_get_vertical_resolution(d), 0);
lv_anim_set_exec_cb(&a_old, set_y_anim); lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d)); lv_anim_set_values(&a_old, 0, lv_display_get_vertical_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_FADE_IN: case LV_SCR_LOAD_ANIM_FADE_IN:
lv_anim_set_exec_cb(&a_new, opa_scale_anim); lv_anim_set_exec_cb(&a_new, opa_scale_anim);
@@ -630,19 +630,19 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
break; break;
case LV_SCR_LOAD_ANIM_OUT_LEFT: case LV_SCR_LOAD_ANIM_OUT_LEFT:
lv_anim_set_exec_cb(&a_old, set_x_anim); lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, -lv_disp_get_hor_res(d)); lv_anim_set_values(&a_old, 0, -lv_display_get_horizontal_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_OUT_RIGHT: case LV_SCR_LOAD_ANIM_OUT_RIGHT:
lv_anim_set_exec_cb(&a_old, set_x_anim); lv_anim_set_exec_cb(&a_old, set_x_anim);
lv_anim_set_values(&a_old, 0, lv_disp_get_hor_res(d)); lv_anim_set_values(&a_old, 0, lv_display_get_horizontal_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_OUT_TOP: case LV_SCR_LOAD_ANIM_OUT_TOP:
lv_anim_set_exec_cb(&a_old, set_y_anim); lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, -lv_disp_get_ver_res(d)); lv_anim_set_values(&a_old, 0, -lv_display_get_vertical_resolution(d));
break; break;
case LV_SCR_LOAD_ANIM_OUT_BOTTOM: case LV_SCR_LOAD_ANIM_OUT_BOTTOM:
lv_anim_set_exec_cb(&a_old, set_y_anim); lv_anim_set_exec_cb(&a_old, set_y_anim);
lv_anim_set_values(&a_old, 0, lv_disp_get_ver_res(d)); lv_anim_set_values(&a_old, 0, lv_display_get_vertical_resolution(d));
break; break;
} }
@@ -656,35 +656,35 @@ void lv_scr_load_anim(lv_obj_t * new_scr, lv_scr_load_anim_t anim_type, uint32_t
* OTHERS * OTHERS
*--------------------*/ *--------------------*/
void lv_disp_add_event(lv_disp_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data) void lv_display_add_event(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data)
{ {
LV_ASSERT_NULL(disp); LV_ASSERT_NULL(disp);
lv_event_add(&disp->event_list, event_cb, filter, user_data); lv_event_add(&disp->event_list, event_cb, filter, user_data);
} }
uint32_t lv_disp_get_event_count(lv_disp_t * disp) uint32_t lv_display_get_event_count(lv_display_t * disp)
{ {
LV_ASSERT_NULL(disp); LV_ASSERT_NULL(disp);
return lv_event_get_count(&disp->event_list); return lv_event_get_count(&disp->event_list);
} }
lv_event_dsc_t * lv_disp_get_event_dsc(lv_disp_t * disp, uint32_t index) lv_event_dsc_t * lv_display_get_event_dsc(lv_display_t * disp, uint32_t index)
{ {
LV_ASSERT_NULL(disp); LV_ASSERT_NULL(disp);
return lv_event_get_dsc(&disp->event_list, index); return lv_event_get_dsc(&disp->event_list, index);
} }
bool lv_disp_remove_event(lv_disp_t * disp, uint32_t index) bool lv_display_remove_event(lv_display_t * disp, uint32_t index)
{ {
LV_ASSERT_NULL(disp); LV_ASSERT_NULL(disp);
return lv_event_remove(&disp->event_list, index); return lv_event_remove(&disp->event_list, index);
} }
lv_res_t lv_disp_send_event(lv_disp_t * disp, lv_event_code_t code, void * param) lv_result_t lv_display_send_event(lv_display_t * disp, lv_event_code_t code, void * param)
{ {
lv_event_t e; lv_event_t e;
@@ -693,19 +693,19 @@ lv_res_t lv_disp_send_event(lv_disp_t * disp, lv_event_code_t code, void * param
e.current_target = disp; e.current_target = disp;
e.original_target = disp; e.original_target = disp;
e.param = param; e.param = param;
lv_res_t res; lv_result_t res;
res = lv_event_send(&disp->event_list, &e, true); res = lv_event_send(&disp->event_list, &e, true);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
res = lv_event_send(&disp->event_list, &e, false); res = lv_event_send(&disp->event_list, &e, false);
if(res != LV_RES_OK) return res; if(res != LV_RESULT_OK) return res;
return res; return res;
} }
void lv_disp_set_rotation(lv_disp_t * disp, lv_disp_rotation_t rotation, bool sw_rotate) void lv_display_set_rotation(lv_display_t * disp, lv_display_rotation_t rotation, bool sw_rotate)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return; if(disp == NULL) return;
disp->rotation = rotation; disp->rotation = rotation;
@@ -713,16 +713,16 @@ void lv_disp_set_rotation(lv_disp_t * disp, lv_disp_rotation_t rotation, bool sw
update_resolution(disp); update_resolution(disp);
} }
lv_disp_rotation_t lv_disp_get_rotation(lv_disp_t * disp) lv_display_rotation_t lv_display_get_rotation(lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
if(disp == NULL) return LV_DISP_ROTATION_0; if(disp == NULL) return LV_DISPLAY_ROTATION_0;
return disp->rotation; return disp->rotation;
} }
void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th) void lv_display_set_theme(lv_display_t * disp, lv_theme_t * th)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("no display registered"); LV_LOG_WARN("no display registered");
return; return;
@@ -738,42 +738,42 @@ void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th)
} }
} }
lv_theme_t * lv_disp_get_theme(lv_disp_t * disp) lv_theme_t * lv_display_get_theme(lv_display_t * disp)
{ {
if(disp == NULL) disp = lv_disp_get_default(); if(disp == NULL) disp = lv_display_get_default();
return disp->theme; return disp->theme;
} }
uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp) uint32_t lv_display_get_inactive_time(const lv_display_t * disp)
{ {
if(disp) return lv_tick_elaps(disp->last_activity_time); if(disp) return lv_tick_elaps(disp->last_activity_time);
lv_disp_t * d; lv_display_t * d;
uint32_t t = UINT32_MAX; uint32_t t = UINT32_MAX;
d = lv_disp_get_next(NULL); d = lv_display_get_next(NULL);
while(d) { while(d) {
uint32_t elaps = lv_tick_elaps(d->last_activity_time); uint32_t elaps = lv_tick_elaps(d->last_activity_time);
t = LV_MIN(t, elaps); t = LV_MIN(t, elaps);
d = lv_disp_get_next(d); d = lv_display_get_next(d);
} }
return t; return t;
} }
void lv_disp_trig_activity(lv_disp_t * disp) void lv_display_trig_activity(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("lv_disp_trig_activity: no display registered"); LV_LOG_WARN("lv_display_trig_activity: no display registered");
return; return;
} }
disp->last_activity_time = lv_tick_get(); disp->last_activity_time = lv_tick_get();
} }
void lv_disp_enable_invalidation(lv_disp_t * disp, bool en) void lv_display_enable_invalidation(lv_display_t * disp, bool en)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("no display registered"); LV_LOG_WARN("no display registered");
return; return;
@@ -782,9 +782,9 @@ void lv_disp_enable_invalidation(lv_disp_t * disp, bool en)
disp->inv_en_cnt += en ? 1 : -1; disp->inv_en_cnt += en ? 1 : -1;
} }
bool lv_disp_is_invalidation_enabled(lv_disp_t * disp) bool lv_display_is_invalidation_enabled(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) { if(!disp) {
LV_LOG_WARN("no display registered"); LV_LOG_WARN("no display registered");
return false; return false;
@@ -793,39 +793,39 @@ bool lv_disp_is_invalidation_enabled(lv_disp_t * disp)
return (disp->inv_en_cnt > 0); return (disp->inv_en_cnt > 0);
} }
lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp) lv_timer_t * _lv_display_get_refr_timer(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) return NULL; if(!disp) return NULL;
return disp->refr_timer; return disp->refr_timer;
} }
void lv_disp_set_user_data(lv_disp_t * disp, void * user_data) void lv_display_set_user_data(lv_display_t * disp, void * user_data)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) return; if(!disp) return;
disp->user_data = user_data; disp->user_data = user_data;
} }
void lv_disp_set_driver_data(lv_disp_t * disp, void * driver_data) void lv_display_set_driver_data(lv_display_t * disp, void * driver_data)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) return; if(!disp) return;
disp->driver_data = driver_data; disp->driver_data = driver_data;
} }
void * lv_disp_get_user_data(lv_disp_t * disp) void * lv_display_get_user_data(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) return NULL; if(!disp) return NULL;
return disp->user_data; return disp->user_data;
} }
void * lv_disp_get_driver_data(lv_disp_t * disp) void * lv_display_get_driver_data(lv_display_t * disp)
{ {
if(!disp) disp = lv_disp_get_default(); if(!disp) disp = lv_display_get_default();
if(!disp) return NULL; if(!disp) return NULL;
return disp->driver_data; return disp->driver_data;
@@ -835,10 +835,10 @@ void * lv_disp_get_driver_data(lv_disp_t * disp)
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static void update_resolution(lv_disp_t * disp) static void update_resolution(lv_display_t * disp)
{ {
lv_coord_t hor_res = lv_disp_get_hor_res(disp); lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp);
lv_coord_t ver_res = lv_disp_get_ver_res(disp); lv_coord_t ver_res = lv_display_get_vertical_resolution(disp);
lv_area_t prev_coords; lv_area_t prev_coords;
lv_obj_get_coords(disp->sys_layer, &prev_coords); lv_obj_get_coords(disp->sys_layer, &prev_coords);
@@ -868,7 +868,7 @@ static void update_resolution(lv_disp_t * disp)
lv_obj_tree_walk(NULL, invalidate_layout_cb, NULL); lv_obj_tree_walk(NULL, invalidate_layout_cb, NULL);
lv_disp_send_event(disp, LV_EVENT_RESOLUTION_CHANGED, NULL); lv_display_send_event(disp, LV_EVENT_RESOLUTION_CHANGED, NULL);
} }
static lv_obj_tree_walk_res_t invalidate_layout_cb(lv_obj_t * obj, void * user_data) static lv_obj_tree_walk_res_t invalidate_layout_cb(lv_obj_t * obj, void * user_data)
@@ -880,7 +880,7 @@ static lv_obj_tree_walk_res_t invalidate_layout_cb(lv_obj_t * obj, void * user_d
static void scr_load_internal(lv_obj_t * scr) static void scr_load_internal(lv_obj_t * scr)
{ {
lv_disp_t * d = lv_obj_get_disp(scr); lv_display_t * d = lv_obj_get_disp(scr);
if(!d) return; /*Shouldn't happen, just to be sure*/ if(!d) return; /*Shouldn't happen, just to be sure*/
lv_obj_t * old_scr = d->act_scr; lv_obj_t * old_scr = d->act_scr;
@@ -898,7 +898,7 @@ static void scr_load_internal(lv_obj_t * scr)
static void scr_load_anim_start(lv_anim_t * a) static void scr_load_anim_start(lv_anim_t * a)
{ {
lv_disp_t * d = lv_obj_get_disp(a->var); lv_display_t * d = lv_obj_get_disp(a->var);
d->prev_scr = lv_scr_act(); d->prev_scr = lv_scr_act();
d->act_scr = a->var; d->act_scr = a->var;
@@ -923,7 +923,7 @@ static void set_y_anim(void * obj, int32_t v)
static void scr_anim_ready(lv_anim_t * a) static void scr_anim_ready(lv_anim_t * a)
{ {
lv_disp_t * d = lv_obj_get_disp(a->var); lv_display_t * d = lv_obj_get_disp(a->var);
lv_obj_send_event(d->act_scr, LV_EVENT_SCREEN_LOADED, NULL); lv_obj_send_event(d->act_scr, LV_EVENT_SCREEN_LOADED, NULL);
lv_obj_send_event(d->prev_scr, LV_EVENT_SCREEN_UNLOADED, NULL); lv_obj_send_event(d->prev_scr, LV_EVENT_SCREEN_UNLOADED, NULL);
@@ -948,7 +948,7 @@ static bool is_out_anim(lv_scr_load_anim_t anim_type)
static void disp_event_cb(lv_event_t * e) static void disp_event_cb(lv_event_t * e)
{ {
lv_event_code_t code = lv_event_get_code(e); lv_event_code_t code = lv_event_get_code(e);
lv_disp_t * disp = lv_event_get_target(e); lv_display_t * disp = lv_event_get_target(e);
switch(code) { switch(code) {
case LV_EVENT_REFR_REQUEST: case LV_EVENT_REFR_REQUEST:
if(disp->refr_timer) lv_timer_resume(disp->refr_timer); if(disp->refr_timer) lv_timer_resume(disp->refr_timer);

View File

@@ -3,8 +3,8 @@
* *
*/ */
#ifndef LV_DISP_H #ifndef LV_DISPLAY_H
#define LV_DISP_H #define LV_DISPLAY_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -32,36 +32,36 @@ extern "C" {
struct _lv_obj_t; struct _lv_obj_t;
struct _lv_theme_t; struct _lv_theme_t;
struct _lv_disp_t; struct _lv_display_t;
typedef struct _lv_disp_t lv_disp_t; typedef struct _lv_display_t lv_display_t;
typedef enum { typedef enum {
LV_DISP_ROTATION_0 = 0, LV_DISPLAY_ROTATION_0 = 0,
LV_DISP_ROTATION_90, LV_DISPLAY_ROTATION_90,
LV_DISP_ROTATION_180, LV_DISPLAY_ROTATION_180,
LV_DISP_ROTATION_270 LV_DISPLAY_ROTATION_270
} lv_disp_rotation_t; } lv_display_rotation_t;
typedef enum { typedef enum {
/** /**
* Use the buffer(s) to render the screen is smaller parts. * Use the buffer(s) to render the screen is smaller parts.
* This way the buffers can be smaller then the display to save RAM. At least 1/10 screen size buffer(s) are recommended. * This way the buffers can be smaller then the display to save RAM. At least 1/10 screen size buffer(s) are recommended.
*/ */
LV_DISP_RENDER_MODE_PARTIAL, LV_DISPLAY_RENDER_MODE_PARTIAL,
/** /**
* The buffer(s) has to be screen sized and LVGL will render into the correct location of the buffer. * The buffer(s) has to be screen sized and LVGL will render into the correct location of the buffer.
* This way the buffer always contain the whole image. Only the changed ares will be updated. * This way the buffer always contain the whole image. Only the changed ares will be updated.
* With 2 buffers the buffers' content are kept in sync automatically and in flush_cb only address change is required. * With 2 buffers the buffers' content are kept in sync automatically and in flush_cb only address change is required.
*/ */
LV_DISP_RENDER_MODE_DIRECT, LV_DISPLAY_RENDER_MODE_DIRECT,
/** /**
* Always redraw the whole screen even if only one pixel has been changed. * Always redraw the whole screen even if only one pixel has been changed.
* With 2 buffers in flush_cb only and address change is required. * With 2 buffers in flush_cb only and address change is required.
*/ */
LV_DISP_RENDER_MODE_FULL, LV_DISPLAY_RENDER_MODE_FULL,
} lv_disp_render_mode_t; } lv_display_render_mode_t;
typedef enum { typedef enum {
@@ -84,7 +84,7 @@ typedef enum {
} lv_scr_load_anim_t; } lv_scr_load_anim_t;
typedef void (*lv_disp_flush_cb_t)(struct _lv_disp_t * disp, const lv_area_t * area, uint8_t * px_map); typedef void (*lv_display_flush_cb_t)(struct _lv_display_t * disp, const lv_area_t * area, uint8_t * px_map);
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
@@ -96,32 +96,32 @@ typedef void (*lv_disp_flush_cb_t)(struct _lv_disp_t * disp, const lv_area_t * a
* @param ver_res vertical resolution in pixels * @param ver_res vertical resolution in pixels
* @return pointer to a display object or `NULL` on error * @return pointer to a display object or `NULL` on error
*/ */
lv_disp_t * lv_disp_create(lv_coord_t hor_res, lv_coord_t ver_res); lv_display_t * lv_display_create(lv_coord_t hor_res, lv_coord_t ver_res);
/** /**
* Remove a display * Remove a display
* @param disp pointer to display * @param disp pointer to display
*/ */
void lv_disp_remove(lv_disp_t * disp); void lv_display_remove(lv_display_t * disp);
/** /**
* Set a default display. The new screens will be created on it by default. * Set a default display. The new screens will be created on it by default.
* @param disp pointer to a display * @param disp pointer to a display
*/ */
void lv_disp_set_default(lv_disp_t * disp); void lv_display_set_default(lv_display_t * disp);
/** /**
* Get the default display * Get the default display
* @return pointer to the default display * @return pointer to the default display
*/ */
lv_disp_t * lv_disp_get_default(void); lv_display_t * lv_display_get_default(void);
/** /**
* Get the next display. * Get the next display.
* @param disp pointer to the current display. NULL to initialize. * @param disp pointer to the current display. NULL to initialize.
* @return the next display or NULL if no more. Gives the first display when the parameter is NULL. * @return the next display or NULL if no more. Gives the first display when the parameter is NULL.
*/ */
lv_disp_t * lv_disp_get_next(lv_disp_t * disp); lv_display_t * lv_display_get_next(lv_display_t * disp);
/*--------------------- /*---------------------
* RESOLUTION * RESOLUTION
@@ -130,12 +130,12 @@ lv_disp_t * lv_disp_get_next(lv_disp_t * disp);
/** /**
* Sets the resolution of a display. `LV_EVENT_RESOLUTION_CHANGED` event will be sent. * Sets the resolution of a display. `LV_EVENT_RESOLUTION_CHANGED` event will be sent.
* Here the native resolution of the device should be set. If the display will be rotated later with * Here the native resolution of the device should be set. If the display will be rotated later with
* `lv_disp_set_rotation` LVGL will swap the hor. and ver. resolution automatically. * `lv_display_set_rotation` LVGL will swap the hor. and ver. resolution automatically.
* @param disp pointer to a display * @param disp pointer to a display
* @param hor_res the new horizontal resolution * @param hor_res the new horizontal resolution
* @param ver_res the new vertical resolution * @param ver_res the new vertical resolution
*/ */
void lv_disp_set_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t ver_res); void lv_display_set_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res);
/** /**
* It's not mandatory to use the whole display for LVGL, however in some cases physical resolution is important. * It's not mandatory to use the whole display for LVGL, however in some cases physical resolution is important.
@@ -145,7 +145,7 @@ void lv_disp_set_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t ver_res);
* @param hor_res the new physical horizontal resolution, or -1 to assume it's the same as the normal hor. res. * @param hor_res the new physical horizontal resolution, or -1 to assume it's the same as the normal hor. res.
* @param ver_res the new physical vertical resolution, or -1 to assume it's the same as the normal hor. res. * @param ver_res the new physical vertical resolution, or -1 to assume it's the same as the normal hor. res.
*/ */
void lv_disp_set_physical_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t ver_res); void lv_display_set_physical_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res);
/** /**
* If physical resolution is not the same as the normal resolution * If physical resolution is not the same as the normal resolution
@@ -154,16 +154,16 @@ void lv_disp_set_physical_res(lv_disp_t * disp, lv_coord_t hor_res, lv_coord_t v
* @param x X offset * @param x X offset
* @param y Y offset * @param y Y offset
*/ */
void lv_disp_set_offset(lv_disp_t * disp, lv_coord_t x, lv_coord_t y); void lv_display_set_offset(lv_display_t * disp, lv_coord_t x, lv_coord_t y);
/** /**
* Set the rotation of this display. LVGL will swap the horizontal and vertical resolutions internally. * Set the rotation of this display. LVGL will swap the horizontal and vertical resolutions internally.
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @param rotation `LV_DISP_ROTATION_0/90/180/270` * @param rotation `LV_DISPLAY_ROTATION_0/90/180/270`
* @param sw_rotate true: make LVGL rotate the rendered image; * @param sw_rotate true: make LVGL rotate the rendered image;
* false: the display driver should rotate the rendered image * false: the display driver should rotate the rendered image
*/ */
void lv_disp_set_rotation(lv_disp_t * disp, lv_disp_rotation_t rotation, bool sw_rotate); void lv_display_set_rotation(lv_display_t * disp, lv_display_rotation_t rotation, bool sw_rotate);
/** /**
* Set the DPI (dot per inch) of the display. * Set the DPI (dot per inch) of the display.
@@ -171,63 +171,63 @@ void lv_disp_set_rotation(lv_disp_t * disp, lv_disp_rotation_t rotation, bool sw
* @param disp pointer to a display * @param disp pointer to a display
* @param dpi the new DPI * @param dpi the new DPI
*/ */
void lv_disp_set_dpi(lv_disp_t * disp, lv_coord_t dpi); void lv_display_set_dpi(lv_display_t * disp, lv_coord_t dpi);
/** /**
* Get the horizontal resolution of a display. * Get the horizontal resolution of a display.
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the horizontal resolution of the display. * @return the horizontal resolution of the display.
*/ */
lv_coord_t lv_disp_get_hor_res(const lv_disp_t * disp); lv_coord_t lv_display_get_horizontal_resolution(const lv_display_t * disp);
/** /**
* Get the vertical resolution of a display * Get the vertical resolution of a display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the vertical resolution of the display * @return the vertical resolution of the display
*/ */
lv_coord_t lv_disp_get_ver_res(const lv_disp_t * disp); lv_coord_t lv_display_get_vertical_resolution(const lv_display_t * disp);
/** /**
* Get the physical horizontal resolution of a display * Get the physical horizontal resolution of a display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the physical horizontal resolution of the display * @return the physical horizontal resolution of the display
*/ */
lv_coord_t lv_disp_get_physical_hor_res(const lv_disp_t * disp); lv_coord_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp);
/** /**
* Get the physical vertical resolution of a display * Get the physical vertical resolution of a display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the physical vertical resolution of the display * @return the physical vertical resolution of the display
*/ */
lv_coord_t lv_disp_get_physical_ver_res(const lv_disp_t * disp); lv_coord_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp);
/** /**
* Get the horizontal offset from the full / physical display * Get the horizontal offset from the full / physical display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the horizontal offset from the physical display * @return the horizontal offset from the physical display
*/ */
lv_coord_t lv_disp_get_offset_x(const lv_disp_t * disp); lv_coord_t lv_display_get_offset_x(const lv_display_t * disp);
/** /**
* Get the vertical offset from the full / physical display * Get the vertical offset from the full / physical display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the horizontal offset from the physical display * @return the horizontal offset from the physical display
*/ */
lv_coord_t lv_disp_get_offset_y(const lv_disp_t * disp); lv_coord_t lv_display_get_offset_y(const lv_display_t * disp);
/** /**
* Get the current rotation of this display. * Get the current rotation of this display.
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return the current rotation * @return the current rotation
*/ */
lv_disp_rotation_t lv_disp_get_rotation(lv_disp_t * disp); lv_display_rotation_t lv_display_get_rotation(lv_display_t * disp);
/** /**
* Get the DPI of the display * Get the DPI of the display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return dpi of the display * @return dpi of the display
*/ */
lv_coord_t lv_disp_get_dpi(const lv_disp_t * disp); lv_coord_t lv_display_get_dpi(const lv_display_t * disp);
/*--------------------- /*---------------------
* BUFFERING * BUFFERING
@@ -238,17 +238,17 @@ lv_coord_t lv_disp_get_dpi(const lv_disp_t * disp);
* @param disp pointer to a display * @param disp pointer to a display
* @param buf1 first buffer * @param buf1 first buffer
* @param buf2 second buffer (can be `NULL`) * @param buf2 second buffer (can be `NULL`)
* @param render_mode LV_DISP_RENDER_MODE_PARTIAL/DIRECT/FULL * @param render_mode LV_DISPLAY_RENDER_MODE_PARTIAL/DIRECT/FULL
*/ */
void lv_disp_set_draw_buffers(lv_disp_t * disp, void * buf1, void * buf2, uint32_t buf_size_in_bytes, void lv_display_set_draw_buffers(lv_display_t * disp, void * buf1, void * buf2, uint32_t buf_size_in_bytes,
lv_disp_render_mode_t render_mode); lv_display_render_mode_t render_mode);
/** /**
* Set the flush callback which will be called to copy the rendered image to the display. * Set the flush callback which will be called to copy the rendered image to the display.
* @param disp pointer to a display * @param disp pointer to a display
* @param flush_cb the flush callback (`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display) * @param flush_cb the flush callback (`px_map` contains the rendered image as raw pixel map and it should be copied to `area` on the display)
*/ */
void lv_disp_set_flush_cb(lv_disp_t * disp, lv_disp_flush_cb_t flush_cb); void lv_display_set_flush_cb(lv_display_t * disp, lv_display_flush_cb_t flush_cb);
/** /**
* Set the color format of the display. * Set the color format of the display.
* If set to other than `LV_COLOR_FORMAT_NATIVE` the layer's `buffer_convert` function will be used * If set to other than `LV_COLOR_FORMAT_NATIVE` the layer's `buffer_convert` function will be used
@@ -258,28 +258,28 @@ void lv_disp_set_flush_cb(lv_disp_t * disp, lv_disp_flush_cb_t flush_cb);
* `LV_COLOR_FORMAT_NATIVE_REVERSE` to change endianness. * `LV_COLOR_FORMAT_NATIVE_REVERSE` to change endianness.
* *
*/ */
void lv_disp_set_color_format(lv_disp_t * disp, lv_color_format_t color_format); void lv_display_set_color_format(lv_display_t * disp, lv_color_format_t color_format);
/** /**
* Get the color format of the display * Get the color format of the display
* @param disp pointer to a display * @param disp pointer to a display
* @return the color format * @return the color format
*/ */
lv_color_format_t lv_disp_get_color_format(lv_disp_t * disp); lv_color_format_t lv_display_get_color_format(lv_display_t * disp);
/** /**
* Enable anti-aliasing for the render engine * Enable anti-aliasing for the render engine
* @param disp pointer to a display * @param disp pointer to a display
* @param en true/false * @param en true/false
*/ */
void lv_disp_set_antialiasing(lv_disp_t * disp, bool en); void lv_display_set_antialiasing(lv_display_t * disp, bool en);
/** /**
* Get if anti-aliasing is enabled for a display or not * Get if anti-aliasing is enabled for a display or not
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return true/false * @return true/false
*/ */
bool lv_disp_get_antialiasing(lv_disp_t * disp); bool lv_display_get_antialiasing(lv_display_t * disp);
//! @cond Doxygen_Suppress //! @cond Doxygen_Suppress
@@ -288,7 +288,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp);
* Call from the display driver when the flushing is finished * Call from the display driver when the flushing is finished
* @param disp pointer to display whose `flush_cb` was called * @param disp pointer to display whose `flush_cb` was called
*/ */
LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_t * disp); LV_ATTRIBUTE_FLUSH_READY void lv_display_flush_ready(lv_display_t * disp);
/** /**
* Tell if it's the last area of the refreshing process. * Tell if it's the last area of the refreshing process.
@@ -297,12 +297,12 @@ LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_t * disp);
* @return true: it's the last area to flush; * @return true: it's the last area to flush;
* false: there are other areas too which will be refreshed soon * false: there are other areas too which will be refreshed soon
*/ */
LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_t * disp); LV_ATTRIBUTE_FLUSH_READY bool lv_display_flush_is_last(lv_display_t * disp);
//! @endcond //! @endcond
bool lv_disp_is_double_buffered(lv_disp_t * disp); bool lv_display_is_double_buffered(lv_display_t * disp);
/*--------------------- /*---------------------
* SCREENS * SCREENS
@@ -314,7 +314,7 @@ bool lv_disp_is_double_buffered(lv_disp_t * disp);
* (NULL to use the default screen) * (NULL to use the default screen)
* @return pointer to the active screen object (loaded by 'lv_scr_load()') * @return pointer to the active screen object (loaded by 'lv_scr_load()')
*/ */
struct _lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp); struct _lv_obj_t * lv_display_get_scr_act(lv_display_t * disp);
/** /**
* Return with a pointer to the previous screen. Only used during screen transitions. * Return with a pointer to the previous screen. Only used during screen transitions.
@@ -322,27 +322,27 @@ struct _lv_obj_t * lv_disp_get_scr_act(lv_disp_t * disp);
* (NULL to use the default screen) * (NULL to use the default screen)
* @return pointer to the previous screen object or NULL if not used now * @return pointer to the previous screen object or NULL if not used now
*/ */
struct _lv_obj_t * lv_disp_get_scr_prev(lv_disp_t * disp); struct _lv_obj_t * lv_display_get_scr_prev(lv_display_t * disp);
/** /**
* Make a screen active * Make a screen active
* @param scr pointer to a screen * @param scr pointer to a screen
*/ */
void lv_disp_load_scr(struct _lv_obj_t * scr); void lv_display_load_scr(struct _lv_obj_t * scr);
/** /**
* Return the top layer. The top layer is the same on all screens and it is above the normal screen layer. * Return the top layer. The top layer is the same on all screens and it is above the normal screen layer.
* @param disp pointer to display which top layer should be get. (NULL to use the default screen) * @param disp pointer to display which top layer should be get. (NULL to use the default screen)
* @return pointer to the top layer object * @return pointer to the top layer object
*/ */
struct _lv_obj_t * lv_disp_get_layer_top(lv_disp_t * disp); struct _lv_obj_t * lv_display_get_layer_top(lv_display_t * disp);
/** /**
* Return the sys. layer. The system layer is the same on all screen and it is above the normal screen and the top layer. * Return the sys. layer. The system layer is the same on all screen and it is above the normal screen and the top layer.
* @param disp pointer to display which sys. layer should be retrieved. (NULL to use the default screen) * @param disp pointer to display which sys. layer should be retrieved. (NULL to use the default screen)
* @return pointer to the sys layer object * @return pointer to the sys layer object
*/ */
struct _lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp); struct _lv_obj_t * lv_display_get_layer_sys(lv_display_t * disp);
/** /**
@@ -351,7 +351,7 @@ struct _lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp);
* @param disp pointer to display (NULL to use the default screen) * @param disp pointer to display (NULL to use the default screen)
* @return pointer to the bottom layer object * @return pointer to the bottom layer object
*/ */
struct _lv_obj_t * lv_disp_get_layer_bottom(lv_disp_t * disp); struct _lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp);
/** /**
@@ -371,7 +371,7 @@ void lv_scr_load_anim(struct _lv_obj_t * scr, lv_scr_load_anim_t anim_type, uint
*/ */
static inline struct _lv_obj_t * lv_scr_act(void) static inline struct _lv_obj_t * lv_scr_act(void)
{ {
return lv_disp_get_scr_act(lv_disp_get_default()); return lv_display_get_scr_act(lv_display_get_default());
} }
/** /**
@@ -380,7 +380,7 @@ static inline struct _lv_obj_t * lv_scr_act(void)
*/ */
static inline struct _lv_obj_t * lv_layer_top(void) static inline struct _lv_obj_t * lv_layer_top(void)
{ {
return lv_disp_get_layer_top(lv_disp_get_default()); return lv_display_get_layer_top(lv_display_get_default());
} }
/** /**
@@ -389,7 +389,7 @@ static inline struct _lv_obj_t * lv_layer_top(void)
*/ */
static inline struct _lv_obj_t * lv_layer_sys(void) static inline struct _lv_obj_t * lv_layer_sys(void)
{ {
return lv_disp_get_layer_sys(lv_disp_get_default()); return lv_display_get_layer_sys(lv_display_get_default());
} }
/** /**
@@ -398,7 +398,7 @@ static inline struct _lv_obj_t * lv_layer_sys(void)
*/ */
static inline struct _lv_obj_t * lv_layer_bottom(void) static inline struct _lv_obj_t * lv_layer_bottom(void)
{ {
return lv_disp_get_layer_bottom(lv_disp_get_default()); return lv_display_get_layer_bottom(lv_display_get_default());
} }
/** /**
@@ -407,7 +407,7 @@ static inline struct _lv_obj_t * lv_layer_bottom(void)
*/ */
static inline void lv_scr_load(struct _lv_obj_t * scr) static inline void lv_scr_load(struct _lv_obj_t * scr)
{ {
lv_disp_load_scr(scr); lv_display_load_scr(scr);
} }
@@ -422,63 +422,63 @@ static inline void lv_scr_load(struct _lv_obj_t * scr)
* @param filter event code to react or `LV_EVENT_ALL` * @param filter event code to react or `LV_EVENT_ALL`
* @param user_data optional user_data * @param user_data optional user_data
*/ */
void lv_disp_add_event(lv_disp_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data); void lv_display_add_event(lv_display_t * disp, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);
uint32_t lv_disp_get_event_count(lv_disp_t * disp); uint32_t lv_display_get_event_count(lv_display_t * disp);
lv_event_dsc_t * lv_disp_get_event_dsc(lv_disp_t * disp, uint32_t index); lv_event_dsc_t * lv_display_get_event_dsc(lv_display_t * disp, uint32_t index);
bool lv_disp_remove_event(lv_disp_t * disp, uint32_t index); bool lv_display_remove_event(lv_display_t * disp, uint32_t index);
/** /**
* Send amn event to a display * Send amn event to a display
* @param disp pointer to a display * @param disp pointer to a display
* @param code an event code. LV_EVENT_... * @param code an event code. LV_EVENT_...
* @param param optional param * @param param optional param
* @return LV_RES_OK: disp wasn't deleted in the event. * @return LV_RESULT_OK: disp wasn't deleted in the event.
*/ */
lv_res_t lv_disp_send_event(lv_disp_t * disp, lv_event_code_t code, void * param); lv_result_t lv_display_send_event(lv_display_t * disp, lv_event_code_t code, void * param);
/** /**
* Set the theme of a display. If there are no user created widgets yet the screens' theme will be updated * Set the theme of a display. If there are no user created widgets yet the screens' theme will be updated
* @param disp pointer to a display * @param disp pointer to a display
* @param th pointer to a theme * @param th pointer to a theme
*/ */
void lv_disp_set_theme(lv_disp_t * disp, struct _lv_theme_t * th); void lv_display_set_theme(lv_display_t * disp, struct _lv_theme_t * th);
/** /**
* Get the theme of a display * Get the theme of a display
* @param disp pointer to a display * @param disp pointer to a display
* @return the display's theme (can be NULL) * @return the display's theme (can be NULL)
*/ */
struct _lv_theme_t * lv_disp_get_theme(lv_disp_t * disp); struct _lv_theme_t * lv_display_get_theme(lv_display_t * disp);
/** /**
* Get elapsed time since last user activity on a display (e.g. click) * Get elapsed time since last user activity on a display (e.g. click)
* @param disp pointer to a display (NULL to get the overall smallest inactivity) * @param disp pointer to a display (NULL to get the overall smallest inactivity)
* @return elapsed ticks (milliseconds) since the last activity * @return elapsed ticks (milliseconds) since the last activity
*/ */
uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp); uint32_t lv_display_get_inactive_time(const lv_display_t * disp);
/** /**
* Manually trigger an activity on a display * Manually trigger an activity on a display
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
*/ */
void lv_disp_trig_activity(lv_disp_t * disp); void lv_display_trig_activity(lv_display_t * disp);
/** /**
* Temporarily enable and disable the invalidation of the display. * Temporarily enable and disable the invalidation of the display.
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @param en true: enable invalidation; false: invalidation * @param en true: enable invalidation; false: invalidation
*/ */
void lv_disp_enable_invalidation(lv_disp_t * disp, bool en); void lv_display_enable_invalidation(lv_display_t * disp, bool en);
/** /**
* Get display invalidation is enabled. * Get display invalidation is enabled.
* @param disp pointer to a display (NULL to use the default display) * @param disp pointer to a display (NULL to use the default display)
* @return return true if invalidation is enabled * @return return true if invalidation is enabled
*/ */
bool lv_disp_is_invalidation_enabled(lv_disp_t * disp); bool lv_display_is_invalidation_enabled(lv_display_t * disp);
/** /**
* Get a pointer to the screen refresher timer to * Get a pointer to the screen refresher timer to
@@ -486,12 +486,12 @@ bool lv_disp_is_invalidation_enabled(lv_disp_t * disp);
* @param disp pointer to a display * @param disp pointer to a display
* @return pointer to the display refresher timer. (NULL on error) * @return pointer to the display refresher timer. (NULL on error)
*/ */
lv_timer_t * _lv_disp_get_refr_timer(lv_disp_t * disp); lv_timer_t * _lv_display_get_refr_timer(lv_display_t * disp);
void lv_disp_set_user_data(lv_disp_t * disp, void * user_data); void lv_display_set_user_data(lv_display_t * disp, void * user_data);
void lv_disp_set_driver_data(lv_disp_t * disp, void * driver_data); void lv_display_set_driver_data(lv_display_t * disp, void * driver_data);
void * lv_disp_get_user_data(lv_disp_t * disp); void * lv_display_get_user_data(lv_display_t * disp);
void * lv_disp_get_driver_data(lv_disp_t * disp); void * lv_display_get_driver_data(lv_display_t * disp);
/********************** /**********************
* MACROS * MACROS
@@ -506,14 +506,14 @@ void * lv_disp_get_driver_data(lv_disp_t * disp);
/** /**
* The horizontal resolution of the currently active display. * The horizontal resolution of the currently active display.
*/ */
#define LV_HOR_RES lv_disp_get_hor_res(lv_disp_get_default()) #define LV_HOR_RES lv_display_get_horizontal_resolution(lv_display_get_default())
#endif #endif
#ifndef LV_VER_RES #ifndef LV_VER_RES
/** /**
* The vertical resolution of the currently active display. * The vertical resolution of the currently active display.
*/ */
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default()) #define LV_VER_RES lv_display_get_vertical_resolution(lv_display_get_default())
#endif #endif
@@ -524,7 +524,7 @@ void * lv_disp_get_driver_data(lv_disp_t * disp);
* https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp * https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
*/ */
#define _LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/ #define _LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/
#define LV_DPX(n) _LV_DPX_CALC(lv_disp_get_dpi(NULL), n) #define LV_DPX(n) _LV_DPX_CALC(lv_display_get_dpi(NULL), n)
/** /**
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display * Scale the given number of pixels (a distance or size) relative to a 160 DPI display
@@ -548,9 +548,9 @@ static inline lv_coord_t lv_dpx(lv_coord_t n)
* @param n the number of pixels to scale * @param n the number of pixels to scale
* @return `n x current_dpi/160` * @return `n x current_dpi/160`
*/ */
static inline lv_coord_t lv_disp_dpx(const lv_disp_t * disp, lv_coord_t n) static inline lv_coord_t lv_display_dpx(const lv_display_t * disp, lv_coord_t n)
{ {
return _LV_DPX_CALC(lv_disp_get_dpi(disp), n); return _LV_DPX_CALC(lv_display_get_dpi(disp), n);
} }
@@ -558,4 +558,4 @@ static inline lv_coord_t lv_disp_dpx(const lv_disp_t * disp, lv_coord_t n)
} /*extern "C"*/ } /*extern "C"*/
#endif #endif
#endif /*LV_DISP_H*/ #endif /*LV_DISPLAY_H*/

View File

@@ -1,10 +1,10 @@
/** /**
* @file lv_disp_private.h * @file lv_display_private.h
* *
*/ */
#ifndef LV_DISP_PRIVATE_H #ifndef LV_DISPLAY_PRIVATE_H
#define LV_DISP_PRIVATE_H #define LV_DISPLAY_PRIVATE_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -15,7 +15,7 @@ extern "C" {
*********************/ *********************/
#include "../core/lv_obj.h" #include "../core/lv_obj.h"
#include "../draw/lv_draw.h" #include "../draw/lv_draw.h"
#include "lv_disp.h" #include "lv_display.h"
/********************* /*********************
* DEFINES * DEFINES
@@ -28,9 +28,9 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
struct _lv_disp_t; struct _lv_display_t;
struct _lv_disp_t { struct _lv_display_t {
/*--------------------- /*---------------------
* Resolution * Resolution
@@ -66,9 +66,9 @@ struct _lv_disp_t {
uint8_t * buf_act; uint8_t * buf_act;
uint32_t buf_size_in_bytes; uint32_t buf_size_in_bytes;
/** MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_disp_flush_ready()' has to be /** MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_display_flush_ready()' has to be
* called when finished*/ * called when finished*/
lv_disp_flush_cb_t flush_cb; lv_display_flush_cb_t flush_cb;
/*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/ /*1: flushing is in progress. (It can't be a bit field because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile int flushing; volatile int flushing;
@@ -78,7 +78,7 @@ struct _lv_disp_t {
volatile uint32_t last_area : 1; /*1: the last area is being rendered*/ volatile uint32_t last_area : 1; /*1: the last area is being rendered*/
volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/ volatile uint32_t last_part : 1; /*1: the last part of the current area is being rendered*/
lv_disp_render_mode_t render_mode; lv_display_render_mode_t render_mode;
uint32_t antialiasing : 1; /**< 1: anti-aliasing is enabled on this display.*/ uint32_t antialiasing : 1; /**< 1: anti-aliasing is enabled on this display.*/
/** 1: The current screen rendering is in progress*/ /** 1: The current screen rendering is in progress*/
@@ -96,8 +96,8 @@ struct _lv_disp_t {
* Layer * Layer
*--------------------*/ *--------------------*/
lv_layer_t * layer_head; lv_layer_t * layer_head;
void (*layer_init)(struct _lv_disp_t * disp, lv_layer_t * layer); void (*layer_init)(struct _lv_display_t * disp, lv_layer_t * layer);
void (*layer_deinit)(struct _lv_disp_t * disp, lv_layer_t * layer); void (*layer_deinit)(struct _lv_display_t * disp, lv_layer_t * layer);
/*--------------------- /*---------------------
* Screens * Screens
@@ -108,9 +108,9 @@ struct _lv_disp_t {
struct _lv_obj_t * act_scr; /**< Currently active screen on this display*/ struct _lv_obj_t * act_scr; /**< Currently active screen on this display*/
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations*/ struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations*/
struct _lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/ struct _lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/
struct _lv_obj_t * bottom_layer; /**< @see lv_disp_get_layer_bottom*/ struct _lv_obj_t * bottom_layer; /**< @see lv_display_get_layer_bottom*/
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top*/ struct _lv_obj_t * top_layer; /**< @see lv_display_get_layer_top*/
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys*/ struct _lv_obj_t * sys_layer; /**< @see lv_display_get_layer_sys*/
uint32_t screen_cnt; uint32_t screen_cnt;
uint8_t draw_prev_over_act : 1;/** 1: Draw previous screen over active screen*/ uint8_t draw_prev_over_act : 1;/** 1: Draw previous screen over active screen*/
uint8_t del_prev : 1; /** 1: Automatically delete the previous screen when the screen load animation is ready*/ uint8_t del_prev : 1; /** 1: Automatically delete the previous screen when the screen load animation is ready*/
@@ -126,7 +126,7 @@ struct _lv_disp_t {
lv_event_list_t event_list; lv_event_list_t event_list;
uint32_t sw_rotate : 1; /**< 1: use software rotation (slower)*/ uint32_t sw_rotate : 1; /**< 1: use software rotation (slower)*/
uint32_t rotation : 2; /**< Element of @lv_disp_rotation_t*/ uint32_t rotation : 2; /**< Element of @lv_display_rotation_t*/
/**< The theme assigned to the screen*/ /**< The theme assigned to the screen*/
struct _lv_theme_t * theme; struct _lv_theme_t * theme;
@@ -153,4 +153,4 @@ struct _lv_disp_t {
} /*extern "C"*/ } /*extern "C"*/
#endif #endif
#endif /*LV_DISP_PRIVATE_H*/ #endif /*LV_DISPLAY_PRIVATE_H*/

View File

@@ -8,7 +8,7 @@
*********************/ *********************/
#include "lv_draw.h" #include "lv_draw.h"
#include "sw/lv_draw_sw.h" #include "sw/lv_draw_sw.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
#include "../core/lv_refr.h" #include "../core/lv_refr.h"
#include "../stdlib/lv_string.h" #include "../stdlib/lv_string.h"
@@ -122,7 +122,7 @@ void lv_draw_dispatch(void)
{ {
LV_PROFILER_BEGIN; LV_PROFILER_BEGIN;
bool one_taken = false; bool one_taken = false;
lv_disp_t * disp = lv_disp_get_next(NULL); lv_display_t * disp = lv_display_get_next(NULL);
while(disp) { while(disp) {
lv_layer_t * layer = disp->layer_head; lv_layer_t * layer = disp->layer_head;
while(layer) { while(layer) {
@@ -134,12 +134,12 @@ void lv_draw_dispatch(void)
if(!one_taken) { if(!one_taken) {
lv_draw_dispatch_request(); lv_draw_dispatch_request();
} }
disp = lv_disp_get_next(disp); disp = lv_display_get_next(disp);
} }
LV_PROFILER_END; LV_PROFILER_END;
} }
bool lv_draw_dispatch_layer(struct _lv_disp_t * disp, lv_layer_t * layer) bool lv_draw_dispatch_layer(struct _lv_display_t * disp, lv_layer_t * layer)
{ {
/*Remove the finished tasks first*/ /*Remove the finished tasks first*/
lv_draw_task_t * t_prev = NULL; lv_draw_task_t * t_prev = NULL;
@@ -269,8 +269,8 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
LV_PROFILER_BEGIN; LV_PROFILER_BEGIN;
/*If the first task is screen sized, there cannot be independent areas*/ /*If the first task is screen sized, there cannot be independent areas*/
if(layer->draw_task_head) { if(layer->draw_task_head) {
lv_coord_t hor_res = lv_disp_get_hor_res(_lv_refr_get_disp_refreshing()); lv_coord_t hor_res = lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing());
lv_coord_t ver_res = lv_disp_get_ver_res(_lv_refr_get_disp_refreshing()); lv_coord_t ver_res = lv_display_get_vertical_resolution(_lv_refr_get_disp_refreshing());
lv_draw_task_t * t = layer->draw_task_head; lv_draw_task_t * t = layer->draw_task_head;
if(t->state != LV_DRAW_TASK_STATE_QUEUED && if(t->state != LV_DRAW_TASK_STATE_QUEUED &&
t->area.x1 <= 0 && t->area.x2 >= hor_res - 1 && t->area.x1 <= 0 && t->area.x2 >= hor_res - 1 &&
@@ -298,7 +298,7 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas
lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area) lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area)
{ {
lv_disp_t * disp = _lv_refr_get_disp_refreshing(); lv_display_t * disp = _lv_refr_get_disp_refreshing();
lv_layer_t * new_layer = lv_malloc(sizeof(lv_layer_t)); lv_layer_t * new_layer = lv_malloc(sizeof(lv_layer_t));
LV_ASSERT_MALLOC(new_layer); LV_ASSERT_MALLOC(new_layer);
if(new_layer == NULL) return NULL; if(new_layer == NULL) return NULL;

View File

@@ -16,7 +16,7 @@ extern "C" {
#include "../lv_conf_internal.h" #include "../lv_conf_internal.h"
#include "../misc/lv_style.h" #include "../misc/lv_style.h"
#include "../misc/lv_txt.h" #include "../misc/lv_text.h"
#include "../misc/lv_profiler.h" #include "../misc/lv_profiler.h"
#include "../misc/lv_cache.h" #include "../misc/lv_cache.h"
#include "lv_image_decoder.h" #include "lv_image_decoder.h"
@@ -33,7 +33,7 @@ extern "C" {
**********************/ **********************/
struct _lv_draw_image_dsc_t; struct _lv_draw_image_dsc_t;
struct _lv_disp_t; struct _lv_display_t;
typedef enum { typedef enum {
LV_DRAW_TASK_TYPE_FILL, LV_DRAW_TASK_TYPE_FILL,
@@ -196,7 +196,7 @@ void lv_draw_finalize_task_creation(lv_layer_t * layer, lv_draw_task_t * t);
void lv_draw_dispatch(void); void lv_draw_dispatch(void);
bool lv_draw_dispatch_layer(struct _lv_disp_t * disp, lv_layer_t * layer); bool lv_draw_dispatch_layer(struct _lv_display_t * disp, lv_layer_t * layer);
/** /**
* Wait for a new dispatch request. * Wait for a new dispatch request.

View File

@@ -7,7 +7,7 @@
* INCLUDES * INCLUDES
*********************/ *********************/
#include "lv_draw_image.h" #include "lv_draw_image.h"
#include "../disp/lv_disp.h" #include "../display/lv_display.h"
#include "../misc/lv_log.h" #include "../misc/lv_log.h"
#include "../misc/lv_math.h" #include "../misc/lv_math.h"
#include "../core/lv_refr.h" #include "../core/lv_refr.h"
@@ -43,7 +43,7 @@ void lv_draw_image_dsc_init(lv_draw_image_dsc_t * dsc)
lv_memzero(dsc, sizeof(lv_draw_image_dsc_t)); lv_memzero(dsc, sizeof(lv_draw_image_dsc_t));
dsc->recolor = lv_color_black(); dsc->recolor = lv_color_black();
dsc->opa = LV_OPA_COVER; dsc->opa = LV_OPA_COVER;
dsc->zoom = LV_ZOOM_NONE; dsc->zoom = LV_SCALE_NONE;
dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
} }
@@ -77,8 +77,8 @@ void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
lv_draw_image_dsc_t * new_image_dsc = lv_malloc(sizeof(*dsc)); lv_draw_image_dsc_t * new_image_dsc = lv_malloc(sizeof(*dsc));
lv_memcpy(new_image_dsc, dsc, sizeof(*dsc)); lv_memcpy(new_image_dsc, dsc, sizeof(*dsc));
lv_res_t res = lv_image_decoder_get_info(new_image_dsc->src, &new_image_dsc->header); lv_result_t res = lv_image_decoder_get_info(new_image_dsc->src, &new_image_dsc->header);
if(res != LV_RES_OK) { if(res != LV_RESULT_OK) {
LV_LOG_WARN("Couldn't get info about the image"); LV_LOG_WARN("Couldn't get info about the image");
lv_free(new_image_dsc); lv_free(new_image_dsc);
return; return;

View File

@@ -43,7 +43,7 @@ typedef struct _lv_draw_image_dsc_t {
lv_image_header_t header; lv_image_header_t header;
lv_coord_t angle; lv_coord_t rotation;
lv_coord_t zoom; lv_coord_t zoom;
lv_point_t pivot; lv_point_t pivot;

View File

@@ -146,7 +146,7 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la
else { else {
/*If EXPAND is enabled then not limit the text's width to the object's width*/ /*If EXPAND is enabled then not limit the text's width to the object's width*/
lv_point_t p; lv_point_t p;
lv_txt_get_size(&p, dsc->text, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX, lv_text_get_size(&p, dsc->text, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
dsc->flag); dsc->flag);
w = p.x; w = p.x;
} }
@@ -184,14 +184,14 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la
pos.y += dsc->hint->y; pos.y += dsc->hint->y;
} }
uint32_t line_end = line_start + _lv_txt_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, uint32_t line_end = line_start + _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL,
dsc->flag); dsc->flag);
/*Go the first visible line*/ /*Go the first visible line*/
while(pos.y + line_height_font < draw_unit->clip_area->y1) { while(pos.y + line_height_font < draw_unit->clip_area->y1) {
/*Go to next line*/ /*Go to next line*/
line_start = line_end; line_start = line_end;
line_end += _lv_txt_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag); line_end += _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
pos.y += line_height; pos.y += line_height;
/*Save at the threshold coordinate*/ /*Save at the threshold coordinate*/
@@ -206,14 +206,14 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la
/*Align to middle*/ /*Align to middle*/
if(align == LV_TEXT_ALIGN_CENTER) { if(align == LV_TEXT_ALIGN_CENTER) {
line_width = lv_txt_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space); line_width = lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space);
pos.x += (lv_area_get_width(coords) - line_width) / 2; pos.x += (lv_area_get_width(coords) - line_width) / 2;
} }
/*Align to the right*/ /*Align to the right*/
else if(align == LV_TEXT_ALIGN_RIGHT) { else if(align == LV_TEXT_ALIGN_RIGHT) {
line_width = lv_txt_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space); line_width = lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space);
pos.x += lv_area_get_width(coords) - line_width; pos.x += lv_area_get_width(coords) - line_width;
} }
@@ -259,17 +259,17 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la
uint32_t logical_char_pos = 0; uint32_t logical_char_pos = 0;
if(sel_start != 0xFFFF && sel_end != 0xFFFF) { if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI #if LV_USE_BIDI
logical_char_pos = _lv_txt_encoded_get_char_id(dsc->text, line_start); logical_char_pos = _lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = _lv_txt_encoded_get_char_id(bidi_txt, i); uint32_t t = _lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL); logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL);
#else #else
logical_char_pos = _lv_txt_encoded_get_char_id(dsc->text, line_start + i); logical_char_pos = _lv_text_encoded_get_char_id(dsc->text, line_start + i);
#endif #endif
} }
uint32_t letter; uint32_t letter;
uint32_t letter_next; uint32_t letter_next;
_lv_txt_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i); _lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i);
letter_w = lv_font_get_glyph_width(font, letter, letter_next); letter_w = lv_font_get_glyph_width(font, letter, letter_next);
@@ -327,20 +327,20 @@ void lv_draw_label_interate_letters(lv_draw_unit_t * draw_unit, const lv_draw_la
#endif #endif
/*Go to next line*/ /*Go to next line*/
line_start = line_end; line_start = line_end;
line_end += _lv_txt_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag); line_end += _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
pos.x = coords->x1; pos.x = coords->x1;
/*Align to middle*/ /*Align to middle*/
if(align == LV_TEXT_ALIGN_CENTER) { if(align == LV_TEXT_ALIGN_CENTER) {
line_width = line_width =
lv_txt_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space); lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space);
pos.x += (lv_area_get_width(coords) - line_width) / 2; pos.x += (lv_area_get_width(coords) - line_width) / 2;
} }
/*Align to the right*/ /*Align to the right*/
else if(align == LV_TEXT_ALIGN_RIGHT) { else if(align == LV_TEXT_ALIGN_RIGHT) {
line_width = line_width =
lv_txt_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space); lv_text_get_width(&dsc->text[line_start], line_end - line_start, font, dsc->letter_space);
pos.x += lv_area_get_width(coords) - line_width; pos.x += lv_area_get_width(coords) - line_width;
} }

View File

@@ -15,7 +15,7 @@ extern "C" {
*********************/ *********************/
#include "lv_draw.h" #include "lv_draw.h"
#include "../misc/lv_bidi.h" #include "../misc/lv_bidi.h"
#include "../misc/lv_txt.h" #include "../misc/lv_text.h"
#include "../misc/lv_color.h" #include "../misc/lv_color.h"
#include "../misc/lv_style.h" #include "../misc/lv_style.h"

View File

@@ -176,19 +176,19 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
lv_image_src_t src_type = lv_image_src_get_type(dsc->bg_image_src); lv_image_src_t src_type = lv_image_src_get_type(dsc->bg_image_src);
lv_res_t res = LV_RES_OK; lv_result_t res = LV_RESULT_OK;
lv_image_header_t header; lv_image_header_t header;
if(src_type == LV_IMAGE_SRC_VARIABLE || src_type == LV_IMAGE_SRC_FILE) { if(src_type == LV_IMAGE_SRC_VARIABLE || src_type == LV_IMAGE_SRC_FILE) {
res = lv_image_decoder_get_info(dsc->bg_image_src, &header); res = lv_image_decoder_get_info(dsc->bg_image_src, &header);
} }
else if(src_type == LV_IMAGE_SRC_UNKNOWN) { else if(src_type == LV_IMAGE_SRC_UNKNOWN) {
res = LV_RES_INV; res = LV_RESULT_INVALID;
} }
else { else {
lv_memzero(&header, sizeof(header)); lv_memzero(&header, sizeof(header));
} }
if(res == LV_RES_OK) { if(res == LV_RESULT_OK) {
lv_draw_bg_image_dsc_t * bg_image_dsc = lv_malloc(sizeof(lv_draw_bg_image_dsc_t)); lv_draw_bg_image_dsc_t * bg_image_dsc = lv_malloc(sizeof(lv_draw_bg_image_dsc_t));
t->draw_dsc = bg_image_dsc; t->draw_dsc = bg_image_dsc;
bg_image_dsc->base = dsc->base; bg_image_dsc->base = dsc->base;

View File

@@ -62,7 +62,7 @@ void lv_image_buf_free(lv_image_dsc_t * dsc)
void _lv_image_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, lv_coord_t angle, uint16_t zoom, void _lv_image_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, lv_coord_t angle, uint16_t zoom,
const lv_point_t * pivot) const lv_point_t * pivot)
{ {
if(angle == 0 && zoom == LV_ZOOM_NONE) { if(angle == 0 && zoom == LV_SCALE_NONE) {
res->x1 = 0; res->x1 = 0;
res->y1 = 0; res->y1 = 0;
res->x2 = w - 1; res->x2 = w - 1;

View File

@@ -32,7 +32,7 @@ typedef struct {
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_res_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, lv_coord_t x, static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, lv_coord_t x,
lv_coord_t y, lv_coord_t y,
lv_coord_t w_px, const uint8_t * in, lv_color32_t * out); lv_coord_t w_px, const uint8_t * in, lv_color32_t * out);
@@ -79,26 +79,26 @@ void _lv_image_decoder_init(void)
* Try the created image decoder one by one. Once one is able to get info that info will be used. * Try the created image decoder one by one. Once one is able to get info that info will be used.
* @param src the image source. E.g. file name or variable. * @param src the image source. E.g. file name or variable.
* @param header the image info will be stored here * @param header the image info will be stored here
* @return LV_RES_OK: success; LV_RES_INV: wasn't able to get info about the image * @return LV_RESULT_OK: success; LV_RESULT_INVALID: wasn't able to get info about the image
*/ */
lv_res_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header) lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header)
{ {
lv_memzero(header, sizeof(lv_image_header_t)); lv_memzero(header, sizeof(lv_image_header_t));
if(src == NULL) return LV_RES_INV; if(src == NULL) return LV_RESULT_INVALID;
lv_image_src_t src_type = lv_image_src_get_type(src); lv_image_src_t src_type = lv_image_src_get_type(src);
if(src_type == LV_IMAGE_SRC_VARIABLE) { if(src_type == LV_IMAGE_SRC_VARIABLE) {
const lv_image_dsc_t * img_dsc = src; const lv_image_dsc_t * img_dsc = src;
if(img_dsc->data == NULL) return LV_RES_INV; if(img_dsc->data == NULL) return LV_RESULT_INVALID;
} }
lv_res_t res = LV_RES_INV; lv_result_t res = LV_RESULT_INVALID;
lv_image_decoder_t * d; lv_image_decoder_t * d;
_LV_LL_READ(img_decoder_ll_p, d) { _LV_LL_READ(img_decoder_ll_p, d) {
if(d->info_cb) { if(d->info_cb) {
res = d->info_cb(d, src, header); res = d->info_cb(d, src, header);
if(res == LV_RES_OK) { if(res == LV_RESULT_OK) {
if(header->stride == 0) header->stride = img_width_to_stride(header); if(header->stride == 0) header->stride = img_width_to_stride(header);
break; break;
} }
@@ -108,15 +108,15 @@ lv_res_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header)
return res; return res;
} }
lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, lv_color_t color, int32_t frame_id) lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, lv_color_t color, int32_t frame_id)
{ {
lv_memzero(dsc, sizeof(lv_image_decoder_dsc_t)); lv_memzero(dsc, sizeof(lv_image_decoder_dsc_t));
if(src == NULL) return LV_RES_INV; if(src == NULL) return LV_RESULT_INVALID;
lv_image_src_t src_type = lv_image_src_get_type(src); lv_image_src_t src_type = lv_image_src_get_type(src);
if(src_type == LV_IMAGE_SRC_VARIABLE) { if(src_type == LV_IMAGE_SRC_VARIABLE) {
const lv_image_dsc_t * img_dsc = src; const lv_image_dsc_t * img_dsc = src;
if(img_dsc->data == NULL) return LV_RES_INV; if(img_dsc->data == NULL) return LV_RESULT_INVALID;
} }
dsc->color = color; dsc->color = color;
@@ -129,7 +129,7 @@ lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, l
LV_ASSERT_MALLOC(dsc->src); LV_ASSERT_MALLOC(dsc->src);
if(dsc->src == NULL) { if(dsc->src == NULL) {
LV_LOG_WARN("out of memory"); LV_LOG_WARN("out of memory");
return LV_RES_INV; return LV_RESULT_INVALID;
} }
lv_strcpy((char *)dsc->src, src); lv_strcpy((char *)dsc->src, src);
} }
@@ -137,7 +137,7 @@ lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, l
dsc->src = src; dsc->src = src;
} }
lv_res_t res = LV_RES_INV; lv_result_t res = LV_RESULT_INVALID;
lv_image_decoder_t * decoder; lv_image_decoder_t * decoder;
_LV_LL_READ(img_decoder_ll_p, decoder) { _LV_LL_READ(img_decoder_ll_p, decoder) {
@@ -145,7 +145,7 @@ lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, l
if(decoder->info_cb == NULL || decoder->open_cb == NULL) continue; if(decoder->info_cb == NULL || decoder->open_cb == NULL) continue;
res = decoder->info_cb(decoder, src, &dsc->header); res = decoder->info_cb(decoder, src, &dsc->header);
if(res != LV_RES_OK) continue; if(res != LV_RESULT_OK) continue;
if(dsc->header.stride == 0) dsc->header.stride = img_width_to_stride(&dsc->header); if(dsc->header.stride == 0) dsc->header.stride = img_width_to_stride(&dsc->header);
@@ -153,7 +153,7 @@ lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, l
res = decoder->open_cb(decoder, dsc); res = decoder->open_cb(decoder, dsc);
/*Opened successfully. It is a good decoder for this image source*/ /*Opened successfully. It is a good decoder for this image source*/
if(res == LV_RES_OK) return res; if(res == LV_RESULT_OK) return res;
/*Prepare for the next loop*/ /*Prepare for the next loop*/
lv_memzero(&dsc->header, sizeof(lv_image_header_t)); lv_memzero(&dsc->header, sizeof(lv_image_header_t));
@@ -177,11 +177,12 @@ lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, l
* @param y start Y coordinate (from top) * @param y start Y coordinate (from top)
* @param len number of pixels to read * @param len number of pixels to read
* @param buf store the data here * @param buf store the data here
* @return LV_RES_OK: success; LV_RES_INV: an error occurred * @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred
*/ */
lv_res_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area, lv_area_t * decoded_area) lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area,
lv_area_t * decoded_area)
{ {
lv_res_t res = LV_RES_INV; lv_result_t res = LV_RESULT_INVALID;
if(dsc->decoder->get_area_cb) res = dsc->decoder->get_area_cb(dsc->decoder, dsc, full_area, decoded_area); if(dsc->decoder->get_area_cb) res = dsc->decoder->get_area_cb(dsc->decoder, dsc, full_area, decoded_area);
return res; return res;
@@ -274,9 +275,9 @@ void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decode
* @param decoder the decoder where this function belongs * @param decoder the decoder where this function belongs
* @param src the image source: pointer to an `lv_image_dsc_t` variable, a file path or a symbol * @param src the image source: pointer to an `lv_image_dsc_t` variable, a file path or a symbol
* @param header store the image data here * @param header store the image data here
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error. * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error.
*/ */
lv_res_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void * src, lv_image_header_t * header) lv_result_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void * src, lv_image_header_t * header)
{ {
LV_UNUSED(decoder); /*Unused*/ LV_UNUSED(decoder); /*Unused*/
@@ -289,7 +290,7 @@ lv_res_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void
} }
else if(src_type == LV_IMAGE_SRC_FILE) { else if(src_type == LV_IMAGE_SRC_FILE) {
/*Support only "*.bin" files*/ /*Support only "*.bin" files*/
if(strcmp(lv_fs_get_ext(src), "bin")) return LV_RES_INV; if(strcmp(lv_fs_get_ext(src), "bin")) return LV_RESULT_INVALID;
lv_fs_file_t f; lv_fs_file_t f;
lv_fs_res_t res = lv_fs_open(&f, src, LV_FS_MODE_RD); lv_fs_res_t res = lv_fs_open(&f, src, LV_FS_MODE_RD);
@@ -299,7 +300,7 @@ lv_res_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void
lv_fs_close(&f); lv_fs_close(&f);
if(res != LV_FS_RES_OK || rn != sizeof(lv_image_header_t)) { if(res != LV_FS_RES_OK || rn != sizeof(lv_image_header_t)) {
LV_LOG_WARN("Image get info get read file header"); LV_LOG_WARN("Image get info get read file header");
return LV_RES_INV; return LV_RESULT_INVALID;
} }
} }
} }
@@ -314,9 +315,9 @@ lv_res_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void
} }
else { else {
LV_LOG_WARN("Image get info found unknown src type"); LV_LOG_WARN("Image get info found unknown src type");
return LV_RES_INV; return LV_RESULT_INVALID;
} }
return LV_RES_OK; return LV_RESULT_OK;
} }
static lv_image_decoder_built_in_data_t * get_decoder_data(lv_image_decoder_dsc_t * dsc) static lv_image_decoder_built_in_data_t * get_decoder_data(lv_image_decoder_dsc_t * dsc)
@@ -341,27 +342,27 @@ static lv_image_decoder_built_in_data_t * get_decoder_data(lv_image_decoder_dsc_
* Open a built in image * Open a built in image
* @param decoder the decoder where this function belongs * @param decoder the decoder where this function belongs
* @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it. * @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it.
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error. * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error.
*/ */
lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc) lv_result_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc)
{ {
LV_UNUSED(decoder); LV_UNUSED(decoder);
/*Open the file if it's a file*/ /*Open the file if it's a file*/
if(dsc->src_type == LV_IMAGE_SRC_FILE) { if(dsc->src_type == LV_IMAGE_SRC_FILE) {
/*Support only "*.bin" files*/ /*Support only "*.bin" files*/
if(strcmp(lv_fs_get_ext(dsc->src), "bin")) return LV_RES_INV; if(strcmp(lv_fs_get_ext(dsc->src), "bin")) return LV_RESULT_INVALID;
lv_fs_file_t f; lv_fs_file_t f;
lv_fs_res_t res = lv_fs_open(&f, dsc->src, LV_FS_MODE_RD); lv_fs_res_t res = lv_fs_open(&f, dsc->src, LV_FS_MODE_RD);
if(res != LV_FS_RES_OK) { if(res != LV_FS_RES_OK) {
LV_LOG_WARN("Built-in image decoder can't open the file"); LV_LOG_WARN("Built-in image decoder can't open the file");
return LV_RES_INV; return LV_RESULT_INVALID;
} }
/*If the file was open successfully save the file descriptor*/ /*If the file was open successfully save the file descriptor*/
lv_image_decoder_built_in_data_t * decoder_data = get_decoder_data(dsc); lv_image_decoder_built_in_data_t * decoder_data = get_decoder_data(dsc);
if(decoder_data == NULL) { if(decoder_data == NULL) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
lv_memcpy(&decoder_data->f, &f, sizeof(f)); lv_memcpy(&decoder_data->f, &f, sizeof(f));
@@ -375,7 +376,7 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
if(palette == NULL) { if(palette == NULL) {
LV_LOG_ERROR("out of memory"); LV_LOG_ERROR("out of memory");
lv_fs_close(&f); lv_fs_close(&f);
return LV_RES_INV; return LV_RESULT_INVALID;
} }
uint32_t rn; uint32_t rn;
@@ -384,7 +385,7 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
LV_LOG_WARN("Built-in image decoder can't read the palette"); LV_LOG_WARN("Built-in image decoder can't read the palette");
lv_free(palette); lv_free(palette);
lv_fs_close(&f); lv_fs_close(&f);
return LV_RES_INV; return LV_RESULT_INVALID;
} }
dsc->palette = palette; dsc->palette = palette;
@@ -393,7 +394,7 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
decoder_data->palette = palette; /*Free decoder data on close*/ decoder_data->palette = palette; /*Free decoder data on close*/
/*It needs to be read by get_area_cb later*/ /*It needs to be read by get_area_cb later*/
return LV_RES_OK; return LV_RESULT_OK;
} }
if(dsc->header.cf == LV_COLOR_FORMAT_A8) { if(dsc->header.cf == LV_COLOR_FORMAT_A8) {
@@ -404,7 +405,7 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
if(data == NULL) { if(data == NULL) {
LV_LOG_ERROR("out of memory"); LV_LOG_ERROR("out of memory");
lv_fs_close(&f); lv_fs_close(&f);
return LV_RES_INV; return LV_RESULT_INVALID;
} }
uint32_t rn; uint32_t rn;
@@ -413,23 +414,23 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
LV_LOG_WARN("Built-in image decoder can't read the palette"); LV_LOG_WARN("Built-in image decoder can't read the palette");
lv_free(data); lv_free(data);
lv_fs_close(&f); lv_fs_close(&f);
return LV_RES_INV; return LV_RESULT_INVALID;
} }
decoder_data->img_data = data; decoder_data->img_data = data;
dsc->img_data = data; dsc->img_data = data;
return LV_RES_OK; return LV_RESULT_OK;
} }
/*It needs to be read by get_area_cb later*/ /*It needs to be read by get_area_cb later*/
return LV_RES_OK; return LV_RESULT_OK;
} }
if(dsc->src_type == LV_IMAGE_SRC_VARIABLE) { if(dsc->src_type == LV_IMAGE_SRC_VARIABLE) {
/*The variables should have valid data*/ /*The variables should have valid data*/
lv_image_dsc_t * img_dsc = (lv_image_dsc_t *)dsc->src; lv_image_dsc_t * img_dsc = (lv_image_dsc_t *)dsc->src;
if(img_dsc->data == NULL) { if(img_dsc->data == NULL) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
lv_color_format_t cf = img_dsc->header.cf; lv_color_format_t cf = img_dsc->header.cf;
@@ -437,13 +438,13 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
/*Need decoder data to store converted image*/ /*Need decoder data to store converted image*/
lv_image_decoder_built_in_data_t * decoder_data = get_decoder_data(dsc); lv_image_decoder_built_in_data_t * decoder_data = get_decoder_data(dsc);
if(decoder_data == NULL) { if(decoder_data == NULL) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
uint8_t * img_data = lv_malloc(sizeof(lv_color32_t) * img_dsc->header.w * img_dsc->header.h); uint8_t * img_data = lv_malloc(sizeof(lv_color32_t) * img_dsc->header.w * img_dsc->header.h);
LV_ASSERT_NULL(img_data); LV_ASSERT_NULL(img_data);
if(img_data == NULL) { if(img_data == NULL) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
decoder_data->img_data = img_data; /*Put to decoder data for later free*/ decoder_data->img_data = img_data; /*Put to decoder data for later free*/
@@ -469,10 +470,10 @@ lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_d
dsc->img_data = ((lv_image_dsc_t *)dsc->src)->data; dsc->img_data = ((lv_image_dsc_t *)dsc->src)->data;
} }
return LV_RES_OK; return LV_RESULT_OK;
} }
return LV_RES_INV; return LV_RESULT_INVALID;
} }
/** /**
@@ -495,7 +496,7 @@ void lv_image_decoder_built_in_close(lv_image_decoder_t * decoder, lv_image_deco
} }
} }
lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, lv_result_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc,
const lv_area_t * full_area, lv_area_t * decoded_area) const lv_area_t * full_area, lv_area_t * decoded_area)
{ {
LV_UNUSED(decoder); /*Unused*/ LV_UNUSED(decoder); /*Unused*/
@@ -508,10 +509,10 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
|| cf == LV_COLOR_FORMAT_RGB565 || cf == LV_COLOR_FORMAT_RGB565A8; || cf == LV_COLOR_FORMAT_RGB565 || cf == LV_COLOR_FORMAT_RGB565A8;
if(!supported) { if(!supported) {
LV_LOG_WARN("CF: %d is not supported", cf); LV_LOG_WARN("CF: %d is not supported", cf);
return LV_RES_INV; return LV_RESULT_INVALID;
} }
lv_res_t res = LV_RES_INV; lv_result_t res = LV_RESULT_INVALID;
lv_image_decoder_built_in_data_t * decoder_data = dsc->user_data; lv_image_decoder_built_in_data_t * decoder_data = dsc->user_data;
lv_fs_file_t * f = &decoder_data->f; lv_fs_file_t * f = &decoder_data->f;
uint32_t bpp = lv_color_format_get_bpp(cf); uint32_t bpp = lv_color_format_get_bpp(cf);
@@ -527,7 +528,7 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
img_data = lv_malloc(len); img_data = lv_malloc(len);
LV_ASSERT_NULL(img_data); LV_ASSERT_NULL(img_data);
if(img_data == NULL) if(img_data == NULL)
return LV_RES_INV; return LV_RESULT_INVALID;
*decoded_area = *full_area; *decoded_area = *full_area;
decoded_area->y2 = decoded_area->y1; decoded_area->y2 = decoded_area->y1;
@@ -540,7 +541,7 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
} }
if(decoded_area->y1 > full_area->y2) { if(decoded_area->y1 > full_area->y2) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
if(LV_COLOR_FORMAT_IS_INDEXED(cf)) { if(LV_COLOR_FORMAT_IS_INDEXED(cf)) {
@@ -549,7 +550,7 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
uint8_t * buf = lv_malloc(len); uint8_t * buf = lv_malloc(len);
LV_ASSERT_NULL(buf); LV_ASSERT_NULL(buf);
if(buf == NULL) if(buf == NULL)
return LV_RES_INV; return LV_RESULT_INVALID;
offset += dsc->palette_size * 4; /*Skip palette*/ offset += dsc->palette_size * 4; /*Skip palette*/
offset += decoded_area->y1 * ((dsc->header.w * bpp + 7) / 8); /*Move to y1*/ offset += decoded_area->y1 * ((dsc->header.w * bpp + 7) / 8); /*Move to y1*/
@@ -557,14 +558,14 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
res = fs_read_file_at(f, offset, buf, len, NULL); res = fs_read_file_at(f, offset, buf, len, NULL);
if(res != LV_FS_RES_OK) { if(res != LV_FS_RES_OK) {
lv_free(buf); lv_free(buf);
return LV_RES_INV; return LV_RESULT_INVALID;
} }
decode_indexed_line(cf, dsc->palette, x_fraction, 0, w_px, buf, (lv_color32_t *)img_data); decode_indexed_line(cf, dsc->palette, x_fraction, 0, w_px, buf, (lv_color32_t *)img_data);
lv_free(buf); lv_free(buf);
dsc->img_data = img_data; /*Return decoded image*/ dsc->img_data = img_data; /*Return decoded image*/
return LV_RES_OK; return LV_RESULT_OK;
} }
if(cf == LV_COLOR_FORMAT_ARGB8888 || cf == LV_COLOR_FORMAT_XRGB8888 || cf == LV_COLOR_FORMAT_RGB888 if(cf == LV_COLOR_FORMAT_ARGB8888 || cf == LV_COLOR_FORMAT_XRGB8888 || cf == LV_COLOR_FORMAT_RGB888
@@ -574,11 +575,11 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
offset += decoded_area->x1 * bpp / 8; /*Move to x1*/ offset += decoded_area->x1 * bpp / 8; /*Move to x1*/
res = fs_read_file_at(f, offset, img_data, len, NULL); res = fs_read_file_at(f, offset, img_data, len, NULL);
if(res != LV_FS_RES_OK) { if(res != LV_FS_RES_OK) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
dsc->img_data = img_data; /*Return decoded image*/ dsc->img_data = img_data; /*Return decoded image*/
return LV_RES_OK; return LV_RESULT_OK;
} }
@@ -589,7 +590,7 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
offset += decoded_area->x1 * bpp / 8; /*Move to x1*/ offset += decoded_area->x1 * bpp / 8; /*Move to x1*/
res = fs_read_file_at(f, offset, img_data, len, NULL); res = fs_read_file_at(f, offset, img_data, len, NULL);
if(res != LV_FS_RES_OK) { if(res != LV_FS_RES_OK) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
/*Now the A8 mask*/ /*Now the A8 mask*/
@@ -599,21 +600,21 @@ lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ima
offset += decoded_area->x1 * 1; /*Move to x1*/ offset += decoded_area->x1 * 1; /*Move to x1*/
res = fs_read_file_at(f, offset, img_data + len, w_px * 1, NULL); res = fs_read_file_at(f, offset, img_data + len, w_px * 1, NULL);
if(res != LV_FS_RES_OK) { if(res != LV_FS_RES_OK) {
return LV_RES_INV; return LV_RESULT_INVALID;
} }
dsc->img_data = img_data; /*Return decoded image*/ dsc->img_data = img_data; /*Return decoded image*/
return LV_RES_OK; return LV_RESULT_OK;
} }
return LV_RES_INV; return LV_RESULT_INVALID;
} }
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static lv_res_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, lv_coord_t x, static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, lv_coord_t x,
lv_coord_t y, lv_coord_t y,
lv_coord_t w_px, const uint8_t * in, lv_color32_t * out) lv_coord_t w_px, const uint8_t * in, lv_color32_t * out)
{ {
@@ -654,7 +655,7 @@ static lv_res_t decode_indexed_line(lv_color_format_t color_format, const lv_col
shift = 0; shift = 0;
break; break;
default: default:
return LV_RES_INV; return LV_RESULT_INVALID;
} }
mask = (1 << px_size) - 1; /*E.g. px_size = 2; mask = 0x03*/ mask = (1 << px_size) - 1; /*E.g. px_size = 2; mask = 0x03*/
@@ -670,7 +671,7 @@ static lv_res_t decode_indexed_line(lv_color_format_t color_format, const lv_col
in++; in++;
} }
} }
return LV_RES_OK; return LV_RESULT_OK;
} }
static uint32_t img_width_to_stride(lv_image_header_t * header) static uint32_t img_width_to_stride(lv_image_header_t * header)

View File

@@ -53,9 +53,9 @@ struct _lv_image_decoder_t;
* @param src the image source. Can be a pointer to a C array or a file name (Use * @param src the image source. Can be a pointer to a C array or a file name (Use
* `lv_image_src_get_type` to determine the type) * `lv_image_src_get_type` to determine the type)
* @param header store the info here * @param header store the info here
* @return LV_RES_OK: info written correctly; LV_RES_INV: failed * @return LV_RESULT_OK: info written correctly; LV_RESULT_INVALID: failed
*/ */
typedef lv_res_t (*lv_image_decoder_info_f_t)(struct _lv_image_decoder_t * decoder, const void * src, typedef lv_result_t (*lv_image_decoder_info_f_t)(struct _lv_image_decoder_t * decoder, const void * src,
lv_image_header_t * header); lv_image_header_t * header);
/** /**
@@ -63,7 +63,7 @@ typedef lv_res_t (*lv_image_decoder_info_f_t)(struct _lv_image_decoder_t * decod
* @param decoder pointer to the decoder the function associated with * @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it. * @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it.
*/ */
typedef lv_res_t (*lv_image_decoder_open_f_t)(struct _lv_image_decoder_t * decoder, typedef lv_result_t (*lv_image_decoder_open_f_t)(struct _lv_image_decoder_t * decoder,
struct _lv_image_decoder_dsc_t * dsc); struct _lv_image_decoder_dsc_t * dsc);
/** /**
@@ -75,9 +75,9 @@ typedef lv_res_t (*lv_image_decoder_open_f_t)(struct _lv_image_decoder_t * decod
* @param y start y coordinate * @param y start y coordinate
* @param len number of pixels to decode * @param len number of pixels to decode
* @param buf a buffer to store the decoded pixels * @param buf a buffer to store the decoded pixels
* @return LV_RES_OK: ok; LV_RES_INV: failed * @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed
*/ */
typedef lv_res_t (*lv_image_decoder_get_area_cb_t)(struct _lv_image_decoder_t * decoder, typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(struct _lv_image_decoder_t * decoder,
struct _lv_image_decoder_dsc_t * dsc, struct _lv_image_decoder_dsc_t * dsc,
const lv_area_t * full_area, lv_area_t * decoded_area); const lv_area_t * full_area, lv_area_t * decoded_area);
@@ -153,9 +153,9 @@ void _lv_image_decoder_init(void);
* 2) Variable: Pointer to an `lv_image_dsc_t` variable * 2) Variable: Pointer to an `lv_image_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK` * 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param header the image info will be stored here * @param header the image info will be stored here
* @return LV_RES_OK: success; LV_RES_INV: wasn't able to get info about the image * @return LV_RESULT_OK: success; LV_RESULT_INVALID: wasn't able to get info about the image
*/ */
lv_res_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header); lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header);
/** /**
* Open an image. * Open an image.
@@ -167,10 +167,10 @@ lv_res_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header)
* 3) Symbol: E.g. `LV_SYMBOL_OK` * 3) Symbol: E.g. `LV_SYMBOL_OK`
* @param color The color of the image with `LV_IMAGE_CF_ALPHA_...` * @param color The color of the image with `LV_IMAGE_CF_ALPHA_...`
* @param frame_id the index of the frame. Used only with animated images, set 0 for normal images * @param frame_id the index of the frame. Used only with animated images, set 0 for normal images
* @return LV_RES_OK: opened the image. `dsc->img_data` and `dsc->header` are set. * @return LV_RESULT_OK: opened the image. `dsc->img_data` and `dsc->header` are set.
* LV_RES_INV: none of the registered image decoders were able to open the image. * LV_RESULT_INVALID: none of the registered image decoders were able to open the image.
*/ */
lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, lv_color_t color, int32_t frame_id); lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, lv_color_t color, int32_t frame_id);
/** /**
* Read a line from an opened image * Read a line from an opened image
@@ -179,9 +179,10 @@ lv_res_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, l
* @param y start Y coordinate (from top) * @param y start Y coordinate (from top)
* @param len number of pixels to read * @param len number of pixels to read
* @param buf store the data here * @param buf store the data here
* @return LV_RES_OK: success; LV_RES_INV: an error occurred * @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred
*/ */
lv_res_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area, lv_area_t * decoded_area); lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area,
lv_area_t * decoded_area);
/** /**
* Close a decoding session * Close a decoding session
@@ -234,23 +235,20 @@ void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decode
* @param decoder the decoder where this function belongs * @param decoder the decoder where this function belongs
* @param src the image source: pointer to an `lv_image_dsc_t` variable, a file path or a symbol * @param src the image source: pointer to an `lv_image_dsc_t` variable, a file path or a symbol
* @param header store the image data here * @param header store the image data here
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error. * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error.
*/ */
lv_res_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void * src, lv_image_header_t * header); lv_result_t lv_image_decoder_built_in_info(lv_image_decoder_t * decoder, const void * src, lv_image_header_t * header);
lv_res_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc, lv_result_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc,
const lv_area_t * full_area, lv_area_t * decoded_area);
lv_res_t lv_img_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc,
const lv_area_t * full_area, lv_area_t * decoded_area); const lv_area_t * full_area, lv_area_t * decoded_area);
/** /**
* Open a built in image * Open a built in image
* @param decoder the decoder where this function belongs * @param decoder the decoder where this function belongs
* @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it. * @param dsc pointer to decoder descriptor. `src`, `style` are already initialized in it.
* @return LV_RES_OK: the info is successfully stored in `header`; LV_RES_INV: unknown format or other error. * @return LV_RESULT_OK: the info is successfully stored in `header`; LV_RESULT_INVALID: unknown format or other error.
*/ */
lv_res_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); lv_result_t lv_image_decoder_built_in_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc);
/** /**
* Close the pending decoding. Free resources etc. * Close the pending decoding. Free resources etc.

View File

@@ -11,7 +11,7 @@
#include "lv_draw_sw_blend.h" #include "lv_draw_sw_blend.h"
#include "../../../misc/lv_math.h" #include "../../../misc/lv_math.h"
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#include "../../../core/lv_refr.h" #include "../../../core/lv_refr.h"
#include "../../../misc/lv_color.h" #include "../../../misc/lv_color.h"
#include "../../../stdlib/lv_string.h" #include "../../../stdlib/lv_string.h"

View File

@@ -11,7 +11,7 @@
#include "lv_draw_sw_blend.h" #include "lv_draw_sw_blend.h"
#include "../../../misc/lv_math.h" #include "../../../misc/lv_math.h"
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#include "../../../core/lv_refr.h" #include "../../../core/lv_refr.h"
#include "../../../misc/lv_color.h" #include "../../../misc/lv_color.h"
#include "../../../stdlib/lv_string.h" #include "../../../stdlib/lv_string.h"

View File

@@ -11,7 +11,7 @@
#include "lv_draw_sw_blend.h" #include "lv_draw_sw_blend.h"
#include "../../../misc/lv_math.h" #include "../../../misc/lv_math.h"
#include "../../../disp/lv_disp.h" #include "../../../display/lv_display.h"
#include "../../../core/lv_refr.h" #include "../../../core/lv_refr.h"
#include "../../../misc/lv_color.h" #include "../../../misc/lv_color.h"
#include "../../../stdlib/lv_string.h" #include "../../../stdlib/lv_string.h"

View File

@@ -11,7 +11,7 @@
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "lv_draw_sw.h" #include "lv_draw_sw.h"
#include "../../disp/lv_disp_private.h" #include "../../display/lv_display_private.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"
/********************* /*********************
@@ -182,7 +182,7 @@ static void execute_drawing(lv_draw_sw_unit_t * u)
if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) return; if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) return;
int32_t idx = 0; int32_t idx = 0;
lv_disp_t * disp = _lv_refr_get_disp_refreshing(); lv_display_t * disp = _lv_refr_get_disp_refreshing();
lv_draw_unit_t * draw_unit_tmp = disp->draw_unit_head; lv_draw_unit_t * draw_unit_tmp = disp->draw_unit_head;
while(draw_unit_tmp != (lv_draw_unit_t *)u) { while(draw_unit_tmp != (lv_draw_unit_t *)u) {
draw_unit_tmp = draw_unit_tmp->next; draw_unit_tmp = draw_unit_tmp->next;
@@ -198,7 +198,7 @@ static void execute_drawing(lv_draw_sw_unit_t * u)
lv_draw_sw_fill((lv_draw_unit_t *)u, &rect_dsc, &draw_area); lv_draw_sw_fill((lv_draw_unit_t *)u, &rect_dsc, &draw_area);
lv_point_t txt_size; lv_point_t txt_size;
lv_txt_get_size(&txt_size, "W", LV_FONT_DEFAULT, 0, 0, 100, LV_TEXT_FLAG_NONE); lv_text_get_size(&txt_size, "W", LV_FONT_DEFAULT, 0, 0, 100, LV_TEXT_FLAG_NONE);
lv_area_t txt_area; lv_area_t txt_area;
txt_area.x1 = draw_area.x1; txt_area.x1 = draw_area.x1;

View File

@@ -18,7 +18,7 @@ extern "C" {
#include "../../misc/lv_area.h" #include "../../misc/lv_area.h"
#include "../../misc/lv_color.h" #include "../../misc/lv_color.h"
#include "../../disp/lv_disp.h" #include "../../display/lv_display.h"
#include "../../osal/lv_os.h" #include "../../osal/lv_os.h"
/********************* /*********************

View File

@@ -11,7 +11,7 @@
#include "blend/lv_draw_sw_blend.h" #include "blend/lv_draw_sw_blend.h"
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_txt_ap.h" #include "../../misc/lv_text_ap.h"
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../lv_draw_mask.h" #include "../lv_draw_mask.h"
@@ -56,7 +56,7 @@ void lv_draw_sw_bg_image(lv_draw_unit_t * draw_unit, const lv_draw_bg_image_dsc_
lv_image_src_t src_type = lv_image_src_get_type(dsc->src); lv_image_src_t src_type = lv_image_src_get_type(dsc->src);
if(src_type == LV_IMAGE_SRC_SYMBOL) { if(src_type == LV_IMAGE_SRC_SYMBOL) {
lv_point_t size; lv_point_t size;
lv_txt_get_size(&size, dsc->src, dsc->font, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE); lv_text_get_size(&size, dsc->src, dsc->font, 0, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
lv_area_t a; lv_area_t a;
a.x1 = coords->x1 + lv_area_get_width(coords) / 2 - size.x / 2; a.x1 = coords->x1 + lv_area_get_width(coords) / 2 - size.x / 2;
a.x2 = a.x1 + size.x - 1; a.x2 = a.x1 + size.x - 1;

View File

@@ -11,7 +11,7 @@
#include "blend/lv_draw_sw_blend.h" #include "blend/lv_draw_sw_blend.h"
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_txt_ap.h" #include "../../misc/lv_text_ap.h"
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"

View File

@@ -12,7 +12,7 @@
#include "blend/lv_draw_sw_blend.h" #include "blend/lv_draw_sw_blend.h"
#include "lv_draw_sw_gradient.h" #include "lv_draw_sw_gradient.h"
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_txt_ap.h" #include "../../misc/lv_text_ap.h"
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../../stdlib/lv_string.h" #include "../../stdlib/lv_string.h"

View File

@@ -29,7 +29,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
typedef lv_res_t (*op_cache_t)(lv_grad_t * c, void * ctx); typedef lv_result_t (*op_cache_t)(lv_grad_t * c, void * ctx);
static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h); static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h);
/********************** /**********************

View File

@@ -9,8 +9,8 @@
#include "lv_draw_sw.h" #include "lv_draw_sw.h"
#if LV_USE_DRAW_SW #if LV_USE_DRAW_SW
#include "../../disp/lv_disp.h" #include "../../display/lv_display.h"
#include "../../disp/lv_disp_private.h" #include "../../display/lv_display_private.h"
#include "../../misc/lv_log.h" #include "../../misc/lv_log.h"
#include "../../core/lv_refr.h" #include "../../core/lv_refr.h"
#include "../../stdlib/lv_mem.h" #include "../../stdlib/lv_mem.h"
@@ -22,7 +22,7 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define MAX_BUF_SIZE (uint32_t) 4 * lv_draw_buf_width_to_stride(lv_disp_get_hor_res(_lv_refr_get_disp_refreshing()), lv_disp_get_color_format(_lv_refr_get_disp_refreshing())) #define MAX_BUF_SIZE (uint32_t) 4 * lv_draw_buf_width_to_stride(lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing()), lv_display_get_color_format(_lv_refr_get_disp_refreshing()))
/********************** /**********************
* TYPEDEFS * TYPEDEFS
@@ -71,11 +71,11 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr
#if LV_USE_LAYER_DEBUG || LV_USE_PARALLEL_DRAW_DEBUG #if LV_USE_LAYER_DEBUG || LV_USE_PARALLEL_DRAW_DEBUG
lv_area_t area_rot; lv_area_t area_rot;
lv_area_copy(&area_rot, coords); lv_area_copy(&area_rot, coords);
if(draw_dsc->angle || draw_dsc->zoom != LV_ZOOM_NONE) { if(draw_dsc->rotation || draw_dsc->zoom != LV_SCALE_NONE) {
int32_t w = lv_area_get_width(coords); int32_t w = lv_area_get_width(coords);
int32_t h = lv_area_get_height(coords); int32_t h = lv_area_get_height(coords);
_lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->angle, draw_dsc->zoom, &draw_dsc->pivot); _lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->zoom, &draw_dsc->pivot);
area_rot.x1 += coords->x1; area_rot.x1 += coords->x1;
area_rot.y1 += coords->y1; area_rot.y1 += coords->y1;
@@ -104,7 +104,7 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr
#if LV_USE_PARALLEL_DRAW_DEBUG #if LV_USE_PARALLEL_DRAW_DEBUG
uint32_t idx = 0; uint32_t idx = 0;
lv_disp_t * disp = _lv_refr_get_disp_refreshing(); lv_display_t * disp = _lv_refr_get_disp_refreshing();
lv_draw_unit_t * draw_unit_tmp = disp->draw_unit_head; lv_draw_unit_t * draw_unit_tmp = disp->draw_unit_head;
while(draw_unit_tmp != draw_unit) { while(draw_unit_tmp != draw_unit) {
draw_unit_tmp = draw_unit_tmp->next; draw_unit_tmp = draw_unit_tmp->next;
@@ -121,7 +121,7 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr
lv_draw_sw_rect(draw_unit, &rect_dsc, &area_rot); lv_draw_sw_rect(draw_unit, &rect_dsc, &area_rot);
lv_point_t txt_size; lv_point_t txt_size;
lv_txt_get_size(&txt_size, "W", LV_FONT_DEFAULT, 0, 0, 100, LV_TEXT_FLAG_NONE); lv_text_get_size(&txt_size, "W", LV_FONT_DEFAULT, 0, 0, 100, LV_TEXT_FLAG_NONE);
lv_area_t txt_area; lv_area_t txt_area;
txt_area.x1 = draw_area.x1; txt_area.x1 = draw_area.x1;
@@ -150,11 +150,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv
{ {
lv_area_t transformed_area; lv_area_t transformed_area;
lv_area_copy(&transformed_area, coords); lv_area_copy(&transformed_area, coords);
if(draw_dsc->angle || draw_dsc->zoom != LV_ZOOM_NONE) { if(draw_dsc->rotation || draw_dsc->zoom != LV_SCALE_NONE) {
int32_t w = lv_area_get_width(coords); int32_t w = lv_area_get_width(coords);
int32_t h = lv_area_get_height(coords); int32_t h = lv_area_get_height(coords);
_lv_image_buf_get_transformed_area(&transformed_area, w, h, draw_dsc->angle, draw_dsc->zoom, &draw_dsc->pivot); _lv_image_buf_get_transformed_area(&transformed_area, w, h, draw_dsc->rotation, draw_dsc->zoom, &draw_dsc->pivot);
transformed_area.x1 += coords->x1; transformed_area.x1 += coords->x1;
transformed_area.y1 += coords->y1; transformed_area.y1 += coords->y1;
@@ -169,8 +169,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv
} }
lv_image_decoder_dsc_t decoder_dsc; lv_image_decoder_dsc_t decoder_dsc;
lv_res_t res = lv_image_decoder_open(&decoder_dsc, draw_dsc->src, draw_dsc->recolor, -1); lv_result_t res = lv_image_decoder_open(&decoder_dsc, draw_dsc->src, draw_dsc->recolor, -1);
if(res != LV_RES_OK) { if(res != LV_RESULT_OK) {
LV_LOG_ERROR("Failed to open image"); LV_LOG_ERROR("Failed to open image");
return; return;
} }
@@ -195,13 +195,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv
relative_decoded_area.y1 = LV_COORD_MIN; relative_decoded_area.y1 = LV_COORD_MIN;
relative_decoded_area.x2 = LV_COORD_MIN; relative_decoded_area.x2 = LV_COORD_MIN;
relative_decoded_area.y2 = LV_COORD_MIN; relative_decoded_area.y2 = LV_COORD_MIN;
res = LV_RES_OK; res = LV_RESULT_OK;
while(res == LV_RES_OK) { while(res == LV_RESULT_OK) {
res = lv_image_decoder_get_area(&decoder_dsc, &relative_full_area_to_decode, &relative_decoded_area); res = lv_image_decoder_get_area(&decoder_dsc, &relative_full_area_to_decode, &relative_decoded_area);
lv_area_t absolute_decoded_area = relative_decoded_area; lv_area_t absolute_decoded_area = relative_decoded_area;
lv_area_move(&absolute_decoded_area, coords->x1, coords->y1); lv_area_move(&absolute_decoded_area, coords->x1, coords->y1);
if(res == LV_RES_OK) { if(res == LV_RESULT_OK) {
/*Limit draw area to the current decoded area and draw the image*/ /*Limit draw area to the current decoded area and draw the image*/
lv_area_t draw_area_sub; lv_area_t draw_area_sub;
if(_lv_area_intersect(&draw_area_sub, &draw_area, &absolute_decoded_area)) { if(_lv_area_intersect(&draw_area_sub, &draw_area, &absolute_decoded_area)) {
@@ -219,7 +219,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv
static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * draw_area, static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * draw_area,
const lv_image_decoder_dsc_t * src, lv_draw_image_sup_t * sup, const lv_area_t * img_coords) const lv_image_decoder_dsc_t * src, lv_draw_image_sup_t * sup, const lv_area_t * img_coords)
{ {
bool transformed = draw_dsc->angle != 0 || draw_dsc->zoom != LV_ZOOM_NONE ? true : false; bool transformed = draw_dsc->rotation != 0 || draw_dsc->zoom != LV_SCALE_NONE ? true : false;
lv_draw_sw_blend_dsc_t blend_dsc; lv_draw_sw_blend_dsc_t blend_dsc;
const uint8_t * src_buf = src->img_data; const uint8_t * src_buf = src->img_data;

View File

@@ -9,7 +9,7 @@
#include "lv_draw_sw.h" #include "lv_draw_sw.h"
#if LV_USE_DRAW_SW #if LV_USE_DRAW_SW
#include "../../disp/lv_disp.h" #include "../../display/lv_display.h"
#include "../../misc/lv_math.h" #include "../../misc/lv_math.h"
#include "../../misc/lv_assert.h" #include "../../misc/lv_assert.h"
#include "../../misc/lv_area.h" #include "../../misc/lv_area.h"
@@ -93,8 +93,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_cb(lv_draw_unit_t * draw_unit, lv_
#if LV_USE_IMGFONT #if LV_USE_IMGFONT
lv_draw_image_dsc_t img_dsc; lv_draw_image_dsc_t img_dsc;
lv_draw_image_dsc_init(&img_dsc); lv_draw_image_dsc_init(&img_dsc);
img_dsc.angle = 0; img_dsc.rotation = 0;
img_dsc.zoom = LV_ZOOM_NONE; img_dsc.zoom = LV_SCALE_NONE;
img_dsc.opa = glyph_draw_dsc->opa; img_dsc.opa = glyph_draw_dsc->opa;
img_dsc.src = glyph_draw_dsc->bitmap; img_dsc.src = glyph_draw_dsc->bitmap;
lv_draw_sw_image(draw_unit, &img_dsc, glyph_draw_dsc->letter_coords); lv_draw_sw_image(draw_unit, &img_dsc, glyph_draw_dsc->letter_coords);

View File

@@ -346,7 +346,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(lv_draw_unit_t * draw_unit, con
/*Draw the background line by line*/ /*Draw the background line by line*/
int32_t h; int32_t h;
uint32_t hor_res = (uint32_t)lv_disp_get_hor_res(_lv_refr_get_disp_refreshing()); uint32_t hor_res = (uint32_t)lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing());
size_t mask_buf_size = LV_MIN(lv_area_get_size(&blend_area), hor_res); size_t mask_buf_size = LV_MIN(lv_area_get_size(&blend_area), hor_res);
lv_opa_t * mask_buf = lv_malloc(mask_buf_size); lv_opa_t * mask_buf = lv_malloc(mask_buf_size);

View File

@@ -86,7 +86,7 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are
LV_UNUSED(sup); LV_UNUSED(sup);
point_transform_dsc_t tr_dsc; point_transform_dsc_t tr_dsc;
tr_dsc.angle = -draw_dsc->angle; tr_dsc.angle = -draw_dsc->rotation;
tr_dsc.zoom = (256 * 256) / draw_dsc->zoom; tr_dsc.zoom = (256 * 256) / draw_dsc->zoom;
tr_dsc.pivot = draw_dsc->pivot; tr_dsc.pivot = draw_dsc->pivot;
@@ -570,7 +570,7 @@ static void transform_a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h
static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout, static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout,
int32_t * yout) int32_t * yout)
{ {
if(t->angle == 0 && t->zoom == LV_ZOOM_NONE) { if(t->angle == 0 && t->zoom == LV_SCALE_NONE) {
*xout = xin * 256; *xout = xin * 256;
*yout = yin * 256; *yout = yin * 256;
return; return;
@@ -583,7 +583,7 @@ static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int
*xout = ((int32_t)(xin * t->zoom)) + (t->pivot_x_256); *xout = ((int32_t)(xin * t->zoom)) + (t->pivot_x_256);
*yout = ((int32_t)(yin * t->zoom)) + (t->pivot_y_256); *yout = ((int32_t)(yin * t->zoom)) + (t->pivot_y_256);
} }
else if(t->zoom == LV_ZOOM_NONE) { else if(t->zoom == LV_SCALE_NONE) {
*xout = ((t->cosma * xin - t->sinma * yin) >> 2) + (t->pivot_x_256); *xout = ((t->cosma * xin - t->sinma * yin) >> 2) + (t->pivot_x_256);
*yout = ((t->sinma * xin + t->cosma * yin) >> 2) + (t->pivot_y_256); *yout = ((t->sinma * xin + t->cosma * yin) >> 2) + (t->pivot_y_256);
} }

View File

@@ -8,7 +8,7 @@
********************/ ********************/
#include "lv_indev_private.h" #include "lv_indev_private.h"
#include "lv_indev_scroll.h" #include "lv_indev_scroll.h"
#include "../disp/lv_disp_private.h" #include "../display/lv_display_private.h"
#include "../core/lv_global.h" #include "../core/lv_global.h"
#include "../core/lv_obj.h" #include "../core/lv_obj.h"
#include "../core/lv_group.h" #include "../core/lv_group.h"
@@ -65,7 +65,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data);
static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data); static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data);
static void indev_proc_press(lv_indev_t * indev); static void indev_proc_press(lv_indev_t * indev);
static void indev_proc_release(lv_indev_t * indev); static void indev_proc_release(lv_indev_t * indev);
static lv_obj_t * pointer_search_obj(lv_disp_t * disp, lv_point_t * p); static lv_obj_t * pointer_search_obj(lv_display_t * disp, lv_point_t * p);
static void indev_proc_reset_query_handler(lv_indev_t * indev); static void indev_proc_reset_query_handler(lv_indev_t * indev);
static void indev_click_focus(lv_indev_t * indev); static void indev_click_focus(lv_indev_t * indev);
static void indev_gesture(lv_indev_t * indev); static void indev_gesture(lv_indev_t * indev);
@@ -92,7 +92,7 @@ static void indev_reset_core(lv_indev_t * indev, lv_obj_t * obj);
lv_indev_t * lv_indev_create(void) lv_indev_t * lv_indev_create(void)
{ {
lv_disp_t * disp = lv_disp_get_default(); lv_display_t * disp = lv_display_get_default();
if(disp == NULL) { if(disp == NULL) {
LV_LOG_WARN("no display was created so far"); LV_LOG_WARN("no display was created so far");
} }
@@ -107,7 +107,7 @@ lv_indev_t * lv_indev_create(void)
indev->reset_query = 1; indev->reset_query = 1;
indev->read_timer = lv_timer_create(lv_indev_read_timer_cb, LV_DEF_REFR_PERIOD, indev); indev->read_timer = lv_timer_create(lv_indev_read_timer_cb, LV_DEF_REFR_PERIOD, indev);
indev->disp = lv_disp_get_default(); indev->disp = lv_display_get_default();
indev->type = LV_INDEV_TYPE_NONE; indev->type = LV_INDEV_TYPE_NONE;
indev->scroll_limit = LV_INDEV_DEF_SCROLL_LIMIT; indev->scroll_limit = LV_INDEV_DEF_SCROLL_LIMIT;
indev->scroll_throw = LV_INDEV_DEF_SCROLL_THROW; indev->scroll_throw = LV_INDEV_DEF_SCROLL_THROW;
@@ -308,14 +308,14 @@ lv_group_t * lv_indev_get_group(const lv_indev_t * indev)
return indev->group; return indev->group;
} }
lv_disp_t * lv_indev_get_disp(const lv_indev_t * indev) lv_display_t * lv_indev_get_disp(const lv_indev_t * indev)
{ {
if(indev == NULL) return NULL; if(indev == NULL) return NULL;
return indev->disp; return indev->disp;
} }
void lv_indev_set_disp(lv_indev_t * indev, lv_disp_t * disp) void lv_indev_set_disp(lv_indev_t * indev, lv_display_t * disp)
{ {
if(indev == NULL) return; if(indev == NULL) return;
@@ -362,7 +362,7 @@ void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj)
if(indev->type != LV_INDEV_TYPE_POINTER) return; if(indev->type != LV_INDEV_TYPE_POINTER) return;
indev->cursor = cur_obj; indev->cursor = cur_obj;
lv_obj_set_parent(indev->cursor, lv_disp_get_layer_sys(indev->disp)); lv_obj_set_parent(indev->cursor, lv_display_get_layer_sys(indev->disp));
lv_obj_set_pos(indev->cursor, indev->pointer.act_point.x, indev->pointer.act_point.y); lv_obj_set_pos(indev->cursor, indev->pointer.act_point.x, indev->pointer.act_point.y);
lv_obj_clear_flag(indev->cursor, LV_OBJ_FLAG_CLICKABLE); lv_obj_clear_flag(indev->cursor, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_flag(indev->cursor, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_FLOATING); lv_obj_add_flag(indev->cursor, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_FLOATING);
@@ -508,16 +508,16 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
*/ */
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
{ {
lv_disp_t * disp = i->disp; lv_display_t * disp = i->disp;
/*Save the raw points so they can be used again in indev_read_core*/ /*Save the raw points so they can be used again in indev_read_core*/
i->pointer.last_raw_point.x = data->point.x; i->pointer.last_raw_point.x = data->point.x;
i->pointer.last_raw_point.y = data->point.y; i->pointer.last_raw_point.y = data->point.y;
if(disp->rotation == LV_DISP_ROTATION_180 || disp->rotation == LV_DISP_ROTATION_270) { if(disp->rotation == LV_DISPLAY_ROTATION_180 || disp->rotation == LV_DISPLAY_ROTATION_270) {
data->point.x = disp->hor_res - data->point.x - 1; data->point.x = disp->hor_res - data->point.x - 1;
data->point.y = disp->ver_res - data->point.y - 1; data->point.y = disp->ver_res - data->point.y - 1;
} }
if(disp->rotation == LV_DISP_ROTATION_90 || disp->rotation == LV_DISP_ROTATION_270) { if(disp->rotation == LV_DISPLAY_ROTATION_90 || disp->rotation == LV_DISPLAY_ROTATION_270) {
lv_coord_t tmp = data->point.y; lv_coord_t tmp = data->point.y;
data->point.y = data->point.x; data->point.y = data->point.x;
data->point.x = disp->ver_res - tmp - 1; data->point.x = disp->ver_res - tmp - 1;
@@ -527,13 +527,13 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
if(data->point.x < 0) { if(data->point.x < 0) {
LV_LOG_WARN("X is %d which is smaller than zero", (int)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->disp)) { if(data->point.x >= lv_display_get_horizontal_resolution(i->disp)) {
LV_LOG_WARN("X is %d which is greater than hor. res", (int)data->point.x); LV_LOG_WARN("X is %d which is greater than hor. res", (int)data->point.x);
} }
if(data->point.y < 0) { if(data->point.y < 0) {
LV_LOG_WARN("Y is %d which is smaller than zero", (int)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->disp)) { if(data->point.y >= lv_display_get_vertical_resolution(i->disp)) {
LV_LOG_WARN("Y is %d which is greater than ver. res", (int)data->point.y); LV_LOG_WARN("Y is %d which is greater than ver. res", (int)data->point.y);
} }
@@ -589,7 +589,7 @@ static void indev_keypad_proc(lv_indev_t * i, lv_indev_data_t * data)
i->keypad.last_key = data->key; i->keypad.last_key = data->key;
/*Save the previous state so we can detect state changes below and also set the last state now /*Save the previous state so we can detect state changes below and also set the last state now
*so if any event handler on the way returns `LV_RES_INV` the last state is remembered *so if any event handler on the way returns `LV_RESULT_INVALID` the last state is remembered
*for the next time*/ *for the next time*/
uint32_t prev_state = i->keypad.last_state; uint32_t prev_state = i->keypad.last_state;
i->keypad.last_state = data->state; i->keypad.last_state = data->state;
@@ -980,7 +980,7 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data)
/** /**
* Process the pressed state of LV_INDEV_TYPE_POINTER input devices * Process the pressed state of LV_INDEV_TYPE_POINTER input devices
* @param indev pointer to an input device 'proc' * @param indev pointer to an input device 'proc'
* @return LV_RES_OK: no indev reset required; LV_RES_INV: indev reset is required * @return LV_RESULT_OK: no indev reset required; LV_RESULT_INVALID: indev reset is required
*/ */
static void indev_proc_press(lv_indev_t * indev) static void indev_proc_press(lv_indev_t * indev)
{ {
@@ -990,7 +990,7 @@ static void indev_proc_press(lv_indev_t * indev)
if(indev->wait_until_release != 0) return; if(indev->wait_until_release != 0) return;
lv_disp_t * disp = indev_act->disp; lv_display_t * disp = indev_act->disp;
bool new_obj_searched = false; bool new_obj_searched = false;
/*If there is no last object then search*/ /*If there is no last object then search*/
@@ -1163,13 +1163,13 @@ static void indev_proc_release(lv_indev_t * indev)
lv_point_t pivot = { 0, 0 }; lv_point_t pivot = { 0, 0 };
lv_obj_t * parent = scroll_obj; lv_obj_t * parent = scroll_obj;
while(parent) { while(parent) {
angle += lv_obj_get_style_transform_angle(parent, 0); angle += lv_obj_get_style_transform_rotation(parent, 0);
int32_t zoom_act = lv_obj_get_style_transform_zoom_safe(parent, 0); int32_t zoom_act = lv_obj_get_style_transform_scale_safe(parent, 0);
zoom = (zoom * zoom_act) >> 8; zoom = (zoom * zoom_act) >> 8;
parent = lv_obj_get_parent(parent); parent = lv_obj_get_parent(parent);
} }
if(angle != 0 || zoom != LV_ZOOM_NONE) { if(angle != 0 || zoom != LV_SCALE_NONE) {
angle = -angle; angle = -angle;
zoom = (256 * 256) / zoom; zoom = (256 * 256) / zoom;
lv_point_transform(&indev->pointer.scroll_throw_vect, angle, zoom, &pivot); lv_point_transform(&indev->pointer.scroll_throw_vect, angle, zoom, &pivot);
@@ -1185,18 +1185,18 @@ static void indev_proc_release(lv_indev_t * indev)
} }
} }
static lv_obj_t * pointer_search_obj(lv_disp_t * disp, lv_point_t * p) static lv_obj_t * pointer_search_obj(lv_display_t * disp, lv_point_t * p)
{ {
indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_sys(disp), p); indev_obj_act = lv_indev_search_obj(lv_display_get_layer_sys(disp), p);
if(indev_obj_act) return indev_obj_act; if(indev_obj_act) return indev_obj_act;
indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_top(disp), p); indev_obj_act = lv_indev_search_obj(lv_display_get_layer_top(disp), p);
if(indev_obj_act) return indev_obj_act; if(indev_obj_act) return indev_obj_act;
indev_obj_act = lv_indev_search_obj(lv_disp_get_scr_act(disp), p); indev_obj_act = lv_indev_search_obj(lv_display_get_scr_act(disp), p);
if(indev_obj_act) return indev_obj_act; if(indev_obj_act) return indev_obj_act;
indev_obj_act = lv_indev_search_obj(lv_disp_get_layer_bottom(disp), p); indev_obj_act = lv_indev_search_obj(lv_display_get_layer_bottom(disp), p);
return indev_obj_act; return indev_obj_act;
} }

View File

@@ -25,10 +25,10 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
struct _lv_obj_t; struct _lv_obj_t;
struct _lv_disp_t; struct _lv_display_t;
struct _lv_group_t; struct _lv_group_t;
struct _lv_indev_t; struct _lv_indev_t;
struct _lv_disp_t; struct _lv_display_t;
typedef struct _lv_indev_t lv_indev_t; typedef struct _lv_indev_t lv_indev_t;
/** Possible input device types*/ /** Possible input device types*/
@@ -129,9 +129,9 @@ lv_indev_state_t lv_indev_get_state(const lv_indev_t * indev);
lv_group_t * lv_indev_get_group(const lv_indev_t * indev); lv_group_t * lv_indev_get_group(const lv_indev_t * indev);
struct _lv_disp_t * lv_indev_get_disp(const lv_indev_t * indev); struct _lv_display_t * lv_indev_get_disp(const lv_indev_t * indev);
void lv_indev_set_disp(lv_indev_t * indev, struct _lv_disp_t * disp); void lv_indev_set_disp(lv_indev_t * indev, struct _lv_display_t * disp);
void * lv_indev_get_user_data(const lv_indev_t * indev); void * lv_indev_get_user_data(const lv_indev_t * indev);

Some files were not shown because too many files have changed in this diff Show More