Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c0162b457 | ||
|
|
dec580b9f1 | ||
|
|
ad56dfaf70 | ||
|
|
c8e584f879 | ||
|
|
d2d886aae5 | ||
|
|
1e3ca25fed | ||
|
|
84cf05d8b2 | ||
|
|
2c17b28ac4 | ||
|
|
1ed026ca73 | ||
|
|
ae3825871e | ||
|
|
ae300acb2f | ||
|
|
41fa416134 | ||
|
|
68f6190f8e | ||
|
|
1173dcba96 | ||
|
|
716e5e2c8b | ||
|
|
bb2c2ac34a | ||
|
|
c4c400716e | ||
|
|
6825d4bd1d | ||
|
|
39d03a80f4 | ||
|
|
340a1cb60b | ||
|
|
e06f03db72 | ||
|
|
bd11ad8542 | ||
|
|
e050f5ca15 | ||
|
|
903e94b716 | ||
|
|
0732400e7b | ||
|
|
483b2a4322 | ||
|
|
5545ffc925 | ||
|
|
c8bee40410 | ||
|
|
755d363ecc | ||
|
|
dfd14fa778 | ||
|
|
1ab9aa5312 | ||
|
|
4d69cd865c | ||
|
|
832bef4346 | ||
|
|
d5b2a9b256 | ||
|
|
7640950216 | ||
|
|
8b605cc482 | ||
|
|
ece3495004 | ||
|
|
f6655c2aaf | ||
|
|
cba2aa95c8 | ||
|
|
660464c973 | ||
|
|
5156ee058d | ||
|
|
a0515ba30d | ||
|
|
1a46030918 | ||
|
|
f58dcd94fc | ||
|
|
d59bba12db | ||
|
|
5022476edc | ||
|
|
b884abae26 | ||
|
|
aa45d59852 | ||
|
|
55e95ed351 | ||
|
|
be485d7605 | ||
|
|
9024b72b48 | ||
|
|
9b998aa47d | ||
|
|
71913d300d | ||
|
|
284834e799 | ||
|
|
8544cc3806 | ||
|
|
62662f68e9 | ||
|
|
a283273bd2 | ||
|
|
9750c97aff | ||
|
|
2967172bee | ||
|
|
9e1b6166b0 |
2
.github/workflows/build_micropython.yml
vendored
2
.github/workflows/build_micropython.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
- name: Clone lv_micropython
|
||||
run: |
|
||||
git clone https://github.com/lvgl/lv_micropython.git .
|
||||
git checkout master
|
||||
git checkout release/v8
|
||||
- name: Initialize lv_bindings submodule
|
||||
run: git submodule update --init --recursive lib/lv_bindings
|
||||
- name: Update ${{ matrix.port }} port submodules
|
||||
|
||||
4
Kconfig
4
Kconfig
@@ -42,11 +42,9 @@ menu "LVGL configuration"
|
||||
|
||||
config LV_COLOR_SCREEN_TRANSP
|
||||
bool "Enable more complex drawing routines to manage screens transparency."
|
||||
depends on LV_COLOR_DEPTH_32
|
||||
help
|
||||
Can be used if the UI is above another layer, e.g. an OSD menu or video player.
|
||||
Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to
|
||||
non LV_OPA_COVER value
|
||||
The screen's `bg_opa` should be set to non LV_OPA_COVER value
|
||||
|
||||
config LV_COLOR_MIX_ROUND_OFS
|
||||
int "Adjust color mix functions rounding"
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "lvgl/lvgl.h"
|
||||
#endif
|
||||
|
||||
#include "../../../lvgl.h"
|
||||
|
||||
#ifndef LV_ATTRIBUTE_MEM_ALIGN
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN
|
||||
|
||||
@@ -725,7 +725,8 @@ void lv_demo_benchmark_run_scene(int_fast16_t scene_no)
|
||||
scene_act = scene_no >> 1;
|
||||
|
||||
if(scenes[scene_act].create_cb) {
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%d: %s%s", scene_act * 2 + (opa_mode ? 1 : 0), (int)(dimof(scenes) * 2) - 2,
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int32_t)(dimof(scenes) * 2) - 2,
|
||||
scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||
lv_label_set_text(subtitle, "");
|
||||
|
||||
@@ -995,8 +996,8 @@ static void scene_next_task_cb(lv_timer_t * timer)
|
||||
}
|
||||
|
||||
if(scenes[scene_act].create_cb) {
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%d: %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int)(dimof(scenes) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||
lv_label_set_text_fmt(title, "%"LV_PRId32"/%"LV_PRId32": %s%s", scene_act * 2 + (opa_mode ? 1 : 0),
|
||||
(int32_t)(dimof(scenes) * 2) - 2, scenes[scene_act].name, opa_mode ? " + opa" : "");
|
||||
if(opa_mode) {
|
||||
lv_label_set_text_fmt(subtitle, "Result of \"%s\": %"LV_PRId32" FPS", scenes[scene_act].name,
|
||||
scenes[scene_act].fps_normal);
|
||||
|
||||
@@ -1,7 +1,97 @@
|
||||
# Changelog
|
||||
|
||||
## [v8.3.4](https://github.com/lvgl/lvgl/compare/v8.3.4...v8.3.3) 15 December 2022
|
||||
|
||||
## [v8.2.0](https://github.com/lvgl/lvgl/compare/v8.2.0...v8.2.0) 6 July 2022
|
||||
### New Features
|
||||
|
||||
- feat(keyboard): ported arabic keyboard from release 7.10.0 [`3728`](https://github.com/lvgl/lvgl/pull/3728)
|
||||
- feat(table): scroll to the selected cell with key navigation [`39d03a8`](https://github.com/lvgl/lvgl/commit/39d03a80f45847a1977cfe9cc6a509b1613d0aca)
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix(rt-thread): sync rt-thread v5.0.0 rt_align [`3864`](https://github.com/lvgl/lvgl/pull/3864)
|
||||
- fix(draw): SDL2 gradient support #3848 [`3856`](https://github.com/lvgl/lvgl/pull/3856)
|
||||
- fix(esp.cmake): add demos and examples [`3784`](https://github.com/lvgl/lvgl/pull/3784)
|
||||
- fix(indev): fix scrolling on transformed obejcts [`84cf05d`](https://github.com/lvgl/lvgl/commit/84cf05d8b23b31e000db757a278545e58fcbcbe8)
|
||||
- fix(style): add the missing support for pct pivot in tranasform style properties [`c8e584f`](https://github.com/lvgl/lvgl/commit/c8e584f879a1e1427e7a8f5ff496af39f17df41d)
|
||||
- fix(flex): be sure obj->w_layout and h_layout can't be set at the same time [`c4c4007`](https://github.com/lvgl/lvgl/commit/c4c400716e80a279e7b3d43b8992915fe94441eb)
|
||||
- fix(chart): fix very dense bar charts [`bb2c2ac`](https://github.com/lvgl/lvgl/commit/bb2c2ac34ac943978513c7ed51885078979b1c10)
|
||||
- fix(draw): handle LV_COLOR_DEPTH == 1 too in lv_draw_sw_transform [`bd11ad8`](https://github.com/lvgl/lvgl/commit/bd11ad8542eac9ff51420e5afb80f7e6fcf36a5c)
|
||||
- fix(example): fix warnings [`1e3ca25`](https://github.com/lvgl/lvgl/commit/1e3ca25fed13bbf85c32a60d4b7041cf8bd525ab)
|
||||
- fix(benchmark): fix warnings [`1ed026c`](https://github.com/lvgl/lvgl/commit/1ed026ca7307957568fe419f1ff39a15b2535b3e)
|
||||
- fix(draw): fix text color with sub pixel rendering and BGR order [`e050f5c`](https://github.com/lvgl/lvgl/commit/e050f5ca156f79d752894f38f0a437c946205cb4)
|
||||
- fix(meter): fix setting part_draw_dsc.id in needle img drawing [`716e5e2`](https://github.com/lvgl/lvgl/commit/716e5e2c8bd2a22e7d56e8d7ca33054a11a1f4ed)
|
||||
- fix(gridnav): fix stucking in pressed state with encoder [`ad56dfa`](https://github.com/lvgl/lvgl/commit/ad56dfaf7046a9bb8c05e877a8c8852cd14a59af)
|
||||
- fix(darw): add back the disappeared antialising=0 support [`2c17b28`](https://github.com/lvgl/lvgl/commit/2c17b28ac476c95a4153ab6cabb77b1c7208bb74)
|
||||
- fix(msg): fix typos in API by adding wrappers [`41fa416`](https://github.com/lvgl/lvgl/commit/41fa41613455260ccdeb87ecb890ce026ff0a435)
|
||||
- fix(draw): fix transformation accuracy [`e06f03d`](https://github.com/lvgl/lvgl/commit/e06f03db72f98439078118518158f52439dd7bf8)
|
||||
- fix(style): remove the reduntant define of LV_GRADIENT_MAX_STOPS [`903e94b`](https://github.com/lvgl/lvgl/commit/903e94b716ca1b32cdb51de11df679953699e53b)
|
||||
- demo(benchmark): fix lv_label_set_text_fmt format strings [`ae38258`](https://github.com/lvgl/lvgl/commit/ae3825871e31cd42cad2f310bdfc605150670511)
|
||||
- demo(benchmark): fix warning [`1173dcb`](https://github.com/lvgl/lvgl/commit/1173dcba96621e20c9a7240c8572bd6573bce6a0)
|
||||
|
||||
## [v8.3.3](https://github.com/lvgl/lvgl/compare/v8.3.2...v8.3.3) 06 October 2022
|
||||
|
||||
v8.3.3 is the same as v8.3.2. It was released only because the version number was set incorrectly in lvgl.h.
|
||||
|
||||
## [v8.3.2](https://github.com/lvgl/lvgl/compare/v8.3.1...v8.3.2) 27 September 2022
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix(fragment): fixed child fragment event dispatch [`3683`](https://github.com/lvgl/lvgl/pull/3683)
|
||||
- fix(sdl): clear streaming/target texture with FillRect [`3682`](https://github.com/lvgl/lvgl/pull/3682)
|
||||
- fix(sdl): transformation with alpha (#3576) [`3678`](https://github.com/lvgl/lvgl/pull/3678)
|
||||
- fix(draw_sw): fix image cache to access the freed stack space [`3584`](https://github.com/lvgl/lvgl/pull/3584)
|
||||
- fix(style): use compile time prop_cnt for const styles [`3609`](https://github.com/lvgl/lvgl/pull/3609)
|
||||
- fix(demo): can not found lvgl.h file [`3477`](https://github.com/lvgl/lvgl/pull/3477)
|
||||
- fix(ci) checkout lv_micropython release/v8 branch [`3524`](https://github.com/lvgl/lvgl/pull/3524)
|
||||
- fix(canvas): fix clipéping on transformation [`b884aba`](https://github.com/lvgl/lvgl/commit/b884abae26f3824b27783a85d18ed51e550347c1)
|
||||
- fix(draw): allow drawing outline with LV_DRAW_COMPLEX == 0 too [`ece3495`](https://github.com/lvgl/lvgl/commit/ece34950040e218fc73605a4e88f1060c2a274f8)
|
||||
- fix(colorwheel): fix updating color when using lv_colorwheel_set_hsv [`d59bba1`](https://github.com/lvgl/lvgl/commit/d59bba12db115afb4b6aa53eed2625221dfff2fd)
|
||||
- fix(slider): find the nearest value on click instead of floor [`dfd14fa`](https://github.com/lvgl/lvgl/commit/dfd14fa778aef25d0db61748a58aa9989ce5e2c8)
|
||||
- fix(draw): fix border drawing with thick borders [`d5b2a9b`](https://github.com/lvgl/lvgl/commit/d5b2a9b2562cbfa327bf0ec03c11d28576037a14)
|
||||
- fix(refr): fix true double double buffering logic with transparent screens [`8b605cc`](https://github.com/lvgl/lvgl/commit/8b605cc48224d0497cdd936fa77229e0c3d606d2)
|
||||
- fix(group): be sure obj is removed from its current group in lv_group_add_obj [`5156ee0`](https://github.com/lvgl/lvgl/commit/5156ee058d5de674a00ffd84d15d460de7f0e53b)
|
||||
- fix(style): add missing invalidation in lv_obj_remove_local_style_prop [`a0515ba`](https://github.com/lvgl/lvgl/commit/a0515ba30dd74b8b22a6709d334eb03782ee1a4d)
|
||||
|
||||
### Docs
|
||||
|
||||
- docs(draw) remove reference to old lv_fs_add_drv function [`3564`](https://github.com/lvgl/lvgl/pull/3564)
|
||||
- docs(disp): LV_COLOR_SCREEN_TRANSP remove dependency on LV_COLOR_DEPTH_32 as transparency is supported across all color depths [`3556`](https://github.com/lvgl/lvgl/pull/3556)
|
||||
|
||||
### CI and tests
|
||||
|
||||
- ci: protect test.c with #if LV_BUILD_TEST [`be485d7`](https://github.com/lvgl/lvgl/commit/be485d7605136d2a5d6a633c7cb5b7c525cae7ee)
|
||||
|
||||
### Others
|
||||
|
||||
- chore(rt-thread) backport fixes from v9 [`3604`](https://github.com/lvgl/lvgl/pull/3604)
|
||||
|
||||
- chore: fix warnings [`7640950`](https://github.com/lvgl/lvgl/commit/76409502163ffe67cfbab9c7f24f2226cc8a5941)
|
||||
- remove accidentally added code [`5022476`](https://github.com/lvgl/lvgl/commit/5022476edc8676f2a6ef7b919d3578159edeef7c)
|
||||
|
||||
|
||||
## [v8.3.1](https://github.com/lvgl/lvgl/compare/v8.3.0...v8.3.1) 25 July 2022
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix(led): add bg_color draw descriptors back to led draw event to support LV_DRAW_COMPLEX 0 [`3515`](https://github.com/lvgl/lvgl/pull/3515)
|
||||
- fix(slider): fix knob drawing in symmetrical mode [`2967172`](https://github.com/lvgl/lvgl/commit/2967172bee806e77da6ee2307c79e867af3f76bc)
|
||||
- fix(refr): fix lv_refr_get_top_obj [`9750c97`](https://github.com/lvgl/lvgl/commit/9750c97aff4dc3de80559b150852b829f006d6bf)
|
||||
- fix(arc): fix arc knob invalidation in SYMMETRICAL mode [`a283273`](https://github.com/lvgl/lvgl/commit/a283273bd27599dae6b044a941b6591ad45e059b)
|
||||
|
||||
### Examples
|
||||
|
||||
- example(freetype): Update the Micropython example to use the Lato font [`71913d3`](https://github.com/lvgl/lvgl/commit/71913d300dde25d1b87d1b44fa1fa47854defd59)
|
||||
- example(freetype): replace the arial font with lato to avoid licensing issues [`8544cc3`](https://github.com/lvgl/lvgl/commit/8544cc38062d9c817013bbe6aedbb47112e580ad)
|
||||
|
||||
### Docs
|
||||
|
||||
- docs(readme): fix LVGL version typo (8.3.0) [`3462`](https://github.com/lvgl/lvgl/pull/3462)
|
||||
- docs(tasmota): support LVGL 8.3.0 (#3511) [`62662f6`](https://github.com/lvgl/lvgl/commit/62662f68e9cf90adcb96d42030eca5fa135b96a5)
|
||||
|
||||
|
||||
|
||||
## [v8.3.0](https://github.com/lvgl/lvgl/compare/v8.2.0...v8.3.0) 6 July 2022
|
||||
|
||||
|
||||
### Overview
|
||||
|
||||
@@ -31,7 +31,7 @@ In 2021, Tasmota added full support of LVGL for ESP32 based devices. It also int
|
||||
|
||||
A comprehensive mapping of LVGL in Berry language is now available, similar to the mapping of Micropython. It allows to use +98% of all LVGL features. It is also possible to write custom widgets in Berry.
|
||||
|
||||
Versions supported: LVGL v8.0.2, LodePNG v20201017, Freetype 2.10.4
|
||||
Versions supported: LVGL v8.3.0, LodePNG v20201017, Freetype 2.10.4
|
||||
|
||||
### Tasmota + Berry + LVGL could be used for:
|
||||
|
||||
|
||||
@@ -63,11 +63,10 @@ See the [Display background](#display-background) section for more details. If t
|
||||
This configuration (transparent screen and display) could be used to create for example OSD menus where a video is played on a lower layer, and a menu is overlayed on an upper layer.
|
||||
|
||||
To handle transparent displays, special (slower) color mixing algorithms need to be used by LVGL so this feature needs to enabled with `LV_COLOR_SCREEN_TRANSP` in `lv_conf.h`.
|
||||
As this mode operates on the Alpha channel of the pixels `LV_COLOR_DEPTH = 32` is also required. The Alpha channel of 32-bit colors will be 0 where there are no objects and 255 where there are solid objects.
|
||||
The Alpha channel of 32-bit colors will be 0 where there are no objects and 255 where there are solid objects.
|
||||
|
||||
In summary, to enable transparent screens and displays for OSD menu-like UIs:
|
||||
- Enable `LV_COLOR_SCREEN_TRANSP` in `lv_conf.h`
|
||||
- Be sure to use `LV_COLOR_DEPTH 32`
|
||||
- Set the screen's opacity to `LV_OPA_TRANSP` e.g. with `lv_obj_set_style_local_bg_opa(lv_scr_act(), LV_OBJMASK_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP)`
|
||||
- Set the display opacity to `LV_OPA_TRANSP` with `lv_disp_set_bg_opa(NULL, LV_OPA_TRANSP);`
|
||||
|
||||
|
||||
@@ -12,22 +12,40 @@ if(LV_MICROPYTHON)
|
||||
${LVGL_ROOT_DIR}/../
|
||||
REQUIRES
|
||||
main)
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
INTERFACE "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
INTERFACE "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
|
||||
endif()
|
||||
else()
|
||||
idf_component_register(SRCS ${SOURCES} INCLUDE_DIRS ${LVGL_ROOT_DIR}
|
||||
${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../)
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
|
||||
if(CONFIG_LV_BUILD_EXAMPLES)
|
||||
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_LV_USE_DEMO_WIDGETS)
|
||||
file(GLOB_RECURSE DEMO_WIDGETS_SOURCES ${LVGL_ROOT_DIR}/demos/widgets/*.c)
|
||||
list(APPEND DEMO_SOURCES ${DEMO_WIDGETS_SOURCES})
|
||||
endif()
|
||||
if(CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER)
|
||||
file(GLOB_RECURSE DEMO_KEYPAD_AND_ENCODER_SOURCES ${LVGL_ROOT_DIR}/demos/keypad_encoder/*.c)
|
||||
list(APPEND DEMO_SOURCES ${DEMO_KEYPAD_AND_ENCODER_SOURCES})
|
||||
endif()
|
||||
if(CONFIG_LV_USE_DEMO_BENCHMARK)
|
||||
file(GLOB_RECURSE DEMO_BENCHMARK_SOURCES ${LVGL_ROOT_DIR}/demos/benchmark/*.c)
|
||||
list(APPEND DEMO_SOURCES ${DEMO_BENCHMARK_SOURCES})
|
||||
endif()
|
||||
if(CONFIG_LV_USE_DEMO_STRESS)
|
||||
file(GLOB_RECURSE DEMO_STRESS_SOURCES ${LVGL_ROOT_DIR}/demos/stress/*.c)
|
||||
list(APPEND DEMO_SOURCES ${DEMO_STRESS_SOURCES})
|
||||
endif()
|
||||
if(CONFIG_LV_USE_DEMO_MUSIC)
|
||||
file(GLOB_RECURSE DEMO_MUSIC_SOURCES ${LVGL_ROOT_DIR}/demos/music/*.c)
|
||||
list(APPEND DEMO_SOURCES ${DEMO_MUSIC_SOURCES})
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${SOURCES} ${EXAMPLE_SOURCES} ${DEMO_SOURCES}
|
||||
INCLUDE_DIRS ${LVGL_ROOT_DIR} ${LVGL_ROOT_DIR}/src ${LVGL_ROOT_DIR}/../
|
||||
${LVGL_ROOT_DIR}/examples ${LVGL_ROOT_DIR}/demos)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${COMPONENT_LIB} PUBLIC "-DLV_CONF_INCLUDE_SIMPLE")
|
||||
|
||||
if(CONFIG_LV_ATTRIBUTE_FAST_MEM_USE_IRAM)
|
||||
target_compile_definitions(${COMPONENT_LIB}
|
||||
PUBLIC "-DLV_ATTRIBUTE_FAST_MEM=IRAM_ATTR")
|
||||
endif()
|
||||
|
||||
@@ -71,7 +71,11 @@
|
||||
# define LV_BIG_ENDIAN_SYSTEM 0
|
||||
#endif
|
||||
|
||||
#define LV_ATTRIBUTE_MEM_ALIGN ALIGN(4)
|
||||
#ifdef rt_align /* >= RT-Thread v5.0.0 */
|
||||
# define LV_ATTRIBUTE_MEM_ALIGN rt_align(RT_ALIGN_SIZE)
|
||||
#else
|
||||
# define LV_ATTRIBUTE_MEM_ALIGN ALIGN(RT_ALIGN_SIZE)
|
||||
#endif
|
||||
|
||||
/*==================
|
||||
* EXAMPLES
|
||||
|
||||
@@ -31,6 +31,12 @@ extern void lv_port_indev_init(void);
|
||||
extern void lv_user_gui_init(void);
|
||||
|
||||
static struct rt_thread lvgl_thread;
|
||||
|
||||
#ifdef rt_align
|
||||
rt_align(RT_ALIGN_SIZE)
|
||||
#else
|
||||
ALIGN(RT_ALIGN_SIZE)
|
||||
#endif
|
||||
static rt_uint8_t lvgl_thread_stack[PKG_LVGL_THREAD_STACK_SIZE];
|
||||
|
||||
#if LV_USE_LOG
|
||||
|
||||
4
env_support/rt-thread/squareline/README.md
Normal file
4
env_support/rt-thread/squareline/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
This folder is for LVGL SquareLine Studio
|
||||
|
||||
SquareLine Studio can automatically put the generated C files into `ui` folder, so that rt-thread will automatically detect them; or, as a user, you can move the generated C files into `ui` folder manually.
|
||||
|
||||
10
env_support/rt-thread/squareline/SConscript
Normal file
10
env_support/rt-thread/squareline/SConscript
Normal file
@@ -0,0 +1,10 @@
|
||||
from building import *
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = ['lv_ui_entry.c']
|
||||
|
||||
src += Glob(cwd + '/ui/*.c')
|
||||
|
||||
group = DefineGroup('LVGL-SquareLine', src, depend = ['PKG_USING_LVGL_SQUARELINE'])
|
||||
|
||||
Return('group')
|
||||
19
env_support/rt-thread/squareline/lv_ui_entry.c
Normal file
19
env_support/rt-thread/squareline/lv_ui_entry.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-05-13 Meco Man First version
|
||||
*/
|
||||
|
||||
#ifdef __RTTHREAD__
|
||||
|
||||
void lv_user_gui_init(void)
|
||||
{
|
||||
extern void ui_init(void);
|
||||
ui_init();
|
||||
}
|
||||
|
||||
#endif /* __RTTHREAD__ */
|
||||
15
env_support/rt-thread/squareline/ui/lvgl/lvgl.h
Normal file
15
env_support/rt-thread/squareline/ui/lvgl/lvgl.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2022-11-20 Meco Man The first version
|
||||
*/
|
||||
|
||||
#ifdef __RTTHREAD__
|
||||
|
||||
#include "../../../../../lvgl.h" /* back to the root folder's lvgl.h */
|
||||
|
||||
#endif /* __RTTHREAD__ */
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../lv_examples.h"
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_SLIDER && LV_USE_CHART && LV_USE_BTN
|
||||
#if LV_BUILD_EXAMPLES && LV_USE_SLIDER && LV_USE_CHART && LV_USE_BTN && LV_USE_GRID
|
||||
|
||||
/**
|
||||
* the example show the use of cubic-bezier3 in animation.
|
||||
|
||||
@@ -28,7 +28,7 @@ void lv_example_flex_1(void)
|
||||
lv_obj_set_size(obj, 100, LV_PCT(100));
|
||||
|
||||
label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "Item: %u", i);
|
||||
lv_label_set_text_fmt(label, "Item: %"LV_PRIu32, i);
|
||||
lv_obj_center(label);
|
||||
|
||||
/*Add items to the column*/
|
||||
|
||||
BIN
examples/libs/freetype/Lato-Regular.ttf
Normal file
BIN
examples/libs/freetype/Lato-Regular.ttf
Normal file
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@ void lv_example_freetype_1(void)
|
||||
/*Create a font*/
|
||||
static lv_ft_info_t info;
|
||||
/*FreeType uses C standard file system, so no driver letter is required.*/
|
||||
info.name = "./lvgl/examples/libs/freetype/arial.ttf";
|
||||
info.name = "./lvgl/examples/libs/freetype/Lato-Regular.ttf";
|
||||
info.weight = 24;
|
||||
info.style = FT_FONT_STYLE_NORMAL;
|
||||
info.mem = NULL;
|
||||
|
||||
@@ -4,7 +4,7 @@ import display_driver
|
||||
import fs_driver
|
||||
|
||||
info = lv.ft_info_t()
|
||||
info.name ="./arial.ttf"
|
||||
info.name ="./Lato-Regular.ttf"
|
||||
info.weight = 24
|
||||
info.style = lv.FT_FONT_STYLE.NORMAL
|
||||
info.font_init()
|
||||
|
||||
@@ -18,11 +18,11 @@ static void float_btn_event_cb(lv_event_t * e)
|
||||
|
||||
cont = lv_menu_cont_create(sub_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text_fmt(label, "Hello, I am hiding inside %i", btn_cnt);
|
||||
lv_label_set_text_fmt(label, "Hello, I am hiding inside %"LV_PRIu32, btn_cnt);
|
||||
|
||||
cont = lv_menu_cont_create(main_page);
|
||||
label = lv_label_create(cont);
|
||||
lv_label_set_text_fmt(label, "Item %i", btn_cnt);
|
||||
lv_label_set_text_fmt(label, "Item %"LV_PRIu32, btn_cnt);
|
||||
lv_menu_set_load_page_event(menu, cont, sub_page);
|
||||
|
||||
lv_obj_scroll_to_view_recursive(cont, LV_ANIM_ON);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "8.3.0",
|
||||
"version": "8.3.4",
|
||||
"keywords": "graphics, gui, embedded, tft, lvgl",
|
||||
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
|
||||
"repository": {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name=lvgl
|
||||
version=8.3.0
|
||||
version=8.3.4
|
||||
author=kisvegabor
|
||||
maintainer=kisvegabor,embeddedt,pete-pjb
|
||||
sentence=Full-featured Graphics Library for Embedded Systems
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file lv_conf.h
|
||||
* Configuration file for v8.3.0
|
||||
* Configuration file for v8.3.4
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
2
lvgl.h
2
lvgl.h
@@ -15,7 +15,7 @@ extern "C" {
|
||||
***************************/
|
||||
#define LVGL_VERSION_MAJOR 8
|
||||
#define LVGL_VERSION_MINOR 3
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_PATCH 4
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
/*********************
|
||||
|
||||
@@ -113,6 +113,9 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
||||
|
||||
LV_LOG_TRACE("begin");
|
||||
|
||||
/*Be sure the object is removed from its current group*/
|
||||
lv_group_remove_obj(obj);
|
||||
|
||||
/*Do not add the object twice*/
|
||||
lv_obj_t ** obj_i;
|
||||
_LV_LL_READ(&group->obj_ll, obj_i) {
|
||||
|
||||
@@ -852,8 +852,6 @@ static void indev_proc_press(_lv_indev_proc_t * proc)
|
||||
if(indev_reset_check(proc)) return;
|
||||
}
|
||||
|
||||
lv_obj_transform_point(indev_obj_act, &proc->types.pointer.act_point, true, true);
|
||||
|
||||
/*If a new object was found reset some variables and send a pressed event handler*/
|
||||
if(indev_obj_act != proc->types.pointer.act_obj) {
|
||||
proc->types.pointer.last_point.x = proc->types.pointer.act_point.x;
|
||||
@@ -987,6 +985,27 @@ static void indev_proc_release(_lv_indev_proc_t * proc)
|
||||
proc->pr_timestamp = 0;
|
||||
proc->longpr_rep_timestamp = 0;
|
||||
|
||||
|
||||
/*Get the transformed vector with this object*/
|
||||
if(scroll_obj) {
|
||||
int16_t angle = 0;
|
||||
int16_t zoom = 256;
|
||||
lv_point_t pivot = { 0, 0 };
|
||||
lv_obj_t * parent = scroll_obj;
|
||||
while(parent) {
|
||||
angle += lv_obj_get_style_transform_angle(parent, 0);
|
||||
zoom *= (lv_obj_get_style_transform_zoom(parent, 0) / 256);
|
||||
parent = lv_obj_get_parent(parent);
|
||||
}
|
||||
|
||||
if(angle != 0 || zoom != LV_IMG_ZOOM_NONE) {
|
||||
angle = -angle;
|
||||
zoom = (256 * 256) / zoom;
|
||||
lv_point_transform(&proc->types.pointer.scroll_throw_vect, angle, zoom, &pivot);
|
||||
lv_point_transform(&proc->types.pointer.scroll_throw_vect_ori, angle, zoom, &pivot);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*The reset can be set in the Call the ancestor's event handler function.
|
||||
|
||||
@@ -45,12 +45,13 @@ static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_
|
||||
|
||||
void _lv_indev_scroll_handler(_lv_indev_proc_t * proc)
|
||||
{
|
||||
if(proc->types.pointer.vect.x == 0 && proc->types.pointer.vect.y == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
lv_obj_t * scroll_obj = proc->types.pointer.scroll_obj;
|
||||
/*If there is no scroll object yet try to find one*/
|
||||
if(scroll_obj == NULL) {
|
||||
proc->types.pointer.scroll_sum.x += proc->types.pointer.vect.x;
|
||||
proc->types.pointer.scroll_sum.y += proc->types.pointer.vect.y;
|
||||
|
||||
scroll_obj = find_scroll_obj(proc);
|
||||
if(scroll_obj == NULL) return;
|
||||
|
||||
@@ -61,35 +62,50 @@ void _lv_indev_scroll_handler(_lv_indev_proc_t * proc)
|
||||
}
|
||||
|
||||
/*Set new position or scroll if the vector is not zero*/
|
||||
if(proc->types.pointer.vect.x != 0 || proc->types.pointer.vect.y != 0) {
|
||||
lv_coord_t diff_x = 0;
|
||||
lv_coord_t diff_y = 0;
|
||||
|
||||
if(proc->types.pointer.scroll_dir == LV_DIR_HOR) {
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj);
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj);
|
||||
diff_x = elastic_diff(scroll_obj, proc->types.pointer.vect.x, sl, sr, LV_DIR_HOR);
|
||||
}
|
||||
else {
|
||||
lv_coord_t st = lv_obj_get_scroll_top(scroll_obj);
|
||||
lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj);
|
||||
diff_y = elastic_diff(scroll_obj, proc->types.pointer.vect.y, st, sb, LV_DIR_VER);
|
||||
}
|
||||
|
||||
lv_dir_t scroll_dir = lv_obj_get_scroll_dir(scroll_obj);
|
||||
if((scroll_dir & LV_DIR_LEFT) == 0 && diff_x > 0) diff_x = 0;
|
||||
if((scroll_dir & LV_DIR_RIGHT) == 0 && diff_x < 0) diff_x = 0;
|
||||
if((scroll_dir & LV_DIR_TOP) == 0 && diff_y > 0) diff_y = 0;
|
||||
if((scroll_dir & LV_DIR_BOTTOM) == 0 && diff_y < 0) diff_y = 0;
|
||||
|
||||
/*Respect the scroll limit area*/
|
||||
scroll_limit_diff(proc, &diff_x, &diff_y);
|
||||
|
||||
_lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y);
|
||||
if(proc->reset_query) return;
|
||||
proc->types.pointer.scroll_sum.x += diff_x;
|
||||
proc->types.pointer.scroll_sum.y += diff_y;
|
||||
int16_t angle = 0;
|
||||
int16_t zoom = 256;
|
||||
lv_obj_t * parent = scroll_obj;
|
||||
while(parent) {
|
||||
angle += lv_obj_get_style_transform_angle(parent, 0);
|
||||
zoom *= (lv_obj_get_style_transform_zoom(parent, 0) / 256);
|
||||
parent = lv_obj_get_parent(parent);
|
||||
}
|
||||
|
||||
if(angle != 0 || zoom != LV_IMG_ZOOM_NONE) {
|
||||
angle = -angle;
|
||||
zoom = (256 * 256) / zoom;
|
||||
lv_point_t pivot = { 0, 0 };
|
||||
lv_point_transform(&proc->types.pointer.vect, angle, zoom, &pivot);
|
||||
}
|
||||
|
||||
|
||||
|
||||
lv_coord_t diff_x = 0;
|
||||
lv_coord_t diff_y = 0;
|
||||
if(proc->types.pointer.scroll_dir == LV_DIR_HOR) {
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj);
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj);
|
||||
diff_x = elastic_diff(scroll_obj, proc->types.pointer.vect.x, sl, sr, LV_DIR_HOR);
|
||||
}
|
||||
else {
|
||||
lv_coord_t st = lv_obj_get_scroll_top(scroll_obj);
|
||||
lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj);
|
||||
diff_y = elastic_diff(scroll_obj, proc->types.pointer.vect.y, st, sb, LV_DIR_VER);
|
||||
}
|
||||
|
||||
lv_dir_t scroll_dir = lv_obj_get_scroll_dir(scroll_obj);
|
||||
if((scroll_dir & LV_DIR_LEFT) == 0 && diff_x > 0) diff_x = 0;
|
||||
if((scroll_dir & LV_DIR_RIGHT) == 0 && diff_x < 0) diff_x = 0;
|
||||
if((scroll_dir & LV_DIR_TOP) == 0 && diff_y > 0) diff_y = 0;
|
||||
if((scroll_dir & LV_DIR_BOTTOM) == 0 && diff_y < 0) diff_y = 0;
|
||||
|
||||
/*Respect the scroll limit area*/
|
||||
scroll_limit_diff(proc, &diff_x, &diff_y);
|
||||
|
||||
_lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y);
|
||||
if(proc->reset_query) return;
|
||||
proc->types.pointer.scroll_sum.x += diff_x;
|
||||
proc->types.pointer.scroll_sum.y += diff_y;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +115,6 @@ void _lv_indev_scroll_throw_handler(_lv_indev_proc_t * proc)
|
||||
if(scroll_obj == NULL) return;
|
||||
if(proc->types.pointer.scroll_dir == LV_DIR_NONE) return;
|
||||
|
||||
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_coord_t scroll_throw = indev_act->driver->scroll_throw;
|
||||
|
||||
@@ -259,14 +274,36 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
||||
/*Decide if it's a horizontal or vertical scroll*/
|
||||
bool hor_en = false;
|
||||
bool ver_en = false;
|
||||
if(LV_ABS(proc->types.pointer.scroll_sum.x) > LV_ABS(proc->types.pointer.scroll_sum.y)) {
|
||||
hor_en = true;
|
||||
}
|
||||
else {
|
||||
ver_en = true;
|
||||
}
|
||||
|
||||
proc->types.pointer.scroll_sum.x += proc->types.pointer.vect.x;
|
||||
proc->types.pointer.scroll_sum.y += proc->types.pointer.vect.y;
|
||||
|
||||
while(obj_act) {
|
||||
/*Get the transformed scroll_sum with this object*/
|
||||
int16_t angle = 0;
|
||||
int16_t zoom = 256;
|
||||
lv_point_t pivot = { 0, 0 };
|
||||
lv_obj_t * parent = obj_act;
|
||||
while(parent) {
|
||||
angle += lv_obj_get_style_transform_angle(parent, 0);
|
||||
zoom *= (lv_obj_get_style_transform_zoom(parent, 0) / 256);
|
||||
parent = lv_obj_get_parent(parent);
|
||||
}
|
||||
|
||||
lv_point_t obj_scroll_sum = proc->types.pointer.scroll_sum;
|
||||
if(angle != 0 || zoom != LV_IMG_ZOOM_NONE) {
|
||||
angle = -angle;
|
||||
zoom = (256 * 256) / zoom;
|
||||
lv_point_transform(&obj_scroll_sum, angle, zoom, &pivot);
|
||||
}
|
||||
|
||||
if(LV_ABS(obj_scroll_sum.x) > LV_ABS(obj_scroll_sum.y)) {
|
||||
hor_en = true;
|
||||
}
|
||||
else {
|
||||
ver_en = true;
|
||||
}
|
||||
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLLABLE) == false) {
|
||||
/*If this object don't want to chain the scroll to the parent stop searching*/
|
||||
if(lv_obj_has_flag(obj_act, LV_OBJ_FLAG_SCROLL_CHAIN_HOR) == false && hor_en) break;
|
||||
@@ -300,15 +337,15 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
||||
*is propagated to this object it can show at least elastic scroll effect.
|
||||
*But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate)*/
|
||||
if((st > 0 || sb > 0) &&
|
||||
((up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit))) {
|
||||
((up_en && obj_scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && obj_scroll_sum.y <= - scroll_limit))) {
|
||||
obj_candidate = obj_act;
|
||||
dir_candidate = LV_DIR_VER;
|
||||
}
|
||||
|
||||
if((sl > 0 || sr > 0) &&
|
||||
((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit))) {
|
||||
((left_en && obj_scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && obj_scroll_sum.x <= - scroll_limit))) {
|
||||
obj_candidate = obj_act;
|
||||
dir_candidate = LV_DIR_HOR;
|
||||
}
|
||||
@@ -318,11 +355,11 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
||||
if(sl <= 0) left_en = false;
|
||||
if(sr <= 0) right_en = false;
|
||||
|
||||
/*If the object really can be scrolled into the current direction the use it.*/
|
||||
if((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit) ||
|
||||
(up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit)) {
|
||||
/*If the object really can be scrolled into the current direction then use it.*/
|
||||
if((left_en && obj_scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && obj_scroll_sum.x <= - scroll_limit) ||
|
||||
(up_en && obj_scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && obj_scroll_sum.y <= - scroll_limit)) {
|
||||
proc->types.pointer.scroll_dir = hor_en ? LV_DIR_HOR : LV_DIR_VER;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1160,9 +1160,21 @@ static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv)
|
||||
|
||||
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) return;
|
||||
|
||||
lv_point_t pivot;
|
||||
pivot.x = obj->coords.x1 + lv_obj_get_style_transform_pivot_x(obj, 0);
|
||||
pivot.y = obj->coords.y1 + lv_obj_get_style_transform_pivot_y(obj, 0);
|
||||
lv_point_t pivot = {
|
||||
.x = lv_obj_get_style_transform_pivot_x(obj, 0),
|
||||
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
|
||||
};
|
||||
|
||||
if(LV_COORD_IS_PCT(pivot.x)) {
|
||||
pivot.x = (LV_COORD_GET_PCT(pivot.x) * lv_area_get_width(&obj->coords)) / 100;
|
||||
}
|
||||
if(LV_COORD_IS_PCT(pivot.y)) {
|
||||
pivot.y = (LV_COORD_GET_PCT(pivot.y) * lv_area_get_height(&obj->coords)) / 100;
|
||||
}
|
||||
|
||||
pivot.x = obj->coords.x1 + pivot.x;
|
||||
pivot.y = obj->coords.y1 + pivot.y;
|
||||
|
||||
if(inv) {
|
||||
angle = -angle;
|
||||
zoom = (256 * 256) / zoom;
|
||||
|
||||
@@ -314,7 +314,12 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty
|
||||
/*The style is not found*/
|
||||
if(i == obj->style_cnt) return false;
|
||||
|
||||
return lv_style_remove_prop(obj->styles[i].style, prop);
|
||||
lv_res_t res = lv_style_remove_prop(obj->styles[i].style, prop);
|
||||
if(res == LV_RES_OK) {
|
||||
lv_obj_refresh_style(obj, selector, prop);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state,
|
||||
|
||||
@@ -323,15 +323,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
|
||||
refr_invalid_areas();
|
||||
|
||||
|
||||
/*If refresh happened ...*/
|
||||
if(disp_refr->inv_p != 0) {
|
||||
if(disp_refr->driver->full_refresh) {
|
||||
lv_area_t disp_area;
|
||||
lv_area_set(&disp_area, 0, 0, lv_disp_get_hor_res(disp_refr) - 1, lv_disp_get_ver_res(disp_refr) - 1);
|
||||
disp_refr->driver->draw_ctx->buf_area = &disp_area;
|
||||
draw_buf_flush(disp_refr);
|
||||
}
|
||||
|
||||
/*Clean up*/
|
||||
lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
@@ -621,8 +614,11 @@ static void refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
|
||||
/* Below the `area_p` area will be redrawn into the draw buffer.
|
||||
* In single buffered mode wait here until the buffer is freed.*/
|
||||
if(draw_buf->buf1 && !draw_buf->buf2) {
|
||||
* In single buffered mode wait here until the buffer is freed.
|
||||
* In full double buffered mode wait here while the buffers are swapped and a buffer becomes available*/
|
||||
bool full_sized = draw_buf->size == (uint32_t)disp_refr->driver->hor_res * disp_refr->driver->ver_res;
|
||||
if((draw_buf->buf1 && !draw_buf->buf2) ||
|
||||
(draw_buf->buf1 && draw_buf->buf2 && full_sized)) {
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
@@ -710,11 +706,7 @@ static void refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
refr_obj_and_children(draw_ctx, lv_disp_get_layer_top(disp_refr));
|
||||
refr_obj_and_children(draw_ctx, lv_disp_get_layer_sys(disp_refr));
|
||||
|
||||
/*In true double buffered mode flush only once when all areas were rendered.
|
||||
*In normal mode flush after every area*/
|
||||
if(disp_refr->driver->full_refresh == false) {
|
||||
draw_buf_flush(disp_refr);
|
||||
}
|
||||
draw_buf_flush(disp_refr);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -738,9 +730,9 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
lv_event_send(obj, LV_EVENT_COVER_CHECK, &info);
|
||||
if(info.res == LV_COVER_RES_MASKED) return NULL;
|
||||
|
||||
uint32_t i;
|
||||
uint32_t child_cnt = lv_obj_get_child_cnt(obj);
|
||||
for(i = 0; i < child_cnt; i++) {
|
||||
int32_t i;
|
||||
int32_t child_cnt = lv_obj_get_child_cnt(obj);
|
||||
for(i = child_cnt - 1; i >= 0; i--) {
|
||||
lv_obj_t * child = obj->spec_attr->children[i];
|
||||
found_p = lv_refr_get_top_obj(area_p, child);
|
||||
|
||||
@@ -922,6 +914,13 @@ void refr_obj(lv_draw_ctx_t * draw_ctx, lv_obj_t * obj)
|
||||
.y = lv_obj_get_style_transform_pivot_y(obj, 0)
|
||||
};
|
||||
|
||||
if(LV_COORD_IS_PCT(pivot.x)) {
|
||||
pivot.x = (LV_COORD_GET_PCT(pivot.x) * lv_area_get_width(&obj->coords)) / 100;
|
||||
}
|
||||
if(LV_COORD_IS_PCT(pivot.y)) {
|
||||
pivot.y = (LV_COORD_GET_PCT(pivot.y) * lv_area_get_height(&obj->coords)) / 100;
|
||||
}
|
||||
|
||||
lv_draw_img_dsc_t draw_dsc;
|
||||
lv_draw_img_dsc_init(&draw_dsc);
|
||||
draw_dsc.opa = opa;
|
||||
@@ -1189,24 +1188,13 @@ static void draw_buf_flush(lv_disp_t * disp)
|
||||
lv_draw_ctx_t * draw_ctx = disp->driver->draw_ctx;
|
||||
if(draw_ctx->wait_for_finish) draw_ctx->wait_for_finish(draw_ctx);
|
||||
|
||||
/* In double buffered mode wait until the other buffer is freed
|
||||
/* In partial double buffered mode wait until the other buffer is freed
|
||||
* and driver is ready to receive the new buffer */
|
||||
if(draw_buf->buf1 && draw_buf->buf2) {
|
||||
bool full_sized = draw_buf->size == (uint32_t)disp_refr->driver->hor_res * disp_refr->driver->ver_res;
|
||||
if(draw_buf->buf1 && draw_buf->buf2 && !full_sized) {
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
|
||||
/*If the screen is transparent initialize it when the flushing is ready*/
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp_refr->driver->screen_transp) {
|
||||
if(disp_refr->driver->clear_cb) {
|
||||
disp_refr->driver->clear_cb(disp_refr->driver, disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size);
|
||||
}
|
||||
else {
|
||||
lv_memset_00(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
draw_buf->flushing = 1;
|
||||
@@ -1225,6 +1213,7 @@ static void draw_buf_flush(lv_disp_t * disp)
|
||||
call_flush_cb(disp->driver, draw_ctx->buf_area, draw_ctx->buf);
|
||||
}
|
||||
}
|
||||
|
||||
/*If there are 2 buffers swap them. With direct mode swap only on the last area*/
|
||||
if(draw_buf->buf1 && draw_buf->buf2 && (!disp->driver->direct_mode || flushing_last)) {
|
||||
if(draw_buf->buf_act == draw_buf->buf1)
|
||||
|
||||
@@ -144,7 +144,7 @@ void _lv_img_decoder_init(void);
|
||||
* Get information about an image.
|
||||
* 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. Can be
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register()`)
|
||||
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
|
||||
* 3) Symbol: E.g. `LV_SYMBOL_OK`
|
||||
* @param header the image info will be stored here
|
||||
@@ -157,7 +157,7 @@ lv_res_t lv_img_decoder_get_info(const void * src, lv_img_header_t * header);
|
||||
* Try the created image decoders one by one. Once one is able to open the image that decoder is saved in `dsc`
|
||||
* @param dsc describes a decoding session. Simply a pointer to an `lv_img_decoder_dsc_t` variable.
|
||||
* @param src the image source. Can be
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
|
||||
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_drv_register())`)
|
||||
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
|
||||
* 3) Symbol: E.g. `LV_SYMBOL_OK`
|
||||
* @param color The color of the image with `LV_IMG_CF_ALPHA_...`
|
||||
|
||||
@@ -95,7 +95,10 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
internals->target_backup = SDL_GetRenderTarget(ctx->renderer);
|
||||
SDL_SetRenderTarget(ctx->renderer, internals->composition);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 255, 255, 255, 0);
|
||||
SDL_RenderClear(ctx->renderer);
|
||||
/* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_NONE);
|
||||
SDL_RenderFillRect(ctx->renderer, NULL);
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h);
|
||||
dump_masks(internals->mask, apply_area);
|
||||
|
||||
@@ -390,7 +390,10 @@ static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Textur
|
||||
SDL_Texture * old_target = SDL_GetRenderTarget(ctx->renderer);
|
||||
SDL_SetRenderTarget(ctx->renderer, img_frag);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 0, 0, 0, 0);
|
||||
SDL_RenderClear(ctx->renderer);
|
||||
/* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_NONE);
|
||||
SDL_RenderFillRect(ctx->renderer, NULL);
|
||||
SDL_SetRenderDrawBlendMode(ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
|
||||
lv_area_t coords = {0, 0, w - 1, h - 1}, clip;
|
||||
lv_area_t frag_coords = {0, 0, full_frag_size - 1, full_frag_size - 1};
|
||||
|
||||
@@ -64,9 +64,17 @@ lv_draw_layer_ctx_t * lv_draw_sdl_layer_init(lv_draw_ctx_t * draw_ctx, lv_draw_l
|
||||
transform_ctx->target_rect.w = target_w;
|
||||
transform_ctx->target_rect.h = target_h;
|
||||
|
||||
layer_ctx->max_row_with_alpha = target_h;
|
||||
layer_ctx->max_row_with_no_alpha = target_h;
|
||||
|
||||
SDL_SetTextureBlendMode(transform_ctx->target, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderTarget(renderer, transform_ctx->target);
|
||||
SDL_RenderClear(renderer);
|
||||
|
||||
/* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_NONE);
|
||||
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
|
||||
SDL_RenderFillRect(renderer, NULL);
|
||||
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
|
||||
|
||||
/* Set proper drawing context for transform layer */
|
||||
ctx->internals->transform_count += 1;
|
||||
@@ -100,6 +108,7 @@ void lv_draw_sdl_layer_blend(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * lay
|
||||
lv_area_to_sdl_rect(layer_ctx->original.clip_area, &clip_rect);
|
||||
SDL_Point center = {.x = draw_dsc->pivot.x, .y = draw_dsc->pivot.y};
|
||||
SDL_RenderSetClipRect(renderer, &clip_rect);
|
||||
SDL_SetTextureAlphaMod(transform_ctx->target, draw_dsc->opa);
|
||||
SDL_RenderCopyEx(renderer, transform_ctx->target, &transform_ctx->target_rect, &trans_rect,
|
||||
draw_dsc->angle, ¢er, SDL_FLIP_NONE);
|
||||
SDL_RenderSetClipRect(renderer, NULL);
|
||||
|
||||
@@ -126,7 +126,10 @@ static SDL_Texture * line_texture_create(lv_draw_sdl_ctx_t * sdl_ctx, const lv_d
|
||||
SDL_SetRenderTarget(sdl_ctx->renderer, texture);
|
||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0x0);
|
||||
SDL_RenderClear(sdl_ctx->renderer);
|
||||
/* SDL_RenderClear is not working properly, so we overwrite the target with solid color */
|
||||
SDL_SetRenderDrawBlendMode(sdl_ctx->renderer, SDL_BLENDMODE_NONE);
|
||||
SDL_RenderFillRect(sdl_ctx->renderer, NULL);
|
||||
SDL_SetRenderDrawBlendMode(sdl_ctx->renderer, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetRenderDrawColor(sdl_ctx->renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
SDL_Rect line_rect = {1 + dsc->width / 2, 1, length, dsc->width};
|
||||
SDL_RenderFillRect(sdl_ctx->renderer, &line_rect);
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define FRAG_SPACING 3
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -37,6 +39,23 @@ typedef struct {
|
||||
lv_coord_t size;
|
||||
} lv_draw_rect_bg_key_t;
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS];
|
||||
uint8_t stops_count;
|
||||
lv_grad_dir_t dir;
|
||||
} lv_draw_rect_grad_strip_key_t;
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS];
|
||||
uint8_t stops_count;
|
||||
lv_grad_dir_t dir;
|
||||
lv_coord_t w;
|
||||
lv_coord_t h;
|
||||
lv_coord_t radius;
|
||||
} lv_draw_rect_grad_frag_key_t;
|
||||
|
||||
typedef struct {
|
||||
lv_sdl_cache_key_magic_t magic;
|
||||
lv_coord_t radius;
|
||||
@@ -57,6 +76,12 @@ typedef struct {
|
||||
static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_bg_grad_simple(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_grad_dsc_t * grad, bool blend_mod);
|
||||
|
||||
static void draw_bg_grad_radius(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
@@ -81,6 +106,11 @@ static void frag_render_center(SDL_Renderer * renderer, SDL_Texture * frag, lv_c
|
||||
|
||||
static lv_draw_rect_bg_key_t rect_bg_key_create(lv_coord_t radius, lv_coord_t size);
|
||||
|
||||
static lv_draw_rect_grad_frag_key_t rect_grad_frag_key_create(const lv_grad_dsc_t * grad, lv_coord_t w, lv_coord_t h,
|
||||
lv_coord_t radius);
|
||||
|
||||
static lv_draw_rect_grad_strip_key_t rect_grad_strip_key_create(const lv_grad_dsc_t * grad);
|
||||
|
||||
static lv_draw_rect_shadow_key_t rect_shadow_key_create(lv_coord_t radius, lv_coord_t size, lv_coord_t blur);
|
||||
|
||||
static lv_draw_rect_border_key_t rect_border_key_create(lv_coord_t rout, lv_coord_t rin, const lv_area_t * outer_area,
|
||||
@@ -148,16 +178,93 @@ void lv_draw_sdl_draw_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t *
|
||||
SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius)
|
||||
{
|
||||
lv_draw_rect_bg_key_t key = rect_bg_key_create(radius, radius);
|
||||
lv_area_t coords = {0, 0, radius * 2 - 1, radius * 2 - 1};
|
||||
lv_area_t coords_frag = {0, 0, radius - 1, radius - 1};
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
lv_area_t coords = {0, 0, radius * 2 - 1, radius * 2 - 1};
|
||||
lv_area_t coords_frag = {0, 0, radius - 1, radius - 1};
|
||||
lv_draw_mask_radius_param_t mask_rout_param;
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &coords, radius, false);
|
||||
int16_t mask_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||
texture = lv_draw_sdl_mask_dump_texture(ctx->renderer, &coords_frag, &mask_id, 1);
|
||||
SDL_assert(texture != NULL);
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
SDL_assert(texture);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_grad_frag_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad, lv_coord_t w,
|
||||
lv_coord_t h, lv_coord_t radius)
|
||||
{
|
||||
lv_draw_rect_grad_frag_key_t key = rect_grad_frag_key_create(grad, w, h, radius);
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
lv_area_t coords = {0, 0, radius * 2 + FRAG_SPACING - 1, radius * 2 + FRAG_SPACING - 1};
|
||||
texture = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, SDL_TEXTUREACCESS_TARGET,
|
||||
lv_area_get_width(&coords), lv_area_get_height(&coords));
|
||||
SDL_assert(texture != NULL);
|
||||
|
||||
lv_draw_mask_radius_param_t mask_rout_param;
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &coords, radius, false);
|
||||
int16_t mask_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||
SDL_Texture * mask = lv_draw_sdl_mask_dump_texture(ctx->renderer, &coords, &mask_id, 1);
|
||||
SDL_assert(mask != NULL);
|
||||
SDL_SetTextureBlendMode(mask, SDL_BLENDMODE_NONE);
|
||||
lv_draw_mask_remove_id(mask_id);
|
||||
|
||||
SDL_Texture * target_backup = SDL_GetRenderTarget(ctx->renderer);
|
||||
SDL_SetRenderTarget(ctx->renderer, texture);
|
||||
SDL_RenderCopy(ctx->renderer, mask, NULL, NULL);
|
||||
SDL_DestroyTexture(mask);
|
||||
|
||||
lv_area_t blend_coords = {.x1 = 0, .y1 = 0, .x2 = w - 1, .y2 = h - 1};
|
||||
lv_area_t draw_area = {.x1 = 0, .y1 = 0, .x2 = radius - 1, .y2 = radius - 1};
|
||||
/* Align to top left */
|
||||
lv_area_align(&coords, &draw_area, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
lv_area_align(&coords, &blend_coords, LV_ALIGN_TOP_LEFT, 0, 0);
|
||||
draw_bg_grad_simple(ctx, &blend_coords, &draw_area, grad, true);
|
||||
|
||||
/* Align to top right */
|
||||
lv_area_align(&coords, &draw_area, LV_ALIGN_TOP_RIGHT, 0, 0);
|
||||
lv_area_align(&coords, &blend_coords, LV_ALIGN_TOP_RIGHT, 0, 0);
|
||||
draw_bg_grad_simple(ctx, &blend_coords, &draw_area, grad, true);
|
||||
|
||||
/* Align to bottom right */
|
||||
lv_area_align(&coords, &draw_area, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||
lv_area_align(&coords, &blend_coords, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
|
||||
draw_bg_grad_simple(ctx, &blend_coords, &draw_area, grad, true);
|
||||
|
||||
/* Align to bottom left */
|
||||
lv_area_align(&coords, &draw_area, LV_ALIGN_BOTTOM_LEFT, 0, 0);
|
||||
lv_area_align(&coords, &blend_coords, LV_ALIGN_BOTTOM_LEFT, 0, 0);
|
||||
draw_bg_grad_simple(ctx, &blend_coords, &draw_area, grad, true);
|
||||
|
||||
SDL_SetRenderTarget(ctx->renderer, target_backup);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
return texture;
|
||||
}
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_grad_strip_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad)
|
||||
{
|
||||
lv_draw_rect_grad_strip_key_t key = rect_grad_strip_key_create(grad);
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
Uint32 amask = 0xFF000000;
|
||||
Uint32 rmask = 0x00FF0000;
|
||||
Uint32 gmask = 0x0000FF00;
|
||||
Uint32 bmask = 0x000000FF;
|
||||
lv_color_t pixels[256];
|
||||
for(int i = 0; i < 256; i++) {
|
||||
pixels[i] = lv_gradient_calculate(grad, 256, i);
|
||||
}
|
||||
int width = grad->dir == LV_GRAD_DIR_VER ? 1 : 256;
|
||||
int height = grad->dir == LV_GRAD_DIR_VER ? 256 : 1;
|
||||
SDL_Surface * surface = SDL_CreateRGBSurfaceFrom(pixels, width, height, LV_COLOR_DEPTH, width * LV_COLOR_DEPTH / 8,
|
||||
rmask, gmask, bmask, amask);
|
||||
texture = SDL_CreateTextureFromSurface(ctx->renderer, surface);
|
||||
SDL_assert(texture != NULL);
|
||||
SDL_FreeSurface(surface);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &key, sizeof(key), texture);
|
||||
}
|
||||
return texture;
|
||||
@@ -193,7 +300,7 @@ void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1),
|
||||
sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {frag_size + 3 + sx, sy, dw, dh};
|
||||
SDL_Rect src_rect = {frag_size + FRAG_SPACING + sx, sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
@@ -212,7 +319,7 @@ void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1),
|
||||
sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {frag_size + 3 + sx, frag_size + 3 + sy, dw, dh};
|
||||
SDL_Rect src_rect = {frag_size + FRAG_SPACING + sx, frag_size + FRAG_SPACING + sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
@@ -220,7 +327,7 @@ void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture
|
||||
SDL_RenderCopyEx(ctx->renderer, frag, &src_rect, &dst_rect, 0, NULL, SDL_FLIP_HORIZONTAL | SDL_FLIP_VERTICAL);
|
||||
}
|
||||
}
|
||||
/* Lower left, right edge should not be clip */
|
||||
/* Lower left, right edge should not be clipped */
|
||||
corner_area.x1 = coords->x1;
|
||||
corner_area.x2 = coords->x1 + frag_size - 1;
|
||||
if(_lv_area_intersect(&dst_area, &corner_area, clip)) {
|
||||
@@ -231,7 +338,7 @@ void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - corner_area.x1),
|
||||
sy = (lv_coord_t)(dst_area.y1 - corner_area.y1);
|
||||
SDL_Rect src_rect = {sx, frag_size + 3 + sy, dw, dh};
|
||||
SDL_Rect src_rect = {sx, frag_size + FRAG_SPACING + sy, dw, dh};
|
||||
SDL_RenderCopy(ctx->renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
@@ -252,9 +359,23 @@ static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, con
|
||||
if(dsc->bg_opa == 0) {
|
||||
return;
|
||||
}
|
||||
SDL_Color bg_color;
|
||||
lv_color_to_sdl_color(&dsc->bg_color, &bg_color);
|
||||
lv_coord_t radius = dsc->radius;
|
||||
SDL_Color bg_color;
|
||||
if(dsc->bg_grad.dir == LV_GRAD_DIR_NONE) {
|
||||
lv_color_to_sdl_color(&dsc->bg_color, &bg_color);
|
||||
}
|
||||
else if(dsc->bg_grad.stops_count == 1) {
|
||||
lv_color_to_sdl_color(&dsc->bg_grad.stops[0].color, &bg_color);
|
||||
}
|
||||
else {
|
||||
if(radius <= 0) {
|
||||
draw_bg_grad_simple(ctx, coords, draw_area, &dsc->bg_grad, false);
|
||||
}
|
||||
else {
|
||||
draw_bg_grad_radius(ctx, coords, draw_area, dsc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(radius <= 0) {
|
||||
SDL_Rect rect;
|
||||
lv_area_to_sdl_rect(draw_area, &rect);
|
||||
@@ -277,9 +398,111 @@ static void draw_bg_color(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, con
|
||||
frag_render_center(ctx->renderer, texture, real_radius, coords, draw_area, false);
|
||||
}
|
||||
|
||||
static void draw_bg_grad_simple(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_grad_dsc_t * grad, bool blend_mod)
|
||||
{
|
||||
SDL_Rect dstrect;
|
||||
lv_area_to_sdl_rect(draw_area, &dstrect);
|
||||
SDL_Rect srcrect;
|
||||
if(grad->dir == LV_GRAD_DIR_VER) {
|
||||
lv_coord_t coords_h = lv_area_get_height(coords);
|
||||
srcrect.x = 0;
|
||||
srcrect.y = (draw_area->y1 - coords->y1) * 255 / coords_h;
|
||||
srcrect.w = 1;
|
||||
srcrect.h = dstrect.h * 256 / coords_h;
|
||||
|
||||
if(srcrect.y < 0 || srcrect.y > 255) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_coord_t coords_w = lv_area_get_width(coords);
|
||||
srcrect.x = (draw_area->x1 - coords->x1) * 255 / coords_w;
|
||||
srcrect.y = 0;
|
||||
srcrect.w = dstrect.w * 256 / coords_w;
|
||||
srcrect.h = 1;
|
||||
|
||||
if(srcrect.x < 0 || srcrect.x > 255) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_Texture * grad_texture = lv_draw_sdl_rect_grad_strip_obtain(ctx, grad);
|
||||
if(blend_mod) {
|
||||
SDL_SetTextureBlendMode(grad_texture, SDL_BLENDMODE_MOD);
|
||||
}
|
||||
else {
|
||||
SDL_SetTextureBlendMode(grad_texture, SDL_BLENDMODE_BLEND);
|
||||
}
|
||||
|
||||
SDL_RenderCopy(ctx->renderer, grad_texture, &srcrect, &dstrect);
|
||||
}
|
||||
|
||||
static void draw_bg_grad_radius(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
lv_coord_t radius = dsc->radius;
|
||||
/*A small texture with a quarter of the rect is enough*/
|
||||
lv_coord_t bg_w = lv_area_get_width(coords), bg_h = lv_area_get_height(coords);
|
||||
lv_coord_t real_radius = LV_MIN3(bg_w / 2, bg_h / 2, radius);
|
||||
SDL_Texture * grad_texture = lv_draw_sdl_rect_grad_frag_obtain(ctx, &dsc->bg_grad, bg_w, bg_h, radius);
|
||||
SDL_SetTextureBlendMode(grad_texture, SDL_BLENDMODE_BLEND);
|
||||
|
||||
lv_draw_sdl_rect_bg_frag_draw_corners(ctx, grad_texture, real_radius, coords, draw_area, true);
|
||||
lv_area_t part_coords;
|
||||
lv_area_t part_area;
|
||||
if(bg_w > radius * 2) {
|
||||
/*Draw left, middle, right*/
|
||||
part_coords.x1 = 0;
|
||||
part_coords.x2 = radius - 1;
|
||||
part_coords.y1 = radius;
|
||||
part_coords.y2 = bg_h - radius - 1;
|
||||
|
||||
lv_area_align(coords, &part_coords, LV_ALIGN_LEFT_MID, 0, 0);
|
||||
_lv_area_intersect(&part_area, &part_coords, draw_area);
|
||||
draw_bg_grad_simple(ctx, coords, &part_area, &dsc->bg_grad, false);
|
||||
|
||||
lv_area_align(coords, &part_coords, LV_ALIGN_RIGHT_MID, 0, 0);
|
||||
_lv_area_intersect(&part_area, &part_coords, draw_area);
|
||||
draw_bg_grad_simple(ctx, coords, &part_area, &dsc->bg_grad, false);
|
||||
|
||||
part_coords.x1 = radius;
|
||||
part_coords.x2 = bg_w - radius - 1;
|
||||
part_coords.y1 = 0;
|
||||
part_coords.y2 = bg_h - 1;
|
||||
lv_area_align(coords, &part_coords, LV_ALIGN_CENTER, 0, 0);
|
||||
_lv_area_intersect(&part_area, &part_coords, draw_area);
|
||||
draw_bg_grad_simple(ctx, coords, &part_area, &dsc->bg_grad, false);
|
||||
}
|
||||
else if(bg_h > radius * 2) {
|
||||
/*Draw top, middle, bottom*/
|
||||
part_coords.x1 = radius;
|
||||
part_coords.x2 = bg_w - radius - 1;
|
||||
part_coords.y1 = 0;
|
||||
part_coords.y2 = radius - 1;
|
||||
|
||||
lv_area_align(coords, &part_coords, LV_ALIGN_TOP_MID, 0, 0);
|
||||
_lv_area_intersect(&part_area, &part_coords, draw_area);
|
||||
draw_bg_grad_simple(ctx, coords, &part_area, &dsc->bg_grad, false);
|
||||
|
||||
lv_area_align(coords, &part_coords, LV_ALIGN_BOTTOM_MID, 0, 0);
|
||||
_lv_area_intersect(&part_area, &part_coords, draw_area);
|
||||
draw_bg_grad_simple(ctx, coords, &part_area, &dsc->bg_grad, false);
|
||||
|
||||
part_coords.x1 = 0;
|
||||
part_coords.x2 = bg_w - 1;
|
||||
part_coords.y1 = radius;
|
||||
part_coords.y2 = bg_h - radius - 1;
|
||||
lv_area_align(coords, &part_coords, LV_ALIGN_CENTER, 0, 0);
|
||||
_lv_area_intersect(&part_area, &part_coords, draw_area);
|
||||
draw_bg_grad_simple(ctx, coords, &part_area, &dsc->bg_grad, false);
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const lv_area_t * draw_area,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
LV_UNUSED(draw_area);
|
||||
if(SKIP_IMAGE(dsc)) return;
|
||||
|
||||
lv_img_src_t src_type = lv_img_src_get_type(dsc->bg_img_src);
|
||||
@@ -521,8 +744,8 @@ static void draw_border_generic(lv_draw_sdl_ctx_t * ctx, const lv_area_t * outer
|
||||
lv_coord_t frag_size = LV_MAX(radius, max_side);
|
||||
SDL_Texture * texture = lv_draw_sdl_texture_cache_get(ctx, &key, sizeof(key), NULL);
|
||||
if(texture == NULL) {
|
||||
/* Create a mask texture with size of (frag_size * 2 + 3) */
|
||||
const lv_area_t frag_area = {0, 0, frag_size * 2 + 2, frag_size * 2 + 2};
|
||||
/* Create a mask texture with size of (frag_size * 2 + FRAG_SPACING) */
|
||||
const lv_area_t frag_area = {0, 0, frag_size * 2 + FRAG_SPACING - 1, frag_size * 2 + FRAG_SPACING - 1};
|
||||
|
||||
/*Create mask for the outer area*/
|
||||
int16_t mask_ids[2] = {LV_MASK_ID_INV, LV_MASK_ID_INV};
|
||||
@@ -595,7 +818,7 @@ static void frag_render_borders(SDL_Renderer * renderer, SDL_Texture * frag, lv_
|
||||
lv_coord_t dh = lv_area_get_height(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sy = (lv_coord_t)(dst_area.y1 - border_area.y1);
|
||||
SDL_Rect src_rect = {frag_size + 1, frag_size + 3 + sy, 1, dh};
|
||||
SDL_Rect src_rect = {frag_size + 1, frag_size + FRAG_SPACING + sy, 1, dh};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
@@ -634,7 +857,7 @@ static void frag_render_borders(SDL_Renderer * renderer, SDL_Texture * frag, lv_
|
||||
lv_coord_t dw = lv_area_get_width(&dst_area);
|
||||
if(full) {
|
||||
lv_coord_t sx = (lv_coord_t)(dst_area.x1 - border_area.x1);
|
||||
SDL_Rect src_rect = {frag_size + 3 + sx, frag_size + 1, dw, 1};
|
||||
SDL_Rect src_rect = {frag_size + FRAG_SPACING + sx, frag_size + 1, dw, 1};
|
||||
SDL_RenderCopy(renderer, frag, &src_rect, &dst_rect);
|
||||
}
|
||||
else {
|
||||
@@ -682,6 +905,38 @@ static lv_draw_rect_bg_key_t rect_bg_key_create(lv_coord_t radius, lv_coord_t si
|
||||
return key;
|
||||
}
|
||||
|
||||
static lv_draw_rect_grad_frag_key_t rect_grad_frag_key_create(const lv_grad_dsc_t * grad, lv_coord_t w, lv_coord_t h,
|
||||
lv_coord_t radius)
|
||||
{
|
||||
lv_draw_rect_grad_frag_key_t key;
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_RECT_GRAD;
|
||||
key.stops_count = grad->stops_count;
|
||||
key.dir = grad->dir;
|
||||
for(uint8_t i = 0; i < grad->stops_count; i++) {
|
||||
key.stops[i].frac = grad->stops[i].frac;
|
||||
key.stops[i].color = grad->stops[i].color;
|
||||
}
|
||||
key.w = w;
|
||||
key.h = h;
|
||||
key.radius = radius;
|
||||
return key;
|
||||
}
|
||||
|
||||
static lv_draw_rect_grad_strip_key_t rect_grad_strip_key_create(const lv_grad_dsc_t * grad)
|
||||
{
|
||||
lv_draw_rect_grad_strip_key_t key;
|
||||
SDL_memset(&key, 0, sizeof(key));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_RECT_GRAD;
|
||||
key.stops_count = grad->stops_count;
|
||||
key.dir = grad->dir;
|
||||
for(uint8_t i = 0; i < grad->stops_count; i++) {
|
||||
key.stops[i].frac = grad->stops[i].frac;
|
||||
key.stops[i].color = grad->stops[i].color;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
static lv_draw_rect_shadow_key_t rect_shadow_key_create(lv_coord_t radius, lv_coord_t size, lv_coord_t blur)
|
||||
{
|
||||
lv_draw_rect_shadow_key_t key;
|
||||
|
||||
@@ -59,6 +59,11 @@ typedef struct lv_draw_sdl_rect_header_t {
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_bg_frag_obtain(lv_draw_sdl_ctx_t * ctx, lv_coord_t radius);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_grad_frag_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad, lv_coord_t w,
|
||||
lv_coord_t h, lv_coord_t radius);
|
||||
|
||||
SDL_Texture * lv_draw_sdl_rect_grad_strip_obtain(lv_draw_sdl_ctx_t * ctx, const lv_grad_dsc_t * grad);
|
||||
|
||||
void lv_draw_sdl_rect_bg_frag_draw_corners(lv_draw_sdl_ctx_t * ctx, SDL_Texture * frag, lv_coord_t frag_size,
|
||||
const lv_area_t * coords, const lv_area_t * clip, bool full);
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef enum {
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_BG = 0x31,
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_SHADOW = 0x32,
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_BORDER = 0x33,
|
||||
LV_GPU_CACHE_KEY_MAGIC_RECT_GRAD = 0x34,
|
||||
LV_GPU_CACHE_KEY_MAGIC_FONT_GLYPH = 0x41,
|
||||
LV_GPU_CACHE_KEY_MAGIC_MASK = 0x51,
|
||||
} lv_sdl_cache_key_magic_t;
|
||||
|
||||
@@ -103,7 +103,7 @@ void lv_draw_sw_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * d
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_basic(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend_dsc_t * dsc)
|
||||
{
|
||||
const lv_opa_t * mask;
|
||||
lv_opa_t * mask;
|
||||
if(dsc->mask_buf == NULL) mask = NULL;
|
||||
if(dsc->mask_buf && dsc->mask_res == LV_DRAW_MASK_RES_TRANSP) return;
|
||||
else if(dsc->mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask = NULL;
|
||||
@@ -129,7 +129,6 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_basic(lv_draw_ctx_t * draw_ctx, cons
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const lv_color_t * src_buf = dsc->src_buf;
|
||||
lv_coord_t src_stride;
|
||||
if(src_buf) {
|
||||
@@ -142,8 +141,18 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_basic(lv_draw_ctx_t * draw_ctx, cons
|
||||
|
||||
lv_coord_t mask_stride;
|
||||
if(mask) {
|
||||
/*Round the values in the mask if anti-aliasing is disabled*/
|
||||
if(disp->driver->antialiasing == 0) {
|
||||
int32_t mask_size = lv_area_get_size(dsc->mask_area);
|
||||
int32_t i;
|
||||
for(i = 0; i < mask_size; i++) {
|
||||
mask[i] = mask[i] > 128 ? LV_OPA_COVER : LV_OPA_TRANSP;
|
||||
}
|
||||
}
|
||||
|
||||
mask_stride = lv_area_get_width(dsc->mask_area);
|
||||
mask += mask_stride * (blend_area.y1 - dsc->mask_area->y1) + (blend_area.x1 - dsc->mask_area->x1);
|
||||
|
||||
}
|
||||
else {
|
||||
mask_stride = 0;
|
||||
|
||||
@@ -123,7 +123,6 @@ void lv_draw_sw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_la
|
||||
img.header.w = lv_area_get_width(draw_ctx->buf_area);
|
||||
img.header.h = lv_area_get_height(draw_ctx->buf_area);
|
||||
img.header.cf = layer_sw_ctx->has_alpha ? LV_IMG_CF_TRUE_COLOR_ALPHA : LV_IMG_CF_TRUE_COLOR;
|
||||
lv_img_cache_invalidate_src(&img);
|
||||
|
||||
/*Restore the original draw_ctx*/
|
||||
draw_ctx->buf = layer_ctx->original.buf;
|
||||
@@ -135,6 +134,7 @@ void lv_draw_sw_layer_blend(struct _lv_draw_ctx_t * draw_ctx, struct _lv_draw_la
|
||||
/*Blend the layer*/
|
||||
lv_draw_img(draw_ctx, draw_dsc, &layer_ctx->area_act, &img);
|
||||
lv_draw_wait_for_finish(draw_ctx);
|
||||
lv_img_cache_invalidate_src(&img);
|
||||
}
|
||||
|
||||
void lv_draw_sw_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer_ctx)
|
||||
|
||||
@@ -489,8 +489,8 @@ static void draw_letter_subpx(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SUBPX_BGR
|
||||
res_color.ch.blue = (uint32_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
res_color.ch.red = (uint32_t)((uint32_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
|
||||
res_color.ch.red = (uint32_t)((uint16_t)txt_rgb[0] * font_rgb[2] + (bg_rgb[0] * (255 - font_rgb[2]))) >> 8;
|
||||
res_color.ch.blue = (uint32_t)((uint16_t)txt_rgb[2] * font_rgb[0] + (bg_rgb[2] * (255 - font_rgb[0]))) >> 8;
|
||||
#else
|
||||
res_color.ch.red = (uint32_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
res_color.ch.blue = (uint32_t)((uint16_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8;
|
||||
|
||||
@@ -1159,12 +1159,13 @@ void draw_border_generic(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area,
|
||||
|
||||
bool mask_any = lv_draw_mask_is_any(outer_area);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
|
||||
if(!mask_any && rout == 0 && rin == 0) {
|
||||
draw_border_simple(draw_ctx, outer_area, inner_area, color, opa);
|
||||
return;
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
/*Get clipped draw area which is the real draw area.
|
||||
*It is always the same or inside `coords`*/
|
||||
lv_area_t draw_area;
|
||||
@@ -1281,12 +1282,12 @@ void draw_border_generic(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area,
|
||||
/*Draw the corners*/
|
||||
lv_coord_t blend_w;
|
||||
|
||||
/*Left and right corner together is they close to eachother*/
|
||||
/*Left and right corner together if they are close to each other*/
|
||||
if(!split_hor) {
|
||||
/*Calculate the top corner and mirror it to the bottom*/
|
||||
blend_area.x1 = draw_area.x1;
|
||||
blend_area.x2 = draw_area.x2;
|
||||
lv_coord_t max_h = LV_MAX(rout, outer_area->y1 - inner_area->y1);
|
||||
lv_coord_t max_h = LV_MAX(rout, inner_area->y1 - outer_area->y1);
|
||||
for(h = 0; h < max_h; h++) {
|
||||
lv_coord_t top_y = outer_area->y1 + h;
|
||||
lv_coord_t bottom_y = outer_area->y2 - h;
|
||||
@@ -1375,6 +1376,13 @@ void draw_border_generic(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area,
|
||||
|
||||
#else /*LV_DRAW_COMPLEX*/
|
||||
LV_UNUSED(blend_mode);
|
||||
LV_UNUSED(rout);
|
||||
LV_UNUSED(rin);
|
||||
if(!mask_any) {
|
||||
draw_border_simple(draw_ctx, outer_area, inner_area, color, opa);
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
}
|
||||
static void draw_border_simple(lv_draw_ctx_t * draw_ctx, const lv_area_t * outer_area, const lv_area_t * inner_area,
|
||||
|
||||
@@ -122,8 +122,8 @@ void lv_draw_sw_transform(lv_draw_ctx_t * draw_ctx, const lv_area_t * dest_area,
|
||||
xs_step_256 = (256 * xs_diff) / (dest_w - 1);
|
||||
ys_step_256 = (256 * ys_diff) / (dest_w - 1);
|
||||
}
|
||||
int32_t xs_ups = xs1_ups;
|
||||
int32_t ys_ups = ys1_ups;
|
||||
int32_t xs_ups = xs1_ups + 0x80;
|
||||
int32_t ys_ups = ys1_ups + 0x80;
|
||||
|
||||
if(draw_dsc->antialias == 0) {
|
||||
switch(cf) {
|
||||
@@ -180,7 +180,7 @@ static void rgb_no_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, l
|
||||
}
|
||||
else {
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
const uint8_t * src_tmp = src;
|
||||
src_tmp += ys_int * src_stride + xs_int;
|
||||
cbuf[x].full = src_tmp[0];
|
||||
@@ -221,7 +221,7 @@ static void argb_no_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h,
|
||||
const uint8_t * src_tmp = src;
|
||||
src_tmp += (ys_int * src_stride * LV_IMG_PX_SIZE_ALPHA_BYTE) + xs_int * LV_IMG_PX_SIZE_ALPHA_BYTE;
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
cbuf[x].full = src_tmp[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
cbuf[x].full = src_tmp[0] + (src_tmp[1] << 8);
|
||||
@@ -396,7 +396,7 @@ static void argb_and_rgb_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t sr
|
||||
|
||||
if(abuf[x] == 0x00) continue;
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
c_base.full = px_base[0];
|
||||
c_ver.full = px_ver[0];
|
||||
c_hor.full = px_hor[0];
|
||||
@@ -429,7 +429,7 @@ static void argb_and_rgb_aa(const uint8_t * src, lv_coord_t src_w, lv_coord_t sr
|
||||
}
|
||||
/*Partially out of the image*/
|
||||
else {
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8
|
||||
cbuf[x].full = src_tmp[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
cbuf[x].full = src_tmp[0] + (src_tmp[1] << 8);
|
||||
|
||||
@@ -470,8 +470,14 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i
|
||||
}
|
||||
}
|
||||
|
||||
if(f->row) item->w_layout = 1;
|
||||
else item->h_layout = 1;
|
||||
if(f->row) {
|
||||
item->w_layout = 1;
|
||||
item->h_layout = 0;
|
||||
}
|
||||
else {
|
||||
item->h_layout = 1;
|
||||
item->w_layout = 0;
|
||||
}
|
||||
|
||||
if(s != area_get_main_size(&item->coords)) {
|
||||
lv_obj_invalidate(item);
|
||||
|
||||
@@ -139,7 +139,6 @@ static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t
|
||||
return (uint8_t)v.num;
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -187,14 +187,15 @@ void lv_fragment_manager_replace(lv_fragment_manager_t * manager, lv_fragment_t
|
||||
bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, void * userdata)
|
||||
{
|
||||
LV_ASSERT_NULL(manager);
|
||||
lv_fragment_stack_item_t * top = _lv_ll_get_tail(&manager->stack);
|
||||
if(!top) return false;
|
||||
lv_fragment_managed_states_t * states = top->states;
|
||||
lv_fragment_t * instance = states->instance;
|
||||
if(!instance) return false;
|
||||
if(lv_fragment_manager_send_event(instance->child_manager, code, userdata)) return true;
|
||||
if(!states->cls->event_cb) return false;
|
||||
return states->cls->event_cb(instance, code, userdata);
|
||||
lv_fragment_managed_states_t * p = NULL;
|
||||
_LV_LL_READ_BACK(&manager->attached, p) {
|
||||
if(!p->obj_created || p->destroying_obj) continue;
|
||||
lv_fragment_t * instance = p->instance;
|
||||
if(!instance) continue;
|
||||
if(lv_fragment_manager_send_event(instance->child_manager, code, userdata)) return true;
|
||||
if(p->cls->event_cb && p->cls->event_cb(instance, code, userdata)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager)
|
||||
|
||||
@@ -217,6 +217,7 @@ static void gridnav_event_cb(lv_event_t * e)
|
||||
if(dsc->focused_obj == NULL) dsc->focused_obj = find_first_focusable(obj);
|
||||
if(dsc->focused_obj) {
|
||||
lv_obj_add_state(dsc->focused_obj, LV_STATE_FOCUSED | LV_STATE_FOCUS_KEY);
|
||||
lv_obj_clear_state(dsc->focused_obj, LV_STATE_PRESSED); /*Be sure the focuses obj is not stuck in pressed state*/
|
||||
lv_obj_scroll_to_view(dsc->focused_obj, LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +105,17 @@ void * lv_msg_get_user_data(lv_msg_t * m);
|
||||
*/
|
||||
lv_msg_t * lv_event_get_msg(lv_event_t * e);
|
||||
|
||||
/*Fix typo*/
|
||||
static inline void * lv_msg_subscribe(uint32_t msg_id, lv_msg_subscribe_cb_t cb, void * user_data)
|
||||
{
|
||||
return lv_msg_subsribe(msg_id, cb, user_data);
|
||||
}
|
||||
|
||||
static inline void * lv_msg_subscribe_obj(uint32_t msg_id, lv_obj_t * obj, void * user_data)
|
||||
{
|
||||
return lv_msg_subsribe_obj(msg_id, obj, user_data);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
|
||||
@@ -1182,7 +1182,6 @@ static void draw_series_bar(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx)
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
draw_ctx->clip_area = &clip_area;
|
||||
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
|
||||
uint16_t i;
|
||||
@@ -1200,6 +1199,7 @@ static void draw_series_bar(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx)
|
||||
int32_t ser_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_ITEMS) * chart->zoom_x) >> 8; /*Gap between the columns on the ~same X*/
|
||||
lv_coord_t col_w = (block_w - (ser_cnt - 1) * ser_gap) / ser_cnt;
|
||||
if(col_w < 1) col_w = 1;
|
||||
|
||||
lv_coord_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN);
|
||||
lv_coord_t x_ofs = pad_left - lv_obj_get_scroll_left(obj) + border_w;
|
||||
@@ -1531,16 +1531,16 @@ static void draw_x_ticks(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, lv_chart_axis
|
||||
lv_coord_t label_gap;
|
||||
if(axis == LV_CHART_AXIS_PRIMARY_X) {
|
||||
label_gap = t->label_en ? lv_obj_get_style_pad_bottom(obj, LV_PART_TICKS) : 0;
|
||||
y_ofs = obj->coords.y2;
|
||||
y_ofs = obj->coords.y2 + 1;
|
||||
}
|
||||
else {
|
||||
label_gap = t->label_en ? lv_obj_get_style_pad_top(obj, LV_PART_TICKS) : 0;
|
||||
y_ofs = obj->coords.y1;
|
||||
y_ofs = obj->coords.y1 - 1;
|
||||
}
|
||||
|
||||
if(axis == LV_CHART_AXIS_PRIMARY_X) {
|
||||
if(y_ofs > draw_ctx->clip_area->y2) return;
|
||||
if(y_ofs + label_gap + label_dsc.font->line_height + t->major_len < draw_ctx->clip_area->y1) return;
|
||||
if(y_ofs + label_gap + label_dsc.font->line_height + t->major_len < draw_ctx->clip_area->y1) return;
|
||||
}
|
||||
|
||||
lv_draw_line_dsc_t line_dsc;
|
||||
@@ -1634,7 +1634,6 @@ static void draw_x_ticks(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, lv_chart_axis
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc);
|
||||
}
|
||||
|
||||
|
||||
if(p1.x + line_dsc.width / 2 >= obj->coords.x1 &&
|
||||
p2.x - line_dsc.width / 2 <= obj->coords.x2) {
|
||||
lv_draw_line(draw_ctx, &line_dsc, &p1, &p2);
|
||||
|
||||
@@ -613,7 +613,6 @@ static lv_res_t double_click_reset(lv_obj_t * obj)
|
||||
* We replace division by 255 by a division by 256, a.k.a a shift right by 8 bits.
|
||||
* This is wrong, but since this is only used to compute the pixels on the screen and not the final color, it's ok.
|
||||
*/
|
||||
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b);
|
||||
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b)
|
||||
{
|
||||
if(!s) {
|
||||
@@ -652,6 +651,11 @@ static lv_color_t angle_to_mode_color_fast(lv_obj_t * obj, uint16_t angle)
|
||||
uint8_t r = 0, g = 0, b = 0;
|
||||
static uint16_t h = 0;
|
||||
static uint8_t s = 0, v = 0, m = 255;
|
||||
static uint16_t angle_saved = 0xffff;
|
||||
|
||||
/*If the angle is different recalculate scaling*/
|
||||
if(angle_saved != angle) m = 255;
|
||||
angle_saved = angle;
|
||||
|
||||
switch(ext->mode) {
|
||||
default:
|
||||
|
||||
@@ -178,6 +178,7 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &rect_dsc);
|
||||
|
||||
/*Use the original colors brightness to modify color->led*/
|
||||
rect_dsc.bg_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.bg_color));
|
||||
rect_dsc.bg_grad.stops[0].color = lv_color_mix(led->color, lv_color_black(),
|
||||
lv_color_brightness(rect_dsc.bg_grad.stops[0].color));
|
||||
rect_dsc.bg_grad.stops[1].color = lv_color_mix(led->color, lv_color_black(),
|
||||
@@ -187,6 +188,7 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
rect_dsc.outline_color = lv_color_mix(led->color, lv_color_black(), lv_color_brightness(rect_dsc.outline_color));
|
||||
|
||||
/*Mix. the color with black proportionally with brightness*/
|
||||
rect_dsc.bg_color = lv_color_mix(rect_dsc.bg_color, lv_color_black(), led->bright);
|
||||
rect_dsc.bg_grad.stops[0].color = lv_color_mix(rect_dsc.bg_grad.stops[0].color, lv_color_black(), led->bright);
|
||||
rect_dsc.bg_grad.stops[1].color = lv_color_mix(rect_dsc.bg_grad.stops[1].color, lv_color_black(), led->bright);
|
||||
rect_dsc.border_color = lv_color_mix(rect_dsc.border_color, lv_color_black(), led->bright);
|
||||
|
||||
@@ -612,6 +612,7 @@ static void draw_needles(lv_obj_t * obj, lv_draw_ctx_t * draw_ctx, const lv_area
|
||||
if(angle > 3600) angle -= 3600;
|
||||
img_dsc.angle = angle;
|
||||
|
||||
part_draw_dsc.id = LV_METER_DRAW_PART_NEEDLE_IMG;
|
||||
part_draw_dsc.img_dsc = &img_dsc;
|
||||
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc);
|
||||
|
||||
@@ -141,6 +141,7 @@ typedef struct _lv_indev_proc_t {
|
||||
struct {
|
||||
/*Pointer and button data*/
|
||||
lv_point_t act_point; /**< Current point of input device.*/
|
||||
lv_point_t indev_point;
|
||||
lv_point_t last_point; /**< Last point of input device.*/
|
||||
lv_point_t last_raw_point; /**< Last point read from read_cb. */
|
||||
lv_point_t vect; /**< Difference between `act_point` and `last_point`.*/
|
||||
|
||||
@@ -49,16 +49,26 @@ extern "C" {
|
||||
#define LV_IMG_ZOOM_NONE 256 /*Value for not zooming the image*/
|
||||
LV_EXPORT_CONST_INT(LV_IMG_ZOOM_NONE);
|
||||
|
||||
// *INDENT-OFF*
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
#define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .sentinel = LV_STYLE_SENTINEL_VALUE, .v_p = { .const_props = prop_array }, .has_group = 0xFF, .prop1 = LV_STYLE_PROP_ANY }
|
||||
#define LV_STYLE_CONST_INIT(var_name, prop_array) \
|
||||
const lv_style_t var_name = { \
|
||||
.sentinel = LV_STYLE_SENTINEL_VALUE, \
|
||||
.v_p = { .const_props = prop_array }, \
|
||||
.has_group = 0xFF, \
|
||||
.prop1 = LV_STYLE_PROP_ANY, \
|
||||
.prop_cnt = (sizeof(prop_array) / sizeof((prop_array)[0])), \
|
||||
}
|
||||
#else
|
||||
#define LV_STYLE_CONST_INIT(var_name, prop_array) const lv_style_t var_name = { .v_p = { .const_props = prop_array }, .has_group = 0xFF, .prop1 = LV_STYLE_PROP_ANY }
|
||||
#endif
|
||||
|
||||
/** On simple system, don't waste resources on gradients */
|
||||
#if !defined(LV_DRAW_COMPLEX) || !defined(LV_GRADIENT_MAX_STOPS)
|
||||
#define LV_GRADIENT_MAX_STOPS 2
|
||||
#define LV_STYLE_CONST_INIT(var_name, prop_array) \
|
||||
const lv_style_t var_name = { \
|
||||
.v_p = { .const_props = prop_array }, \
|
||||
.has_group = 0xFF, \
|
||||
.prop1 = LV_STYLE_PROP_ANY, \
|
||||
.prop_cnt = (sizeof(prop_array) / sizeof((prop_array)[0])), \
|
||||
}
|
||||
#endif
|
||||
// *INDENT-ON*
|
||||
|
||||
#define LV_STYLE_PROP_META_INHERIT 0x8000
|
||||
#define LV_STYLE_PROP_META_INITIAL 0x4000
|
||||
@@ -440,7 +450,9 @@ static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style,
|
||||
{
|
||||
if(style->prop1 == LV_STYLE_PROP_ANY) {
|
||||
const lv_style_const_prop_t * const_prop;
|
||||
for(const_prop = style->v_p.const_props; const_prop->prop != LV_STYLE_PROP_INV; const_prop++) {
|
||||
uint32_t i;
|
||||
for(i = 0; i < style->prop_cnt; i++) {
|
||||
const_prop = style->v_p.const_props + i;
|
||||
lv_style_prop_t prop_id = LV_STYLE_PROP_ID_MASK(const_prop->prop);
|
||||
if(prop_id == prop) {
|
||||
if(const_prop->prop & LV_STYLE_PROP_META_INHERIT)
|
||||
|
||||
@@ -757,9 +757,15 @@ static lv_coord_t get_angle(const lv_obj_t * obj)
|
||||
angle += arc->indic_angle_start;
|
||||
}
|
||||
else if(arc->type == LV_ARC_MODE_SYMMETRICAL) {
|
||||
int32_t range_midpoint = (int32_t)(arc->min_value + arc->max_value) / 2;
|
||||
if(arc->value < range_midpoint) angle += arc->indic_angle_start;
|
||||
else angle += arc->indic_angle_end;
|
||||
int16_t bg_end = arc->bg_angle_end;
|
||||
if(arc->bg_angle_end < arc->bg_angle_start) bg_end = arc->bg_angle_end + 360;
|
||||
int16_t indic_end = arc->indic_angle_end;
|
||||
if(arc->indic_angle_end < arc->indic_angle_start) indic_end = arc->indic_angle_end + 360;
|
||||
|
||||
int32_t angle_midpoint = (int32_t)(arc->bg_angle_start + bg_end) / 2;
|
||||
if(arc->indic_angle_start < angle_midpoint) angle += arc->indic_angle_start;
|
||||
else if(indic_end > angle_midpoint) angle += arc->indic_angle_end;
|
||||
else angle += angle_midpoint;
|
||||
}
|
||||
|
||||
return angle;
|
||||
|
||||
@@ -181,10 +181,10 @@ void lv_canvas_transform(lv_obj_t * obj, lv_img_dsc_t * src_img, int16_t angle,
|
||||
draw_dsc.antialias = antialias;
|
||||
|
||||
lv_area_t dest_area;
|
||||
dest_area.x1 = 0;
|
||||
dest_area.x2 = dest_img->header.w - 1;
|
||||
dest_area.y1 = 0;
|
||||
dest_area.y2 = 0;
|
||||
dest_area.x1 = -offset_x;
|
||||
dest_area.x2 = dest_area.x1 + dest_img->header.w - 1;
|
||||
dest_area.y1 = -offset_y;
|
||||
dest_area.y2 = -offset_y;
|
||||
|
||||
lv_color_t * cbuf = lv_mem_alloc(dest_img->header.w * sizeof(lv_color_t));
|
||||
lv_opa_t * abuf = lv_mem_alloc(dest_img->header.w * sizeof(lv_opa_t));
|
||||
@@ -194,15 +194,12 @@ void lv_canvas_transform(lv_obj_t * obj, lv_img_dsc_t * src_img, int16_t angle,
|
||||
&draw_dsc, canvas->dsc.header.cf, cbuf, abuf);
|
||||
|
||||
for(x = 0; x < dest_img->header.w; x++) {
|
||||
if(x + offset_x < 0) continue;
|
||||
if(x + offset_x >= dest_img->header.w) break;
|
||||
if(abuf[x]) {
|
||||
lv_img_buf_set_px_color(dest_img, x + offset_x, y + offset_y, cbuf[x]);
|
||||
lv_img_buf_set_px_alpha(dest_img, x + offset_x, y + offset_y, abuf[x]);
|
||||
lv_img_buf_set_px_color(dest_img, x, y, cbuf[x]);
|
||||
lv_img_buf_set_px_alpha(dest_img, x, y, abuf[x]);
|
||||
}
|
||||
}
|
||||
|
||||
if(y + offset_y >= dest_img->header.h) break;
|
||||
dest_area.y1++;
|
||||
dest_area.y2++;
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
/*Make the point relative to the indicator*/
|
||||
new_value = p.x - (obj->coords.x1 + bg_left);
|
||||
}
|
||||
new_value = (new_value * range) / indic_w;
|
||||
new_value = (new_value * range + indic_w / 2) / indic_w;
|
||||
new_value += slider->bar.min_value;
|
||||
}
|
||||
else {
|
||||
@@ -223,7 +223,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
|
||||
/*Make the point relative to the indicator*/
|
||||
new_value = p.y - (obj->coords.y2 + bg_bottom);
|
||||
new_value = (-new_value * range) / indic_h;
|
||||
new_value = (-new_value * range + indic_h / 2) / indic_h;
|
||||
new_value += slider->bar.min_value;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,6 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
|
||||
new_value = LV_CLAMP(real_min_value, new_value, real_max_value);
|
||||
|
||||
if(*slider->value_to_set != new_value) {
|
||||
*slider->value_to_set = new_value;
|
||||
lv_obj_invalidate(obj);
|
||||
@@ -337,15 +336,16 @@ static void draw_knob(lv_event_t * e)
|
||||
|
||||
lv_area_t knob_area;
|
||||
lv_coord_t knob_size;
|
||||
bool is_symmetrical = false;
|
||||
if(slider->bar.mode == LV_BAR_MODE_SYMMETRICAL && slider->bar.min_value < 0 &&
|
||||
slider->bar.max_value > 0) is_symmetrical = true;
|
||||
|
||||
if(is_horizontal) {
|
||||
knob_size = lv_obj_get_height(obj);
|
||||
knob_area.x1 = LV_SLIDER_KNOB_COORD(is_rtl, slider->bar.indic_area);
|
||||
if(is_symmetrical && slider->bar.cur_value < 0) knob_area.x1 = slider->bar.indic_area.x1;
|
||||
else knob_area.x1 = LV_SLIDER_KNOB_COORD(is_rtl, slider->bar.indic_area);
|
||||
}
|
||||
else {
|
||||
bool is_symmetrical = false;
|
||||
if(slider->bar.mode == LV_BAR_MODE_SYMMETRICAL && slider->bar.min_value < 0 &&
|
||||
slider->bar.max_value > 0) is_symmetrical = true;
|
||||
|
||||
knob_size = lv_obj_get_width(obj);
|
||||
if(is_symmetrical && slider->bar.cur_value < 0) knob_area.y1 = slider->bar.indic_area.y2;
|
||||
else knob_area.y1 = slider->bar.indic_area.y1;
|
||||
|
||||
@@ -42,6 +42,7 @@ static lv_res_t get_pressed_cell(lv_obj_t * obj, uint16_t * row, uint16_t * col)
|
||||
static size_t get_cell_txt_len(const char * txt);
|
||||
static void copy_cell_txt(char * dst, const char * txt);
|
||||
static void get_cell_area(lv_obj_t * obj, uint16_t row, uint16_t col, lv_area_t * area);
|
||||
static void scroll_to_selected_cell(lv_obj_t * obj);
|
||||
|
||||
static inline bool is_cell_empty(void * cell)
|
||||
{
|
||||
@@ -516,6 +517,7 @@ static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
if(col == LV_TABLE_CELL_NONE || row == LV_TABLE_CELL_NONE) {
|
||||
table->col_act = 0;
|
||||
table->row_act = 0;
|
||||
scroll_to_selected_cell(obj);
|
||||
lv_obj_invalidate(obj);
|
||||
return;
|
||||
}
|
||||
@@ -560,6 +562,8 @@ static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
table->row_act = row;
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
scroll_to_selected_cell(obj);
|
||||
|
||||
res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
@@ -1004,4 +1008,26 @@ static void get_cell_area(lv_obj_t * obj, uint16_t row, uint16_t col, lv_area_t
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void scroll_to_selected_cell(lv_obj_t * obj)
|
||||
{
|
||||
lv_table_t * table = (lv_table_t *)obj;
|
||||
|
||||
lv_area_t a;
|
||||
get_cell_area(obj, table->row_act, table->col_act, &a);
|
||||
if(a.x1 < 0) {
|
||||
lv_obj_scroll_by_bounded(obj, -a.x1, 0, LV_ANIM_ON);
|
||||
}
|
||||
else if(a.x2 > lv_obj_get_width(obj)) {
|
||||
lv_obj_scroll_by_bounded(obj, lv_obj_get_width(obj) - a.x2, 0, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
if(a.y1 < 0) {
|
||||
lv_obj_scroll_by_bounded(obj, 0, -a.y1, LV_ANIM_ON);
|
||||
}
|
||||
else if(a.y2 > lv_obj_get_height(obj)) {
|
||||
lv_obj_scroll_by_bounded(obj, 0, lv_obj_get_height(obj) - a.y2, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,7 @@ LVGL_DIR := $(CURDIR)/../..
|
||||
include ../../lvgl.mk
|
||||
|
||||
CSRCS += test.c
|
||||
CFLAGS += -DLV_CONF_SKIP=1 -I$(LVGL_DIR)/..
|
||||
CFLAGS += -DLV_CONF_SKIP=1 -DLV_BUILD_TEST=1 -I$(LVGL_DIR)/..
|
||||
COBJS := $(patsubst %.c, %.o, $(CSRCS))
|
||||
|
||||
test_file: $(COBJS)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include <stdio.h>
|
||||
#include "lvgl/lvgl.h"
|
||||
|
||||
@@ -5,3 +6,4 @@ int main(void) {
|
||||
lv_init();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user