Compare commits
102 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6f89ad799 | ||
|
|
857ff5e8ed | ||
|
|
ee6c5e3399 | ||
|
|
5c7e9bb932 | ||
|
|
0f95c5b29b | ||
|
|
382f428a0e | ||
|
|
a91041bcf7 | ||
|
|
4fb0a5da21 | ||
|
|
f6b759dc71 | ||
|
|
6e1d53e11e | ||
|
|
7ac9388aed | ||
|
|
486197955b | ||
|
|
69e2f32984 | ||
|
|
5fe03c34f5 | ||
|
|
af312fd2ba | ||
|
|
ac52b502a2 | ||
|
|
f00d17b496 | ||
|
|
f252edb5c1 | ||
|
|
e45cd3c31c | ||
|
|
0f8513bf77 | ||
|
|
97392f4fdf | ||
|
|
74a0b0dab2 | ||
|
|
79329bdb45 | ||
|
|
d7940734b8 | ||
|
|
d9ebf93836 | ||
|
|
eda4ef8042 | ||
|
|
9b598ec306 | ||
|
|
93e8dd7a2c | ||
|
|
a78687ee5d | ||
|
|
a1db29b9a2 | ||
|
|
52644c2604 | ||
|
|
34b20b307b | ||
|
|
42c5794a05 | ||
|
|
d2a0fb8351 | ||
|
|
48914aaa7c | ||
|
|
8f0418d194 | ||
|
|
ecc23babc5 | ||
|
|
3f32911b90 | ||
|
|
6c1f784d25 | ||
|
|
18834904ef | ||
|
|
ba5663d3d3 | ||
|
|
d819aa0e4e | ||
|
|
ecb5637d9d | ||
|
|
b933e5e1ba | ||
|
|
d6db1ed511 | ||
|
|
eaeb362001 | ||
|
|
61bafdb37f | ||
|
|
a4ed5369c2 | ||
|
|
72988117d5 | ||
|
|
a760baa869 | ||
|
|
a026a5b61d | ||
|
|
25aadd4ae9 | ||
|
|
38a42fa954 | ||
|
|
e6f498a2da | ||
|
|
2500c65506 | ||
|
|
f387e1af37 | ||
|
|
2b9608d128 | ||
|
|
341e99587b | ||
|
|
9dd387b23e | ||
|
|
ceae45ed64 | ||
|
|
5f1b6bc281 | ||
|
|
33df0e6470 | ||
|
|
7aaa092efd | ||
|
|
232d22c148 | ||
|
|
9975036bb2 | ||
|
|
695c33147b | ||
|
|
6a96e07f18 | ||
|
|
bc994c60ee | ||
|
|
0c6d0d48a3 | ||
|
|
835ed44029 | ||
|
|
d1f1332555 | ||
|
|
27621e0945 | ||
|
|
d6b85d16cf | ||
|
|
64fdfbe13f | ||
|
|
18010c2eaa | ||
|
|
8e87fc4620 | ||
|
|
12919453d3 | ||
|
|
adbc158a5c | ||
|
|
69b14a6146 | ||
|
|
7d42f08431 | ||
|
|
95d5298ad9 | ||
|
|
1633b2e6db | ||
|
|
1e59100ff2 | ||
|
|
6337286959 | ||
|
|
ffa2970ae5 | ||
|
|
fdb85fd9bd | ||
|
|
c3361a67b2 | ||
|
|
a7c1d97164 | ||
|
|
aad8667a9f | ||
|
|
bdc98b4e1f | ||
|
|
a42629f947 | ||
|
|
4494fc8a5d | ||
|
|
41c435b808 | ||
|
|
929bbcaee4 | ||
|
|
013e6e9b21 | ||
|
|
c2404c307c | ||
|
|
5e9dd93e76 | ||
|
|
7260eb71f0 | ||
|
|
af5ed425c0 | ||
|
|
3c8c67a22e | ||
|
|
271ec3f6ee | ||
|
|
f7f675afd8 |
@@ -1,13 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## v7.0.0 - under development
|
||||
## v7.0.0 (18.05.2020)
|
||||
To try the new version use the `dev-7.0` branch of LVGL and the [Simulator](https://github.com/littlevgl/lv_sim_eclipse_sdl/tree/dev-7.0).
|
||||
|
||||
### Documentation
|
||||
The docs for v7 is available at https://docs.littlevgl.com/v7/en/html/index.html
|
||||
|
||||
### Legal changes
|
||||
*In progress*
|
||||
|
||||
The name of the project is changed to LVGL and the new website is on https://lvgl.io
|
||||
|
||||
|
||||
229
README.md
229
README.md
@@ -1,7 +1,7 @@
|
||||
<h1 align="center"> LittlevGL - Open-source Embedded GUI Library</h1>
|
||||
<h1 align="center"> LVGL - Little and Versatile Graphics Library</h1>
|
||||
<p align="center">
|
||||
<a href="https://github.com/littlevgl/lvgl/blob/master/LICENCE.txt"><img src="https://img.shields.io/badge/licence-MIT-blue.svg"></a>
|
||||
<a href="https://github.com/littlevgl/lvgl/releases/tag/v6.1.2"><img src="https://img.shields.io/badge/version-6.1.2-blue.svg"></a>
|
||||
<a href="https://github.com/littlevgl/lvgl/releases/tag/v7.0.0"><img src="https://img.shields.io/badge/version-6.1.2-blue.svg"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -9,16 +9,16 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
LittlevGL provides everything you need to create a Graphical User Interface (GUI) on embedded systems with easy-to-use graphical elements, beautiful visual effects and low memory footprint.
|
||||
LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.
|
||||
</p>
|
||||
|
||||
<h4 align="center">
|
||||
<a href="https://littlevgl.com">Website </a> ·
|
||||
<a href="https://littlevgl.com/live-demo">Live demo</a> ·
|
||||
<a href="https://docs.littlevgl.com/en/html/get-started/pc-simulator.html">Simulator</a> ·
|
||||
<a href="https://forum.littlevgl.com">Forum</a> ·
|
||||
<a href="https://docs.littlevgl.com/">Docs</a> ·
|
||||
<a href="https://blog.littlevgl.com/">Blog</a>
|
||||
<a href="https://lvgl.io">Website </a> ·
|
||||
<a href="https://lvgl.io/demos">Live demo</a> ·
|
||||
<a href="https://docs.littlevgl.com/v7/en/html/get-started/pc-simulator.html">Simulator</a> ·
|
||||
<a href="https://forum.lvgl.io">Forum</a> ·
|
||||
<a href="https://docs.lvgl.io/">Docs</a> ·
|
||||
<a href="https://blog.lvgl.io/">Blog</a>
|
||||
</h4>
|
||||
|
||||
---
|
||||
@@ -30,7 +30,6 @@ LittlevGL provides everything you need to create a Graphical User Interface (GUI
|
||||
- [Learn the basics](#learn-the-basics)
|
||||
- [Examples](#examples)
|
||||
- [Contributing](#contributing)
|
||||
- [Donate](#donate)
|
||||
|
||||
|
||||
## Features
|
||||
@@ -44,8 +43,8 @@ LittlevGL provides everything you need to create a Graphical User Interface (GUI
|
||||
* **Scalable** to operate with little memory (64 kB Flash, 10 kB RAM)
|
||||
* **OS, External memory and GPU** supported but not required
|
||||
* **Single frame buffer** operation even with advances graphical effects
|
||||
* **Written in C** for maximal compatibility
|
||||
* **Micropython Binding** exposes [LittlevGL API in Micropython](https://blog.littlevgl.com/2019-02-20/micropython-bindings)
|
||||
* **Written in C** for maximal compatibility (C++ compatible)
|
||||
* **Micropython Binding** exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
|
||||
* **Simulator** to develop on PC without embedded hardware
|
||||
* **Tutorials, examples, themes** for rapid development
|
||||
* **Documentation** and API references
|
||||
@@ -66,12 +65,12 @@ Basically, every modern controller - which is able to drive a display - is suita
|
||||
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
|
||||
|
||||
Just to mention some **platforms**:
|
||||
- STM32F1, STM32F3, [STM32F4](https://blog.littlevgl.com/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/littlevgl/stm32f746_disco_no_os_sw4stm32)
|
||||
- STM32F1, STM32F3, [STM32F4](https://blog.lvgl.io/2017-07-15/stm32f429_disco_port), [STM32F7](https://github.com/littlevgl/stm32f746_disco_no_os_sw4stm32)
|
||||
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
|
||||
- NXP Kinetis, LPC, iMX
|
||||
- [Linux frame buffer](https://blog.littlevgl.com/2018-01-03/linux_fb) (/dev/fb)
|
||||
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
|
||||
- [Raspberry PI](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
|
||||
- [Espressif ESP32](https://github.com/littlevgl/lv_port_esp32)
|
||||
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
|
||||
- Nordic nrf52
|
||||
- Quectell M66
|
||||
|
||||
@@ -82,22 +81,22 @@ Choose a project with your favourite IDE:
|
||||
|
||||
| Eclipse | CodeBlocks | Visual Studio | PlatformIO | Qt Creator |
|
||||
|-------------|-------------|---------------|-----------|------------|
|
||||
| [](https://github.com/littlevgl/pc_simulator_sdl_eclipse) | [](https://github.com/littlevgl/pc_simulator_win_codeblocks) | [](https://github.com/littlevgl/visual_studio_2017_sdl_x64) | [](https://github.com/littlevgl/pc_simulator_sdl_platformio) | [](https://blog.littlevgl.com/2019-01-03/qt-creator) |
|
||||
| [](https://github.com/lvgl/pc_simulator_sdl_eclipse) | [](https://github.com/lvgl/pc_simulator_win_codeblocks) | [](https://github.com/lvgl/visual_studio_2017_sdl_x64) | [](https://github.com/lvgl/pc_simulator_sdl_platformio) | [](https://blog.lvgl.io/2019-01-03/qt-creator) |
|
||||
| Cross-platform<br>with SDL<br>(Recommended on<br>Linux and Mac) | Native Windows | Windows<br>with SDL | Cross-platform<br>with SDL | Cross-platform<br>with SDL |
|
||||
|
||||
|
||||
## Add LittlevGL to your project
|
||||
|
||||
The steps below show how to setup LittlevGL on an embedded system with a display and a touchpad.
|
||||
You can use the [Simulators](https://docs.littlevgl.com/en/html/get-started/pc-simulator) to get ready to use projects which can be run on your PC.
|
||||
The steps below show how to setup LVGL on an embedded system with a display and a touchpad.
|
||||
You can use the [Simulators](https://docs.lvgl.io/v7/en/html/get-started/pc-simulator) to get ready to use projects which can be run on your PC.
|
||||
|
||||
1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library
|
||||
1. [Download](https://lvgl.com/developers) or [Clone](https://github.com/lvgl/lvgl) the library
|
||||
2. Copy the `lvgl` folder into your project
|
||||
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. Don't forget to **change the `#if 0` statement near the top of the file to `#if 1`**, otherwise you will get compilation errors.
|
||||
4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions.
|
||||
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL.
|
||||
4. Include `lvgl/lvgl.h` where you need to use LVGL related functions.
|
||||
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LVGL.
|
||||
6. Call `lv_init()`
|
||||
7. Create a display buffer for LittlevGL
|
||||
7. Create a display buffer for LVGL
|
||||
```c
|
||||
static lv_disp_buf_t disp_buf;
|
||||
static lv_color_t buf[LV_HOR_RES_MAX * 10]; /*Declare a buffer for 10 lines*/
|
||||
@@ -154,16 +153,19 @@ It will redraw the screen if required, handle input devices etc.
|
||||
|
||||
## Learn the basics
|
||||
|
||||
### Objects (Widgets)
|
||||
In this section you can ready the very basics. For a more detailed guide check the [Quick overview]
|
||||
(https://docs.littlevgl.com/v7/en/html/get-started/quick-overview.html#learn-the-basics) in the documentation.
|
||||
|
||||
The graphical elements like Buttons, Labels, Sliders, Charts etc are called objects in LittelvGL. Go to [Object types](https://docs.littlevgl.com/en/html/object-types/index) to see the full list of available types.
|
||||
### Widgets (Objects)
|
||||
|
||||
The graphical elements like Buttons, Labels, Sliders, Charts etc are called objects in LittelvGL. Go to [Object types](https://docs.littlevgl.com/v7/en/html/widgets/index) to see the full list of available types.
|
||||
|
||||
Every object has a parent object. The child object moves with the parent and if you delete the parent the children will be deleted too. Children can be visible only on their parent.
|
||||
|
||||
The *screen* are the "root" parents. To get the current screen call `lv_scr_act()`.
|
||||
|
||||
You can create a new object with `lv_<type>_create(parent, obj_to_copy)`. It will return an `lv_obj_t *` variable which should be used as a reference to the object to set its parameters.
|
||||
The first parameter is the desired *parent*, te second parameters can be an object to copy (`NULL` is unused).
|
||||
The first parameter is the desired *parent*, the second parameters can be an object to copy (`NULL` if unused).
|
||||
For example:
|
||||
```c
|
||||
lv_obj_t * slider1 = lv_slider_create(lv_scr_act(), NULL);
|
||||
@@ -184,30 +186,27 @@ lv_slider_set_value(slider1, 70, LV_ANIM_ON);
|
||||
To see the full API visit the documentation of the object types or the related header file (e.g. `lvgl/src/lv_objx/lv_slider.h`).
|
||||
|
||||
### Styles
|
||||
Styles can be assigned to the objects to changed their appearance. A style describes the appearance of rectangle-like objects (like a button or slider), texts, images and lines at once.
|
||||
|
||||
You can create a new style like this:
|
||||
Widgets are created with a default appearance but it can be changed by adding new styles to the object. A new style can be created like this:
|
||||
```c
|
||||
static lv_style_t style1; /*Declare a new style. Should be `static`*/
|
||||
lv_style_copy(&style1, &lv_style_plain); /*Copy a built-in style*/
|
||||
style1.body.main_color = LV_COLOR_RED; /*Main color*/
|
||||
style1.body.grad_color = lv_color_hex(0xffd83c) /*Gradient color (orange)*/
|
||||
style1.body.radius = 3;
|
||||
style1.text.color = lv_color_hex3(0x0F0) /*Label color (green)*/
|
||||
style1.text.font = &lv_font_dejavu_22; /*Change font*/
|
||||
...
|
||||
static lv_style_t style1; /*Should be static, global or dynamically allocated*/
|
||||
lv_style_init(&style1);
|
||||
lv_style_set_bg_color(&style1, LV_STATE_DEFAULT, LV_COLOR_RED); /*Default background color*/
|
||||
lv_style_set_bg_color(&style1, LV_STATE_PRESSED, LV_COLOR_BLUE); /*Pressed background color*/
|
||||
```
|
||||
|
||||
To set a new style for an object use the `lv_<type>set_style(obj, LV_<TYPE>_STYLE_<NAME>, &my_style)` functions. For example:
|
||||
```c
|
||||
lv_slider_set_style(slider1, LV_SLIDER_STYLE_BG, &slider_bg_style);
|
||||
lv_slider_set_style(slider1, LV_SLIDER_STYLE_INDIC, &slider_indic_style);
|
||||
lv_slider_set_style(slider1, LV_SLIDER_STYLE_KNOB, &slider_knob_style);
|
||||
The wigedt have *parts* which can be referenced via `LV_<TYPE>_PART_<PART_NAME>`. E.g. `LV_BRN_PART_MAIN` or `LV_SLIDER_PART_KNOB`. See the documentation of the widgets to see the exisitng parts.
|
||||
|
||||
To add the style to a button:
|
||||
```
|
||||
lv_obj_add_style(btn1, LV_BTN_PART_MAIN, &style1);
|
||||
```
|
||||
|
||||
If an object's style is `NULL` then it will inherit its parent's style. For example, the labels' style are `NULL` by default. If you place them on a button then they will use the `style.text` properties from the button's style.
|
||||
To remove all styles from an object use:
|
||||
```c
|
||||
lv_obj_reset_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
```
|
||||
|
||||
Learn more in [Style overview](https://docs.littlevgl.com/en/html/overview/style) section.
|
||||
Learn more in [Style overview](https://docs.lvgl.io/v7/en/html/overview/style) section.
|
||||
|
||||
### Events
|
||||
Events are used to inform the user if something has happened with an object. You can assign a callback to an object which will be called if the object is clicked, released, dragged, being deleted etc. It should look like this:
|
||||
@@ -249,121 +248,10 @@ void btn_event_cb(lv_obj_t * btn, lv_event_t event)
|
||||
}
|
||||
}
|
||||
```
|
||||

|
||||

|
||||
|
||||
### Button with styles
|
||||
Add styles to the previously button from the previous example
|
||||
```c
|
||||
static lv_style_t style_btn_rel; /*A variable to store the released style*/
|
||||
lv_style_copy(&style_btn_rel, &lv_style_plain); /*Initialize from a built-in style*/
|
||||
style_btn_rel.body.border.color = lv_color_hex3(0x269);
|
||||
style_btn_rel.body.border.width = 1;
|
||||
style_btn_rel.body.main_color = lv_color_hex3(0xADF);
|
||||
style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
|
||||
style_btn_rel.body.shadow.width = 4;
|
||||
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
||||
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_btn_rel.text.color = lv_color_hex3(0xDEF);
|
||||
|
||||
static lv_style_t style_btn_pr; /*A variable to store the pressed style*/
|
||||
lv_style_copy(&style_btn_pr, &style_btn_rel); /*Initialize from the released style*/
|
||||
style_btn_pr.body.border.color = lv_color_hex3(0x46B);
|
||||
style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
|
||||
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
|
||||
style_btn_pr.body.shadow.width = 2;
|
||||
style_btn_pr.text.color = lv_color_hex3(0xBCD);
|
||||
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_REL, &style_btn_rel); /*Set the button's released style*/
|
||||
lv_btn_set_style(btn, LV_BTN_STYLE_PR, &style_btn_pr); /*Set the button's pressed style*/
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Slider and object alignment
|
||||
```c
|
||||
lv_obj_t * label;
|
||||
|
||||
...
|
||||
|
||||
/* Create a slider in the center of the display */
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_width(slider, 200); /*Set the width*/
|
||||
lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); /*Align to the center of the parent (screen)*/
|
||||
lv_obj_set_event_cb(slider, slider_event_cb); /*Assign an event function*/
|
||||
|
||||
/* Create a label below the slider */
|
||||
label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(label, "0");
|
||||
lv_obj_set_auto_realign(slider, true);
|
||||
lv_obj_align(label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
|
||||
...
|
||||
|
||||
void slider_event_cb(lv_obj_t * slider, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_VALUE_CHANGED) {
|
||||
static char buf[4]; /* max 3 bytes for number plus 1 null terminating byte */
|
||||
snprintf(buf, 4, "%u", lv_slider_get_value(slider));
|
||||
lv_label_set_text(slider_label, buf); /*Refresh the text*/
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||

|
||||
|
||||
### List and themes
|
||||
```c
|
||||
/*Texts of the list elements*/
|
||||
const char * txts[] = {"First", "Second", "Third", "Forth", "Fifth", "Sixth", NULL};
|
||||
|
||||
/* Initialize and set a theme. `LV_THEME_NIGHT` needs to enabled in lv_conf.h. */
|
||||
lv_theme_t * th = lv_theme_night_init(20, NULL);
|
||||
lv_theme_set_current(th);
|
||||
|
||||
/*Create a list*/
|
||||
lv_obj_t* list = lv_list_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(list, 120, 180);
|
||||
lv_obj_set_pos(list, 10, 10);
|
||||
|
||||
/*Add buttons*/
|
||||
uint8_t i;
|
||||
for(i = 0; txts[i]; i++) {
|
||||
lv_obj_t * btn = lv_list_add_btn(list, LV_SYMBOL_FILE, txts[i]);
|
||||
lv_obj_set_event_cb(btn, list_event); /*Assign event function*/
|
||||
lv_btn_set_toggle(btn, true); /*Enable on/off states*/
|
||||
}
|
||||
|
||||
/* Initialize and set an other theme. `LV_THEME_MATERIAL` needs to enabled in lv_conf.h.
|
||||
* If `LV_TEHE_LIVE_UPDATE 1` then the previous list's style will be updated too.*/
|
||||
th = lv_theme_material_init(210, NULL);
|
||||
lv_theme_set_current(th);
|
||||
|
||||
/*Create an other list*/
|
||||
list = lv_list_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(list, 120, 180);
|
||||
lv_obj_set_pos(list, 150, 10);
|
||||
|
||||
/*Add buttons with the same texts*/
|
||||
for(i = 0; txts[i]; i++) {
|
||||
lv_obj_t * btn = lv_list_add_btn(list, LV_SYMBOL_FILE, txts[i]);
|
||||
lv_obj_set_event_cb(btn, list_event);
|
||||
lv_btn_set_toggle(btn, true);
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
static void list_event(lv_obj_t * btn, lv_event_t e)
|
||||
{
|
||||
if(e == LV_EVENT_CLICKED) {
|
||||
printf("%s\n", lv_list_get_btn_text(btn));
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||

|
||||
|
||||
### Use LittlevGL from Micropython
|
||||
Learn more about [Micropython](https://docs.littlevgl.com/en/html/get-started/micropython).
|
||||
### Use LVGL from Micropython
|
||||
Learn more about [Micropython](https://docs.lvgl.io/en/html/get-started/micropython).
|
||||
```python
|
||||
# Create a Button and a Label
|
||||
scr = lv.obj()
|
||||
@@ -377,22 +265,17 @@ lv.scr_load(scr)
|
||||
```
|
||||
|
||||
## Contributing
|
||||
To ask questions please use the [Forum](https://forum.littlevgl.com).
|
||||
For development-related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/littlevgl/lvgl/issues).
|
||||
To ask questions please use the [Forum](https://forum.lvgl.io).
|
||||
For development-related things (bug reports, feature suggestions) use [GitHub's Issue tracker](https://github.com/lvgl/lvgl/issues).
|
||||
|
||||
If you are interested in contributing to LittlevGL you can
|
||||
- **Help others** in the [Forum](https://forum.littlevgl.com).
|
||||
- **Inspire people** by speaking about your project in [My project](https://forum.littlevgl.com/c/my-projects) category in the Forum or add it to the [References](https://blog.littlevgl.com/2018-12-26/references) post
|
||||
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/littlevgl/docs) repository to learn more
|
||||
If you are interested in contributing to LVGL you can
|
||||
- **Help others** in the [Forum](https://forum.lvgl.io).
|
||||
- **Inspire people** by speaking about your project in [My project](https://forum.lvgl.io/c/my-projects) category in the Forum.
|
||||
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/lvgl/docs) repository to learn more
|
||||
- **Write a blog post** about your experiences. See how to do it in the [Blog](https://github.com/littlevgl/blog) repository
|
||||
- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues)
|
||||
- **Help in the developement**. Check the [Open issues](https://github.com/littlevgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/littlevgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature.
|
||||
- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues)
|
||||
- **Help in the developement**. Check the [Open issues](https://github.com/lvgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/lvgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature.
|
||||
|
||||
It should be useful to read the
|
||||
- [Contributing guide](https://blog.littlevgl.com/2018-12-06/contributing)
|
||||
- [Coding style guide](https://github.com/littlevgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
||||
|
||||
## Donate
|
||||
If you are pleased with the library, found it useful, or you are happy with the support you got, please help its further development:
|
||||
|
||||
[](https://littlevgl.com/donate)
|
||||
Before sending Pull requests, please read the following guides:
|
||||
- [Contributing guide](https://github.com/littlevgl/lvgl/blob/master/docs/CONTRIBUTING.md)
|
||||
- [Coding style guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
# Contributing to Littlev Graphics Library
|
||||
# Contributing to LVGL
|
||||
|
||||
**Do you have some free time to spend with programming?
|
||||
Are you working on an Embedded GUI project with LittlevGL?
|
||||
See how can you help to improve the graphics library!**
|
||||
|
||||
There are many ways to join the community. If you have some time to work with us I'm sure you will find something that fits you! You can:
|
||||
- help others in the [Forum](https://forum.littlevgl.com/)
|
||||
- improve and/or translate the documentation
|
||||
- write a blog post about your experiences
|
||||
- report and/or fix bugs
|
||||
- suggest and/or implement new features
|
||||
|
||||
- **Help others** in the [Forum](https://forum.lvgl.io).
|
||||
- **Inspire people** by speaking about your project in [My project](https://forum.lvgl.io/c/my-projects) category in the Forum.
|
||||
- **Improve and/or translate the documentation.** Go to the [Documentation](https://github.com/lvgl/docs) repository to learn more
|
||||
- **Write a blog post** about your experiences. See how to do it in the [Blog](https://github.com/littlevgl/blog) repository
|
||||
- **Report and/or fix bugs** in [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues)
|
||||
- **Help in the developement**. Check the [Open issues](https://github.com/lvgl/lvgl/issues) especially the ones with [Help wanted](https://github.com/lvgl/lvgl/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label and tell your ideas about a topic or implement a feature.
|
||||
But first, start with the most Frequently Asked Questions.
|
||||
|
||||
# FAQ about contributing
|
||||
|
||||
## Where can I write my question and remarks?
|
||||
|
||||
We use the [Forum](https://forum.littlevgl.com/) to ask and answer questions and [GitHub's issue tracker](https://github.com/littlevgl/lvgl/issues) for development-related discussion.
|
||||
We use the [Forum](https://forum.lvgl.io/) to ask and answer questions and [GitHub's issue tracker](https://github.com/lvgl/lvgl/issues) for development-related discussion.
|
||||
|
||||
We have some simple rules:
|
||||
- Be kind and friendly.
|
||||
@@ -30,68 +30,71 @@ We have some simple rules:
|
||||
## How can I send fixes and improvements?
|
||||
|
||||
Merging new code happens via Pull Requests. If you are still not familiar with the Pull Requests (PR for short) here is a quick guide:
|
||||
1. **Fork** the [lvgl repository](https://github.com/littlevgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`)
|
||||
1. **Fork** the [lvgl repository](https://github.com/lvgl/lvgl). To do this click the "Fork" button in the top right corner. It will "copy" the `lvgl` repository to your GitHub account (`https://github.com/your_name?tab=repositories`)
|
||||
2. **Clone** the forked repository and add your changes
|
||||
3. **Create a PR** on GitHub from the page of your `lvgl` repository (`https://github.com/your_name/lvgl`) by hitting the "New pull request" button
|
||||
4. **Set the base branch**. It means where you want to merge your update. Fixes go to `master`, new features to the actual `dev-x.y` branch.
|
||||
4. **Set the base branch**. It means where you want to merge your update. Fixes go to `master`, new features to feature branch.
|
||||
5. **Describe** what is in the update. An example code is welcome if applicable.
|
||||
|
||||
Some advice:
|
||||
- If you are not sure about your fix or feature it's better to open an issue first and discuss the details there.
|
||||
- For non-trivial fixes and features it's better open an issue first to discuss the details.
|
||||
- Maybe your fix or update won't be perfect at first. Don't be afraid, just improve it and push the new commits. The PR will be updated accordingly.
|
||||
- If your update needs some extra work it's okay to say: _"I'm busy now and I will improve it soon"_ or _"Sorry, I don't have time to improve it, I hope it helps in this form too"_.
|
||||
So it's better to say don't have time to continue than saying nothing.
|
||||
- Please read and follow this [guide about the coding style](https://github.com/littlevgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
||||
- Please read and follow this [guide about the coding style](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md)
|
||||
|
||||
If you implemented a new feature it's important to record it in the documentation and if applicable create an example for it:
|
||||
- Go to the [docs](https://github.com/littlevgl/docs/tree/master/v7/en) repository and update the relevant part of the English documentation.
|
||||
- Go to the [examples](https://github.com/littlevgl/lv_examples) repository and add a new file about the new feature i nthe related directory.
|
||||
|
||||
|
||||
## Where is the documentation?
|
||||
|
||||
You can read the documentation here: <https://docs.littlevgl.com/>
|
||||
You can edit the documentation here: <https://github.com/littlevgl/doc>
|
||||
|
||||
## Where is the blog?
|
||||
|
||||
You can read the blog here: <https://blog.littlevgl.com/>
|
||||
You can edit the blog here: <https://github.com/littlevgl/blog>
|
||||
You can read the documentation here: <https://docs.lvgl.io/v7>
|
||||
You can edit the documentation here: <https://github.com/lvgl/doc>
|
||||
|
||||
# So how and where can you contribute?
|
||||
|
||||
## Help others in the Forum
|
||||
|
||||
It's a great way to contribute to the library if you already use it.
|
||||
Just go to [https://forum.littlevgl.com/](https://forum.littlevgl.com/) a register (Google and GitHub login also works).
|
||||
Just go to [https://forum.lvgl.io/](https://forum.lvgl.io/) a register (Google and GitHub login also works).
|
||||
Log in, read the titles and if you are already familiar with a topic, don't be shy, and write your suggestion.
|
||||
|
||||
## Improving and/or translating the documentation
|
||||
|
||||
If you would like to contribute to LittlevGL the documentation is the best place to start.
|
||||
If you would like to contribute to LVGL the documentation is the best place to start.
|
||||
|
||||
### Fix typos, add missing parts
|
||||
|
||||
If you find a typo, an obscure sentence or something which is not explained well enough in the [English documentation](https://docs.littlevgl.com/en/html/index.html)
|
||||
If you find a typo, an obscure sentence or something which is not explained well enough in the [English documentation](https://docs.lvgl.io/en/html/index.html)
|
||||
click the *"Edit on GitHub"* button in the top right corner and fix the issue by sending a Pull Request.
|
||||
|
||||
### Translate the documentation
|
||||
|
||||
If you have time and interest you can translate the documentation to your native language or any language you speak.
|
||||
If you have time and interest you can translate the documentation to your native language or any language you speak well.
|
||||
You can join others to work on an already existing language or you can start a new one.
|
||||
|
||||
To translate the documentation we use [Zanata](https://zanata.org) which is an online translation platform.
|
||||
You will find the LittlevGL project here: [LittlevGL on Zanata](https://translate.zanata.org/iteration/view/littlevgl-docs/v6.0-doc1?dswid=3430)
|
||||
You will find the LVGL project here: [LVGL on Zanata](https://translate.zanata.org/iteration/view/littlevgl-docs/v6.0-doc1?dswid=3430)
|
||||
|
||||
To get started you need to:
|
||||
- register at [Zanata](https://zanata.org) which is an online translation platform.
|
||||
- comment to [this post](https://forum.littlevgl.com/t/translate-the-documentation/238?u=kisvegabor)
|
||||
- comment to [this post](https://forum.lvgl.io/t/translate-the-documentation/238?u=kisvegabor)
|
||||
- tell your username at *Zanata* and your selected language(s) to get permission the edit the translations
|
||||
|
||||
Note that a translation will be added to the documentation only if at least the [Porting section](https://docs.littlevgl.com/en/html/porting/index.html) is translated.
|
||||
Note that a translation will be added to the documentation only if the following parts are translated:
|
||||
- [Home page](https://docs.lvgl.io/en/v7/)
|
||||
- [Porting section](https://docs.lvgl.io/en/v7/html/porting/index.html)
|
||||
- [Quick overview](https://docs.lvgl.io/v7/en/html/get-started/quick-overview.html)
|
||||
|
||||
|
||||
|
||||
## Writing a blog post about your experiences
|
||||
|
||||
Have you ported LittlevGL to a new platform? Have you created a fancy GUI? Do you know a great trick?
|
||||
You can share your knowledge on LittlevGL's blog! It's super easy to add your own post:
|
||||
- Fork and clone the [blog repository](https://github.com/littlevgl/blog)
|
||||
Have you ported LVGL to a new platform? Have you created a fancy GUI? Do you know a great trick?
|
||||
You can share your knowledge on LVGL's blog! It's super easy to add your own post:
|
||||
- Fork and clone the [blog repository](https://github.com/lvgl/blog)
|
||||
- Add your post in Markdown to the `_posts` folder.
|
||||
- Store the images and other resources in a dedicated folder in `assets`
|
||||
- Create a Pull Request
|
||||
@@ -102,10 +105,10 @@ The blog uses [Jekyll](https://jekyllrb.com/) to convert the `.md` files to a we
|
||||
For simple bugfixes (typos, missing error handling, fixing a warning) is fine to send a Pull request directly. However, for more complex bugs it's better to open an issue first. In the issue, you should describe how to reproduce the bug and even add the minimal code snippet.
|
||||
|
||||
## Suggesting and/or implementing new features
|
||||
If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LittlevGL well enough. We will help you to get started.
|
||||
If you have a good idea don't hesitate to share with us. It's even better if you have time to deal with its implementation. Don't be afraid if you still don't know LVGL well enough. We will help you to get started.
|
||||
|
||||
During the implementation don't forget the [Code style guide](https://github.com/littlevgl/lvgl/blob/master/docs/CODING_STYLE.md).
|
||||
During the implementation don't forget the [Code style guide](https://github.com/lvgl/lvgl/blob/master/docs/CODING_STYLE.md).
|
||||
|
||||
# Summary
|
||||
|
||||
I hope you have taken a liking to contribute to LittlevGL. A helpful and friendly community is waiting for you! :)
|
||||
I hope you have taken a liking to contribute to LVGL. A helpful and friendly community is waiting for you! :)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "lvgl",
|
||||
"version": "v6.1.2",
|
||||
"version": "v7.0.0",
|
||||
"keywords": "graphics, gui, embedded, littlevgl",
|
||||
"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":
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/littlevgl/lvgl.git"
|
||||
"url": "https://github.com/lvgl/lvgl.git"
|
||||
},
|
||||
"build": {
|
||||
"includeDir": "."
|
||||
|
||||
@@ -43,9 +43,6 @@
|
||||
/*Images pixels with this color will not be drawn (with chroma keying)*/
|
||||
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
|
||||
|
||||
/* Enable chroma keying for indexed images. */
|
||||
#define LV_INDEXED_CHROMA 1
|
||||
|
||||
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
|
||||
#define LV_ANTIALIAS 1
|
||||
|
||||
@@ -123,7 +120,7 @@ typedef int16_t lv_coord_t;
|
||||
#define LV_INDEV_DEF_DRAG_LIMIT 10
|
||||
|
||||
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
|
||||
#define LV_INDEV_DEF_DRAG_THROW 20
|
||||
#define LV_INDEV_DEF_DRAG_THROW 10
|
||||
|
||||
/* Long press time in milliseconds.
|
||||
* Time to send `LV_EVENT_LONG_PRESSSED`) */
|
||||
@@ -169,6 +166,9 @@ typedef void * lv_anim_user_data_t;
|
||||
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
|
||||
#define LV_USE_OPA_SCALE 1
|
||||
|
||||
/* 1: Use image zoom and rotation*/
|
||||
#define LV_USE_IMG_TRANSFORM 1
|
||||
|
||||
/* 1: Enable object groups (for keyboard/encoder navigation) */
|
||||
#define LV_USE_GROUP 1
|
||||
#if LV_USE_GROUP
|
||||
@@ -176,7 +176,7 @@ typedef void * lv_group_user_data_t;
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/* 1: Enable GPU interface*/
|
||||
#define LV_USE_GPU 1
|
||||
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
|
||||
/* 1: Enable file system (might be required for images */
|
||||
@@ -192,6 +192,9 @@ typedef void * lv_fs_drv_user_data_t;
|
||||
/*1: Show CPU usage and FPS count in the right bottom corner*/
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
|
||||
/*1: Use the functions and types from the older API if possible */
|
||||
#define LV_USE_API_EXTENSION_V6 1
|
||||
|
||||
/*========================
|
||||
* Image decoder and cache
|
||||
*========================*/
|
||||
@@ -327,8 +330,8 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
||||
|
||||
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
|
||||
* The symbols are available via `LV_SYMBOL_...` defines
|
||||
* More info about fonts: https://docs.littlevgl.com/#Fonts
|
||||
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
|
||||
* More info about fonts: https://docs.lvgl.com/#Fonts
|
||||
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
|
||||
*/
|
||||
|
||||
/* Montserrat fonts with bpp = 4
|
||||
@@ -390,10 +393,27 @@ typedef void * lv_font_user_data_t;
|
||||
*================*/
|
||||
|
||||
/*Always enable at least on theme*/
|
||||
#define LV_USE_THEME_EMPTY 0 /*No theme, you can apply your styles as you need*/
|
||||
#define LV_USE_THEME_TEMPLATE 0 /*Simple to the create your theme based on it*/
|
||||
#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/
|
||||
#define LV_USE_THEME_MONO 0 /*Mono-color theme for monochrome displays*/
|
||||
|
||||
/* No theme, you can apply your styles as you need
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#define LV_USE_THEME_EMPTY 1
|
||||
|
||||
/*Simple to the create your theme based on it
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#define LV_USE_THEME_TEMPLATE 1
|
||||
|
||||
/* A fast and impressive theme.
|
||||
* Flags:
|
||||
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
||||
* LV_THEME_MATERIAL_FLAG_DARK: dark theme*/
|
||||
#define LV_USE_THEME_MATERIAL 1
|
||||
|
||||
/* Mono-color theme for monochrome displays.
|
||||
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
|
||||
* texts and borders will be black and the background will be
|
||||
* white. Else the colors are inverted.
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#define LV_USE_THEME_MONO 1
|
||||
|
||||
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
|
||||
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
|
||||
@@ -490,7 +510,7 @@ typedef void * lv_obj_user_data_t;
|
||||
* LV OBJ X USAGE
|
||||
*================*/
|
||||
/*
|
||||
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
|
||||
* Documentation of the object types: https://docs.lvgl.com/#Object-types
|
||||
*/
|
||||
|
||||
/*Arc (dependencies: -)*/
|
||||
@@ -501,10 +521,6 @@ typedef void * lv_obj_user_data_t;
|
||||
|
||||
/*Button (dependencies: lv_cont*/
|
||||
#define LV_USE_BTN 1
|
||||
#if LV_USE_BTN != 0
|
||||
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
|
||||
# define LV_BTN_INK_EFFECT 0
|
||||
#endif
|
||||
|
||||
/*Button matrix (dependencies: -)*/
|
||||
#define LV_USE_BTNMATRIX 1
|
||||
@@ -599,7 +615,7 @@ typedef void * lv_obj_user_data_t;
|
||||
#endif
|
||||
|
||||
/*Mask (dependencies: -)*/
|
||||
#define LV_USE_OBJMASK 0
|
||||
#define LV_USE_OBJMASK 1
|
||||
|
||||
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
|
||||
#define LV_USE_MSGBOX 1
|
||||
|
||||
7
lvgl.h
7
lvgl.h
@@ -27,14 +27,11 @@ extern "C" {
|
||||
|
||||
#include "src/lv_core/lv_refr.h"
|
||||
#include "src/lv_core/lv_disp.h"
|
||||
#include "src/lv_core/lv_debug.h"
|
||||
|
||||
#include "src/lv_themes/lv_theme.h"
|
||||
|
||||
#include "src/lv_font/lv_font.h"
|
||||
#include "src/lv_font/lv_font_fmt_txt.h"
|
||||
#include "src/lv_misc/lv_bidi.h"
|
||||
#include "src/lv_misc/lv_txt_ap.h"
|
||||
#include "src/lv_misc/lv_printf.h"
|
||||
|
||||
#include "src/lv_widgets/lv_btn.h"
|
||||
@@ -78,11 +75,11 @@ extern "C" {
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
/*Current version of LittlevGL*/
|
||||
/*Current version of LVGL*/
|
||||
#define LVGL_VERSION_MAJOR 7
|
||||
#define LVGL_VERSION_MINOR 0
|
||||
#define LVGL_VERSION_PATCH 0
|
||||
#define LVGL_VERSION_INFO "rc"
|
||||
#define LVGL_VERSION_INFO ""
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
|
||||
@@ -54,20 +54,20 @@ void lv_port_disp_init(void)
|
||||
* Create a buffer for drawing
|
||||
*----------------------------*/
|
||||
|
||||
/* LittlevGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
|
||||
/* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
|
||||
*
|
||||
* There are three buffering configurations:
|
||||
* 1. Create ONE buffer with some rows:
|
||||
* LittlevGL will draw the display's content here and writes it to your display
|
||||
* LVGL will draw the display's content here and writes it to your display
|
||||
*
|
||||
* 2. Create TWO buffer with some rows:
|
||||
* LittlevGL will draw the display's content to a buffer and writes it your display.
|
||||
* LVGL will draw the display's content to a buffer and writes it your display.
|
||||
* You should use DMA to write the buffer's content to the display.
|
||||
* It will enable LittlevGL to draw the next part of the screen to the other buffer while
|
||||
* It will enable LVGL to draw the next part of the screen to the other buffer while
|
||||
* the data is being sent form the first buffer. It makes rendering and flushing parallel.
|
||||
*
|
||||
* 3. Create TWO screen-sized buffer:
|
||||
* Similar to 2) but the buffer have to be screen sized. When LittlevGL is ready it will give the
|
||||
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
|
||||
* whole frame to display. This way you only need to change the frame buffer's address instead of
|
||||
* copying the pixels.
|
||||
* */
|
||||
@@ -91,7 +91,7 @@ void lv_port_disp_init(void)
|
||||
|
||||
|
||||
/*-----------------------------------
|
||||
* Register the display in LittlevGL
|
||||
* Register the display in LVGL
|
||||
*----------------------------------*/
|
||||
|
||||
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
|
||||
|
||||
@@ -81,7 +81,7 @@ void lv_port_fs_init(void)
|
||||
fs_init();
|
||||
|
||||
/*---------------------------------------------------
|
||||
* Register the file system interface in LittlevGL
|
||||
* Register the file system interface in LVGL
|
||||
*--------------------------------------------------*/
|
||||
|
||||
/* Add a simple drive to open images */
|
||||
|
||||
@@ -140,14 +140,14 @@ void lv_port_indev_init(void)
|
||||
|
||||
/*Register a encoder input device*/
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_KEYPAD;
|
||||
indev_drv.type = LV_INDEV_TYPE_ENCODER;
|
||||
indev_drv.read_cb = encoder_read;
|
||||
indev_encoder = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
|
||||
* add objects to the group with `lv_group_add_obj(group, obj)`
|
||||
* and assign this input device to group to navigate in it:
|
||||
* `lv_indev_set_group(indev_keypad, group);` */
|
||||
* `lv_indev_set_group(indev_encoder, group);` */
|
||||
|
||||
/*------------------
|
||||
* Button
|
||||
@@ -293,7 +293,7 @@ static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
if(act_key != 0) {
|
||||
data->state = LV_INDEV_STATE_PR;
|
||||
|
||||
/*Translate the keys to LittlevGL control characters according to your key definitions*/
|
||||
/*Translate the keys to LVGL control characters according to your key definitions*/
|
||||
switch(act_key) {
|
||||
case 1:
|
||||
act_key = LV_KEY_NEXT;
|
||||
|
||||
@@ -24,11 +24,27 @@
|
||||
--preserve-date
|
||||
--formatted
|
||||
--exclude=lv_conf_internal.h
|
||||
--exclude=../src/lv_font/lv_font_roboto_12.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_12_subpx.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_16.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_22.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_28.c
|
||||
--exclude=../src/lv_font/lv_font_roboto_28_compressed.c
|
||||
--exclude=../src/lv_font/lv_font_unscii_8.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_12.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_14.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_16.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_18.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_20.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_22.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_24.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_26.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_28.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_30.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_32.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_34.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_36.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_38.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_40.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_42.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_44.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_46.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_48.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_12_subpx.c
|
||||
--exclude=../src/lv_font/lv_font_montserrat_28_compressed.c
|
||||
--exclude=../src/lv_font/lv_font_simsun_16_cjk.c
|
||||
--exclude=../src/lv_font/lv_font_dejavu_16_persian_hebrew.c
|
||||
|
||||
|
||||
@@ -186,4 +186,3 @@ docs_build()
|
||||
docs_commit_push(ver_str)
|
||||
|
||||
clean_up()
|
||||
|
||||
|
||||
@@ -30,12 +30,19 @@ extern "C" {
|
||||
/*---------------------
|
||||
* V6.0 COMPATIBILITY
|
||||
*--------------------*/
|
||||
#if LV_USE_API_EXTENSION_V6
|
||||
|
||||
static inline void lv_task_once(lv_task_t *task)
|
||||
static inline void lv_task_once(lv_task_t * task)
|
||||
{
|
||||
lv_task_set_repeat_count(task, 1);
|
||||
}
|
||||
|
||||
#if LV_USE_CHECKBOX
|
||||
|
||||
#define lv_checkbox_set_static_text lv_checkbox_set_text_static
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART
|
||||
|
||||
#define lv_chart_get_point_cnt lv_chart_get_point_count
|
||||
@@ -57,6 +64,8 @@ static inline bool lv_dropdown_get_draw_arrow(lv_obj_t * ddlist)
|
||||
else return false;
|
||||
}
|
||||
|
||||
#define lv_dropdown_set_static_options lv_dropdown_set_options_static
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_USE_BAR
|
||||
@@ -89,6 +98,12 @@ static inline bool lv_bar_get_sym(lv_obj_t * bar)
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_USE_LABEL
|
||||
|
||||
#define lv_label_set_static_text lv_label_set_text_static
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
|
||||
/**
|
||||
@@ -116,6 +131,53 @@ static inline bool lv_slider_get_sym(lv_obj_t * slider)
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
|
||||
/**
|
||||
* Set a fixed width for the roller.
|
||||
* @param roller pointer to a roller object
|
||||
* @param w width
|
||||
* @deprecated As of v7.0, you should use `lv_roller_set_auto_fit` and set the width normally instead.
|
||||
*/
|
||||
static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w)
|
||||
{
|
||||
lv_roller_set_auto_fit(roller, false);
|
||||
lv_obj_set_width(roller, w);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_PAGE
|
||||
#define lv_scrlbar_mode_t lv_scrollbar_mode_t
|
||||
|
||||
#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF
|
||||
#define LV_SCRLBAR_MODE_ON LV_SCRILLBAR_MODE_ON
|
||||
#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG
|
||||
#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO
|
||||
#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE
|
||||
#define LV_SCRLBAR_MODE_UNHIDE LV_SCROLLBAR_MODE_UNHIDE
|
||||
|
||||
|
||||
static inline void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode)
|
||||
{
|
||||
lv_page_set_scrollbar_mode(page, sb_mode);
|
||||
}
|
||||
static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page)
|
||||
{
|
||||
return lv_page_get_scrollbar_mode(page);
|
||||
}
|
||||
|
||||
|
||||
static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
|
||||
{
|
||||
return lv_page_get_scrllable(page);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*LV_USE_API_EXTENSION_V6*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -66,11 +66,6 @@
|
||||
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
|
||||
#endif
|
||||
|
||||
/* Enable chroma keying for indexed images. */
|
||||
#ifndef LV_INDEXED_CHROMA
|
||||
#define LV_INDEXED_CHROMA 1
|
||||
#endif
|
||||
|
||||
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
|
||||
#ifndef LV_ANTIALIAS
|
||||
#define LV_ANTIALIAS 1
|
||||
@@ -188,7 +183,7 @@
|
||||
|
||||
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
|
||||
#ifndef LV_INDEV_DEF_DRAG_THROW
|
||||
#define LV_INDEV_DEF_DRAG_THROW 20
|
||||
#define LV_INDEV_DEF_DRAG_THROW 10
|
||||
#endif
|
||||
|
||||
/* Long press time in milliseconds.
|
||||
@@ -252,6 +247,11 @@
|
||||
#define LV_USE_OPA_SCALE 1
|
||||
#endif
|
||||
|
||||
/* 1: Use image zoom and rotation*/
|
||||
#ifndef LV_USE_IMG_TRANSFORM
|
||||
#define LV_USE_IMG_TRANSFORM 1
|
||||
#endif
|
||||
|
||||
/* 1: Enable object groups (for keyboard/encoder navigation) */
|
||||
#ifndef LV_USE_GROUP
|
||||
#define LV_USE_GROUP 1
|
||||
@@ -261,7 +261,7 @@
|
||||
|
||||
/* 1: Enable GPU interface*/
|
||||
#ifndef LV_USE_GPU
|
||||
#define LV_USE_GPU 1
|
||||
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
|
||||
#endif
|
||||
#ifndef LV_USE_GPU_STM32_DMA2D
|
||||
#define LV_USE_GPU_STM32_DMA2D 0
|
||||
@@ -285,6 +285,11 @@
|
||||
#define LV_USE_PERF_MONITOR 0
|
||||
#endif
|
||||
|
||||
/*1: Use the functions and types from the older API if possible */
|
||||
#ifndef LV_USE_API_EXTENSION_V6
|
||||
#define LV_USE_API_EXTENSION_V6 1
|
||||
#endif
|
||||
|
||||
/*========================
|
||||
* Image decoder and cache
|
||||
*========================*/
|
||||
@@ -463,8 +468,8 @@
|
||||
|
||||
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
|
||||
* The symbols are available via `LV_SYMBOL_...` defines
|
||||
* More info about fonts: https://docs.littlevgl.com/#Fonts
|
||||
* To create a new font go to: https://littlevgl.com/ttf-font-to-c-array
|
||||
* More info about fonts: https://docs.lvgl.com/#Fonts
|
||||
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
|
||||
*/
|
||||
|
||||
/* Montserrat fonts with bpp = 4
|
||||
@@ -579,17 +584,34 @@
|
||||
*================*/
|
||||
|
||||
/*Always enable at least on theme*/
|
||||
|
||||
/* No theme, you can apply your styles as you need
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#ifndef LV_USE_THEME_EMPTY
|
||||
#define LV_USE_THEME_EMPTY 0 /*No theme, you can apply your styles as you need*/
|
||||
#define LV_USE_THEME_EMPTY 1
|
||||
#endif
|
||||
|
||||
/*Simple to the create your theme based on it
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#ifndef LV_USE_THEME_TEMPLATE
|
||||
#define LV_USE_THEME_TEMPLATE 0 /*Simple to the create your theme based on it*/
|
||||
#define LV_USE_THEME_TEMPLATE 1
|
||||
#endif
|
||||
|
||||
/* A fast and impressive theme.
|
||||
* Flags:
|
||||
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
||||
* LV_THEME_MATERIAL_FLAG_DARK: dark theme*/
|
||||
#ifndef LV_USE_THEME_MATERIAL
|
||||
#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/
|
||||
#define LV_USE_THEME_MATERIAL 1
|
||||
#endif
|
||||
|
||||
/* Mono-color theme for monochrome displays.
|
||||
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
|
||||
* texts and borders will be black and the background will be
|
||||
* white. Else the colors are inverted.
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#ifndef LV_USE_THEME_MONO
|
||||
#define LV_USE_THEME_MONO 0 /*Mono-color theme for monochrome displays*/
|
||||
#define LV_USE_THEME_MONO 1
|
||||
#endif
|
||||
|
||||
#ifndef LV_THEME_DEFAULT_INCLUDE
|
||||
@@ -740,7 +762,7 @@
|
||||
* LV OBJ X USAGE
|
||||
*================*/
|
||||
/*
|
||||
* Documentation of the object types: https://docs.littlevgl.com/#Object-types
|
||||
* Documentation of the object types: https://docs.lvgl.com/#Object-types
|
||||
*/
|
||||
|
||||
/*Arc (dependencies: -)*/
|
||||
@@ -757,12 +779,6 @@
|
||||
#ifndef LV_USE_BTN
|
||||
#define LV_USE_BTN 1
|
||||
#endif
|
||||
#if LV_USE_BTN != 0
|
||||
/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/
|
||||
#ifndef LV_BTN_INK_EFFECT
|
||||
# define LV_BTN_INK_EFFECT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Button matrix (dependencies: -)*/
|
||||
#ifndef LV_USE_BTNMATRIX
|
||||
@@ -914,7 +930,7 @@
|
||||
|
||||
/*Mask (dependencies: -)*/
|
||||
#ifndef LV_USE_OBJMASK
|
||||
#define LV_USE_OBJMASK 0
|
||||
#define LV_USE_OBJMASK 1
|
||||
#endif
|
||||
|
||||
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
|
||||
|
||||
@@ -75,7 +75,7 @@ bool lv_debug_check_obj_valid(const lv_obj_t * obj)
|
||||
lv_disp_t * disp = lv_disp_get_next(NULL);
|
||||
while(disp) {
|
||||
lv_obj_t * scr;
|
||||
LV_LL_READ(disp->scr_ll, scr) {
|
||||
_LV_LL_READ(disp->scr_ll, scr) {
|
||||
|
||||
if(scr == obj) return true;
|
||||
bool found = obj_valid_child(scr, obj);
|
||||
@@ -160,7 +160,7 @@ void lv_debug_log_error(const char * msg, uint64_t value)
|
||||
char * bufp = buf;
|
||||
|
||||
/*Add the function name*/
|
||||
lv_memcpy(bufp, msg, msg_len);
|
||||
_lv_memcpy(bufp, msg, msg_len);
|
||||
bufp += msg_len;
|
||||
|
||||
/*Add value in hey*/
|
||||
@@ -200,7 +200,7 @@ static bool obj_valid_child(const lv_obj_t * parent, const lv_obj_t * obj_to_fin
|
||||
{
|
||||
/*Check all children of `parent`*/
|
||||
lv_obj_t * child;
|
||||
LV_LL_READ(parent->child_ll, child) {
|
||||
_LV_LL_READ(parent->child_ll, child) {
|
||||
if(child == obj_to_find) return true;
|
||||
|
||||
/*Check the children*/
|
||||
|
||||
@@ -112,24 +112,7 @@ void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr)
|
||||
|
||||
if(old_disp == disp) return;
|
||||
|
||||
lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher task. (NULL on error)
|
||||
*/
|
||||
lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("lv_disp_get_refr_task: no display registered");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return disp->refr_task;
|
||||
_lv_ll_chg_list(&old_disp->scr_ll, &disp->scr_ll, scr, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,6 +157,24 @@ void lv_disp_trig_activity(lv_disp_t * disp)
|
||||
disp->last_activity_time = lv_tick_get();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher task. (NULL on error)
|
||||
*/
|
||||
lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("lv_disp_get_refr_task: no display registered");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return disp->refr_task;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -64,14 +64,6 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp);
|
||||
*/
|
||||
void lv_disp_assign_screen(lv_disp_t * disp, lv_obj_t * scr);
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher task. (NULL on error)
|
||||
*/
|
||||
lv_task_t * lv_disp_get_refr_task(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Get elapsed time since last user activity on a display (e.g. click)
|
||||
* @param disp pointer to an display (NULL to get the overall smallest inactivity)
|
||||
@@ -85,6 +77,14 @@ uint32_t lv_disp_get_inactive_time(const lv_disp_t * disp);
|
||||
*/
|
||||
void lv_disp_trig_activity(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Get a pointer to the screen refresher task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* @param disp pointer to a display
|
||||
* @return pointer to the display refresher task. (NULL on error)
|
||||
*/
|
||||
lv_task_t * _lv_disp_get_refr_task(lv_disp_t * disp);
|
||||
|
||||
/*------------------------------------------------
|
||||
* To improve backward compatibility
|
||||
* Recommended only if you have one display
|
||||
@@ -152,7 +152,7 @@ static inline void lv_scr_load(lv_obj_t * scr)
|
||||
* 1 dip is 2 px on a 320 DPI screen
|
||||
* https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
|
||||
*/
|
||||
#define LV_DPX(n) LV_MATH_MAX(((LV_DPI * (n) + 80) / 160), 1) /*+80 for rounding*/
|
||||
#define LV_DPX(n) LV_MATH_MAX((( lv_disp_get_dpi(NULL) * (n) + 80) / 160), 1) /*+80 for rounding*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -48,9 +48,9 @@ static void obj_to_foreground(lv_obj_t * obj);
|
||||
/**
|
||||
* Init. the group module
|
||||
*/
|
||||
void lv_group_init(void)
|
||||
void _lv_group_init(void)
|
||||
{
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_group_ll), sizeof(lv_group_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_group_ll), sizeof(lv_group_t));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,10 +59,10 @@ void lv_group_init(void)
|
||||
*/
|
||||
lv_group_t * lv_group_create(void)
|
||||
{
|
||||
lv_group_t * group = lv_ll_ins_head(&LV_GC_ROOT(_lv_group_ll));
|
||||
lv_group_t * group = _lv_ll_ins_head(&LV_GC_ROOT(_lv_group_ll));
|
||||
LV_ASSERT_MEM(group);
|
||||
if(group == NULL) return NULL;
|
||||
lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *));
|
||||
_lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *));
|
||||
|
||||
group->obj_focus = NULL;
|
||||
group->frozen = 0;
|
||||
@@ -73,7 +73,7 @@ lv_group_t * lv_group_create(void)
|
||||
group->wrap = 1;
|
||||
|
||||
#if LV_USE_USER_DATA
|
||||
lv_memset_00(&group->user_data, sizeof(lv_group_user_data_t));
|
||||
_lv_memset_00(&group->user_data, sizeof(lv_group_user_data_t));
|
||||
#endif
|
||||
|
||||
return group;
|
||||
@@ -93,12 +93,12 @@ void lv_group_del(lv_group_t * group)
|
||||
|
||||
/*Remove the objects from the group*/
|
||||
lv_obj_t ** obj;
|
||||
LV_LL_READ(group->obj_ll, obj) {
|
||||
_LV_LL_READ(group->obj_ll, obj) {
|
||||
(*obj)->group_p = NULL;
|
||||
}
|
||||
|
||||
lv_ll_clear(&(group->obj_ll));
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group);
|
||||
_lv_ll_clear(&(group->obj_ll));
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group);
|
||||
lv_mem_free(group);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
||||
if(group == NULL) return;
|
||||
/*Do not add the object twice*/
|
||||
lv_obj_t ** obj_i;
|
||||
LV_LL_READ(group->obj_ll, obj_i) {
|
||||
_LV_LL_READ(group->obj_ll, obj_i) {
|
||||
if((*obj_i) == obj) {
|
||||
LV_LOG_INFO("lv_group_add_obj: the object is already added to this group");
|
||||
return;
|
||||
@@ -129,14 +129,14 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj)
|
||||
}
|
||||
|
||||
obj->group_p = group;
|
||||
lv_obj_t ** next = lv_ll_ins_tail(&group->obj_ll);
|
||||
lv_obj_t ** next = _lv_ll_ins_tail(&group->obj_ll);
|
||||
LV_ASSERT_MEM(next);
|
||||
if(next == NULL) return;
|
||||
*next = obj;
|
||||
|
||||
/* If the head and the tail is equal then there is only one object in the linked list.
|
||||
* In this case automatically activate it*/
|
||||
if(lv_ll_get_head(&group->obj_ll) == next) {
|
||||
if(_lv_ll_get_head(&group->obj_ll) == next) {
|
||||
lv_group_refocus(group);
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
if(g->frozen) g->frozen = 0;
|
||||
|
||||
/*If this is the only object in the group then focus to nothing.*/
|
||||
if(lv_ll_get_head(&g->obj_ll) == g->obj_focus && lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
|
||||
if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) {
|
||||
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
}
|
||||
/*If there more objects in the group then focus to the next/prev object*/
|
||||
@@ -174,9 +174,9 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
|
||||
/*Search the object and remove it from its group */
|
||||
lv_obj_t ** i;
|
||||
LV_LL_READ(g->obj_ll, i) {
|
||||
_LV_LL_READ(g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
lv_ll_remove(&g->obj_ll, i);
|
||||
_lv_ll_remove(&g->obj_ll, i);
|
||||
lv_mem_free(i);
|
||||
obj->group_p = NULL;
|
||||
break;
|
||||
@@ -199,11 +199,11 @@ void lv_group_remove_all_objs(lv_group_t * group)
|
||||
|
||||
/*Remove the objects from the group*/
|
||||
lv_obj_t ** obj;
|
||||
LV_LL_READ(group->obj_ll, obj) {
|
||||
_LV_LL_READ(group->obj_ll, obj) {
|
||||
(*obj)->group_p = NULL;
|
||||
}
|
||||
|
||||
lv_ll_clear(&(group->obj_ll));
|
||||
_lv_ll_clear(&(group->obj_ll));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +224,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
lv_group_set_editing(g, false);
|
||||
|
||||
lv_obj_t ** i;
|
||||
LV_LL_READ(g->obj_ll, i) {
|
||||
_LV_LL_READ(g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
if(g->obj_focus != NULL) {
|
||||
(*g->obj_focus)->signal_cb(*g->obj_focus, LV_SIGNAL_DEFOCUS, NULL);
|
||||
@@ -256,7 +256,7 @@ void lv_group_focus_obj(lv_obj_t * obj)
|
||||
*/
|
||||
void lv_group_focus_next(lv_group_t * group)
|
||||
{
|
||||
focus_next_core(group, lv_ll_get_head, lv_ll_get_next);
|
||||
focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,7 +265,7 @@ void lv_group_focus_next(lv_group_t * group)
|
||||
*/
|
||||
void lv_group_focus_prev(lv_group_t * group)
|
||||
{
|
||||
focus_next_core(group, lv_ll_get_tail, lv_ll_get_prev);
|
||||
focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -81,7 +81,7 @@ typedef uint8_t lv_group_refocus_policy_t;
|
||||
* Init. the group module
|
||||
* @remarks Internal function, do not call directly.
|
||||
*/
|
||||
void lv_group_init(void);
|
||||
void _lv_group_init(void);
|
||||
|
||||
/**
|
||||
* Create a new object group
|
||||
|
||||
@@ -63,7 +63,7 @@ static lv_obj_t * indev_obj_act = NULL;
|
||||
/**
|
||||
* Initialize the display input device subsystem
|
||||
*/
|
||||
void lv_indev_init(void)
|
||||
void _lv_indev_init(void)
|
||||
{
|
||||
lv_indev_reset(NULL, NULL); /*Reset all input devices*/
|
||||
}
|
||||
@@ -72,7 +72,7 @@ void lv_indev_init(void)
|
||||
* Called periodically to read the input devices
|
||||
* @param param pointer to and input device to read
|
||||
*/
|
||||
void lv_indev_read_task(lv_task_t * task)
|
||||
void _lv_indev_read_task(lv_task_t * task)
|
||||
{
|
||||
LV_LOG_TRACE("indev read task started");
|
||||
|
||||
@@ -90,7 +90,7 @@ void lv_indev_read_task(lv_task_t * task)
|
||||
bool more_to_read;
|
||||
do {
|
||||
/*Read the data*/
|
||||
more_to_read = lv_indev_read(indev_act, &data);
|
||||
more_to_read = _lv_indev_read(indev_act, &data);
|
||||
|
||||
/*The active object might deleted even in the read function*/
|
||||
indev_proc_reset_query_handler(indev_act);
|
||||
@@ -364,6 +364,15 @@ void lv_indev_wait_release(lv_indev_t * indev)
|
||||
indev->proc.wait_until_release = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a pointer to the currently active object in the currently processed input device.
|
||||
* @return pointer to currently active object or NULL if no active object
|
||||
*/
|
||||
lv_obj_t * lv_indev_get_obj_act(void)
|
||||
{
|
||||
return indev_obj_act;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a pointer to the indev read task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
@@ -380,15 +389,6 @@ lv_task_t * lv_indev_get_read_task(lv_disp_t * indev)
|
||||
return indev->refr_task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a pointer to the currently active object in the currently processed input device.
|
||||
* @return pointer to currently active object or NULL if no active object
|
||||
*/
|
||||
lv_obj_t * lv_indev_get_obj_act(void)
|
||||
{
|
||||
return indev_obj_act;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -658,7 +658,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*On enter long press toggle edit mode.*/
|
||||
if(editable) {
|
||||
/*Don't leave edit mode if there is only one object (nowhere to navigate)*/
|
||||
if(lv_ll_is_empty(&g->obj_ll) == false) {
|
||||
if(_lv_ll_is_empty(&g->obj_ll) == false) {
|
||||
lv_group_set_editing(g, lv_group_get_editing(g) ? false : true); /*Toggle edit mode on long press*/
|
||||
}
|
||||
}
|
||||
@@ -695,7 +695,7 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
/*An object is being edited and the button is released. */
|
||||
else if(g->editing) {
|
||||
/*Ignore long pressed enter release because it comes from mode switch*/
|
||||
if(!i->proc.long_pr_sent || lv_ll_is_empty(&g->obj_ll)) {
|
||||
if(!i->proc.long_pr_sent || _lv_ll_is_empty(&g->obj_ll)) {
|
||||
indev_obj_act->signal_cb(indev_obj_act, LV_SIGNAL_RELEASED, NULL);
|
||||
if(indev_reset_check(&i->proc)) return;
|
||||
|
||||
@@ -735,6 +735,12 @@ 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)
|
||||
{
|
||||
/* Die gracefully if i->btn_points is NULL */
|
||||
if(i->btn_points == NULL) {
|
||||
LV_LOG_WARN("indev_button_proc: btn_points was NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
i->proc.types.pointer.act_point.x = i->btn_points[data->btn_id].x;
|
||||
i->proc.types.pointer.act_point.y = i->btn_points[data->btn_id].y;
|
||||
|
||||
@@ -1054,7 +1060,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||
if(lv_obj_hittest(obj, point)) {
|
||||
lv_obj_t * i;
|
||||
|
||||
LV_LL_READ(obj->child_ll, i) {
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
found_p = lv_indev_search_obj(i, point);
|
||||
|
||||
/*If a child was found then break*/
|
||||
@@ -1299,7 +1305,7 @@ static void indev_drag(lv_indev_proc_t * proc)
|
||||
lv_coord_t act_par_h = lv_obj_get_height(lv_obj_get_parent(drag_obj));
|
||||
if(act_par_w == prev_par_w && act_par_h == prev_par_h) {
|
||||
uint16_t new_inv_buf_size = lv_disp_get_inv_buf_size(indev_act->driver.disp);
|
||||
lv_disp_pop_from_inv_buf(indev_act->driver.disp, new_inv_buf_size - inv_buf_size);
|
||||
_lv_disp_pop_from_inv_buf(indev_act->driver.disp, new_inv_buf_size - inv_buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ extern "C" {
|
||||
/**
|
||||
* Initialize the display input device subsystem
|
||||
*/
|
||||
void lv_indev_init(void);
|
||||
void _lv_indev_init(void);
|
||||
|
||||
/**
|
||||
* Called periodically to read the input devices
|
||||
* @param task pointer to the task itself
|
||||
*/
|
||||
void lv_indev_read_task(lv_task_t * task);
|
||||
void _lv_indev_read_task(lv_task_t * task);
|
||||
|
||||
/**
|
||||
* Get the currently processed input device. Can be used in action functions too.
|
||||
@@ -149,13 +149,6 @@ lv_res_t lv_indev_finish_drag(lv_indev_t * indev);
|
||||
*/
|
||||
void lv_indev_wait_release(lv_indev_t * indev);
|
||||
|
||||
/**
|
||||
* Get a pointer to the indev read task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* @param indev pointer to an inout device
|
||||
* @return pointer to the indev read refresher task. (NULL on error)
|
||||
*/
|
||||
lv_task_t * lv_indev_get_read_task(lv_disp_t * indev);
|
||||
|
||||
/**
|
||||
* Gets a pointer to the currently active object in indev proc functions.
|
||||
@@ -172,6 +165,14 @@ lv_obj_t * lv_indev_get_obj_act(void);
|
||||
*/
|
||||
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||
|
||||
/**
|
||||
* Get a pointer to the indev read task to
|
||||
* modify its parameters with `lv_task_...` functions.
|
||||
* @param indev pointer to an inout device
|
||||
* @return pointer to the indev read refresher task. (NULL on error)
|
||||
*/
|
||||
lv_task_t * lv_indev_get_read_task(lv_disp_t * indev);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -89,6 +89,7 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v);
|
||||
static void trans_anim_start_cb(lv_anim_t * a);
|
||||
static void trans_anim_ready_cb(lv_anim_t * a);
|
||||
static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void fade_in_anim_ready(lv_anim_t * a);
|
||||
#endif
|
||||
static void lv_event_mark_deleted(lv_obj_t * obj);
|
||||
static void lv_obj_del_async_cb(void * obj);
|
||||
@@ -123,22 +124,22 @@ void lv_init(void)
|
||||
LV_LOG_TRACE("lv_init started");
|
||||
|
||||
/*Initialize the lv_misc modules*/
|
||||
lv_mem_init();
|
||||
lv_task_core_init();
|
||||
_lv_mem_init();
|
||||
_lv_task_core_init();
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
lv_fs_init();
|
||||
_lv_fs_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_core_init();
|
||||
_lv_anim_core_init();
|
||||
#endif
|
||||
|
||||
#if LV_USE_GROUP
|
||||
lv_group_init();
|
||||
_lv_group_init();
|
||||
#endif
|
||||
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(lv_style_trans_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(lv_style_trans_t));
|
||||
|
||||
lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY,
|
||||
LV_THEME_DEFAULT_FLAG,
|
||||
@@ -146,15 +147,15 @@ void lv_init(void)
|
||||
lv_theme_set_act(th);
|
||||
|
||||
/*Initialize the screen refresh system*/
|
||||
lv_refr_init();
|
||||
_lv_refr_init();
|
||||
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
|
||||
|
||||
/*Init the input device handling*/
|
||||
lv_indev_init();
|
||||
_lv_indev_init();
|
||||
|
||||
lv_img_decoder_init();
|
||||
_lv_img_decoder_init();
|
||||
lv_img_cache_set_size(LV_IMG_CACHE_DEF_SIZE);
|
||||
|
||||
lv_initialized = true;
|
||||
@@ -169,12 +170,12 @@ void lv_init(void)
|
||||
*/
|
||||
void lv_deinit(void)
|
||||
{
|
||||
lv_gc_clear_roots();
|
||||
_lv_gc_clear_roots();
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(NULL);
|
||||
#endif
|
||||
lv_disp_set_default(NULL);
|
||||
lv_mem_deinit();
|
||||
_lv_mem_deinit();
|
||||
lv_initialized = false;
|
||||
#if LV_USE_LOG
|
||||
lv_log_register_print_cb(NULL);
|
||||
@@ -207,11 +208,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
new_obj = lv_ll_ins_head(&disp->scr_ll);
|
||||
new_obj = _lv_ll_ins_head(&disp->scr_ll);
|
||||
LV_ASSERT_MEM(new_obj);
|
||||
if(new_obj == NULL) return NULL;
|
||||
|
||||
lv_memset_00(new_obj, sizeof(lv_obj_t));
|
||||
_lv_memset_00(new_obj, sizeof(lv_obj_t));
|
||||
|
||||
#if LV_USE_BIDI
|
||||
new_obj->base_dir = LV_BIDI_BASE_DIR_DEF;
|
||||
@@ -219,6 +220,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
new_obj->base_dir = LV_BIDI_DIR_LTR;
|
||||
#endif
|
||||
|
||||
/*Set the callbacks*/
|
||||
new_obj->signal_cb = lv_obj_signal;
|
||||
new_obj->design_cb = lv_obj_design;
|
||||
new_obj->event_cb = NULL;
|
||||
|
||||
/*Set coordinates to full screen size*/
|
||||
new_obj->coords.x1 = 0;
|
||||
new_obj->coords.y1 = 0;
|
||||
@@ -230,11 +236,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
LV_LOG_TRACE("Object create started");
|
||||
LV_ASSERT_OBJ(parent, LV_OBJX_NAME);
|
||||
|
||||
new_obj = lv_ll_ins_head(&parent->child_ll);
|
||||
new_obj = _lv_ll_ins_head(&parent->child_ll);
|
||||
LV_ASSERT_MEM(new_obj);
|
||||
if(new_obj == NULL) return NULL;
|
||||
|
||||
lv_memset_00(new_obj, sizeof(lv_obj_t));
|
||||
_lv_memset_00(new_obj, sizeof(lv_obj_t));
|
||||
|
||||
new_obj->parent = parent;
|
||||
|
||||
@@ -244,6 +250,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
new_obj->base_dir = LV_BIDI_DIR_LTR;
|
||||
#endif
|
||||
|
||||
/*Set the callbacks (signal:cb is required in `lv_obj_get_base_dir` if `LV_USE_ASSERT_OBJ` is enabled)*/
|
||||
new_obj->signal_cb = lv_obj_signal;
|
||||
new_obj->design_cb = lv_obj_design;
|
||||
new_obj->event_cb = NULL;
|
||||
|
||||
new_obj->coords.y1 = parent->coords.y1;
|
||||
new_obj->coords.y2 = parent->coords.y1 + LV_OBJ_DEF_HEIGHT;
|
||||
if(lv_obj_get_base_dir(new_obj) == LV_BIDI_DIR_RTL) {
|
||||
@@ -257,17 +268,13 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
|
||||
lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t));
|
||||
_lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t));
|
||||
|
||||
/*Set the callbacks*/
|
||||
new_obj->signal_cb = lv_obj_signal;
|
||||
new_obj->design_cb = lv_obj_design;
|
||||
new_obj->event_cb = NULL;
|
||||
|
||||
new_obj->ext_draw_pad = 0;
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
lv_memset_00(&new_obj->ext_click_pad, sizeof(new_obj->ext_click_pad));
|
||||
_lv_memset_00(&new_obj->ext_click_pad, sizeof(new_obj->ext_click_pad));
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
new_obj->ext_click_pad_hor = 0;
|
||||
new_obj->ext_click_pad_ver = 0;
|
||||
@@ -284,7 +291,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
|
||||
/*Init. user date*/
|
||||
#if LV_USE_USER_DATA
|
||||
lv_memset_00(&new_obj->user_data, sizeof(lv_obj_user_data_t));
|
||||
_lv_memset_00(&new_obj->user_data, sizeof(lv_obj_user_data_t));
|
||||
#endif
|
||||
|
||||
|
||||
@@ -330,7 +337,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
|
||||
/*Set user data*/
|
||||
#if LV_USE_USER_DATA
|
||||
lv_memcpy(&new_obj->user_data, ©->user_data, sizeof(lv_obj_user_data_t));
|
||||
_lv_memcpy(&new_obj->user_data, ©->user_data, sizeof(lv_obj_user_data_t));
|
||||
#endif
|
||||
|
||||
/*Copy realign*/
|
||||
@@ -492,20 +499,20 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area)
|
||||
bool is_common;
|
||||
lv_area_t area_trunc;
|
||||
|
||||
is_common = lv_area_intersect(&area_trunc, area, &obj_coords);
|
||||
is_common = _lv_area_intersect(&area_trunc, area, &obj_coords);
|
||||
if(is_common == false) return; /*The area is not on the object*/
|
||||
|
||||
/*Truncate recursively to the parents*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
while(par != NULL) {
|
||||
is_common = lv_area_intersect(&area_trunc, &area_trunc, &par->coords);
|
||||
is_common = _lv_area_intersect(&area_trunc, &area_trunc, &par->coords);
|
||||
if(is_common == false) break; /*If no common parts with parent break;*/
|
||||
if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
|
||||
par = lv_obj_get_parent(par);
|
||||
}
|
||||
|
||||
if(is_common) lv_inv_area(disp, &area_trunc);
|
||||
if(is_common) _lv_inv_area(disp, &area_trunc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -572,7 +579,7 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
old_pos.x = old_par->coords.x2 - obj->coords.x2;
|
||||
}
|
||||
|
||||
lv_ll_chg_list(&obj->parent->child_ll, &parent->child_ll, obj, true);
|
||||
_lv_ll_chg_list(&obj->parent->child_ll, &parent->child_ll, obj, true);
|
||||
obj->parent = parent;
|
||||
|
||||
|
||||
@@ -605,11 +612,11 @@ void lv_obj_move_foreground(lv_obj_t * obj)
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
||||
/*Do nothing of already in the foreground*/
|
||||
if(lv_ll_get_head(&parent->child_ll) == obj) return;
|
||||
if(_lv_ll_get_head(&parent->child_ll) == obj) return;
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
|
||||
lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, true);
|
||||
_lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, true);
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
@@ -628,11 +635,11 @@ void lv_obj_move_background(lv_obj_t * obj)
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
|
||||
/*Do nothing of already in the background*/
|
||||
if(lv_ll_get_tail(&parent->child_ll) == obj) return;
|
||||
if(_lv_ll_get_tail(&parent->child_ll) == obj) return;
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
|
||||
lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, false);
|
||||
_lv_ll_chg_list(&parent->child_ll, &parent->child_ll, obj, false);
|
||||
|
||||
/*Notify the new parent about the child*/
|
||||
parent->signal_cb(parent, LV_SIGNAL_CHILD_CHG, obj);
|
||||
@@ -765,7 +772,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h)
|
||||
|
||||
/*Tell the children the parent's size has changed*/
|
||||
lv_obj_t * i;
|
||||
LV_LL_READ(obj->child_ll, i) {
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
i->signal_cb(i, LV_SIGNAL_PARENT_SIZE_CHG, &ori);
|
||||
}
|
||||
|
||||
@@ -874,7 +881,7 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||
|
||||
lv_point_t new_pos;
|
||||
lv_area_align(&base->coords, &obj->coords, align, &new_pos);
|
||||
_lv_area_align(&base->coords, &obj->coords, align, &new_pos);
|
||||
|
||||
/*Bring together the coordination system of base and obj*/
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
@@ -1141,7 +1148,7 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
|
||||
return;
|
||||
}
|
||||
|
||||
lv_style_list_add_style(style_dsc, style);
|
||||
_lv_style_list_add_style(style_dsc, style);
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, part, 0xFF, NULL);
|
||||
#endif
|
||||
@@ -1164,7 +1171,7 @@ void lv_obj_clean_style_list(lv_obj_t * obj, uint8_t part)
|
||||
return;
|
||||
}
|
||||
|
||||
lv_style_list_reset(style_dsc);
|
||||
_lv_style_list_reset(style_dsc);
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, part, 0xFF, NULL);
|
||||
#endif
|
||||
@@ -1200,7 +1207,7 @@ void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part)
|
||||
void _lv_obj_set_style_local_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_int(style_dsc, prop, value);
|
||||
_lv_style_list_set_local_int(style_dsc, prop, value);
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, part, prop, NULL);
|
||||
#endif
|
||||
@@ -1222,7 +1229,7 @@ void _lv_obj_set_style_local_int(lv_obj_t * obj, uint8_t part, lv_style_property
|
||||
void _lv_obj_set_style_local_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_color(style_dsc, prop, color);
|
||||
_lv_style_list_set_local_color(style_dsc, prop, color);
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, part, prop, NULL);
|
||||
#endif
|
||||
@@ -1244,7 +1251,7 @@ void _lv_obj_set_style_local_color(lv_obj_t * obj, uint8_t part, lv_style_proper
|
||||
void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_opa(style_dsc, prop, opa);
|
||||
_lv_style_list_set_local_opa(style_dsc, prop, opa);
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, part, prop, NULL);
|
||||
#endif
|
||||
@@ -1266,7 +1273,7 @@ void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t part, lv_style_property
|
||||
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, const void * value)
|
||||
{
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
|
||||
lv_style_list_set_local_ptr(style_dsc, prop, value);
|
||||
_lv_style_list_set_local_ptr(style_dsc, prop, value);
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, part, prop, NULL);
|
||||
#endif
|
||||
@@ -1284,7 +1291,7 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property
|
||||
* For example: `lv_obj_style_remove_border_opa()`
|
||||
* @return true: the property was found and removed; false: teh property was not found
|
||||
*/
|
||||
bool _lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
|
||||
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
lv_style_t * style = lv_obj_get_local_style(obj, part);
|
||||
@@ -1309,6 +1316,8 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_property_t prop)
|
||||
case LV_STYLE_SIZE:
|
||||
case LV_STYLE_TRANSFORM_WIDTH:
|
||||
case LV_STYLE_TRANSFORM_HEIGHT:
|
||||
case LV_STYLE_TRANSFORM_ANGLE:
|
||||
case LV_STYLE_TRANSFORM_ZOOM:
|
||||
case LV_STYLE_PAD_TOP:
|
||||
case LV_STYLE_PAD_BOTTOM:
|
||||
case LV_STYLE_PAD_LEFT:
|
||||
@@ -1379,7 +1388,7 @@ void lv_obj_report_style_mod(lv_style_t * style)
|
||||
|
||||
while(d) {
|
||||
lv_obj_t * i;
|
||||
LV_LL_READ(d->scr_ll, i) {
|
||||
_LV_LL_READ(d->scr_ll, i) {
|
||||
report_style_mod_core(style, i);
|
||||
}
|
||||
d = lv_disp_get_next(d);
|
||||
@@ -1608,7 +1617,7 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_STYLE_TRANS_NUM_MAX; i++) {
|
||||
if(props[i] != 0) {
|
||||
lv_style_list_add_trans_style(style_list);
|
||||
_lv_style_list_add_trans_style(style_list);
|
||||
|
||||
lv_style_trans_t * tr = trans_create(obj, props[i], part, prev_state, new_state);
|
||||
|
||||
@@ -1685,7 +1694,7 @@ void lv_obj_finish_transitions(lv_obj_t * obj, uint8_t part)
|
||||
{
|
||||
/*Animate all related transition to the end value*/
|
||||
lv_style_trans_t * tr;
|
||||
LV_LL_READ_BACK(LV_GC_ROOT(_lv_obj_style_trans_ll), tr) {
|
||||
_LV_LL_READ_BACK(LV_GC_ROOT(_lv_obj_style_trans_ll), tr) {
|
||||
if(tr->obj == obj && (part == tr->part || part == LV_OBJ_PART_ALL)) {
|
||||
trans_anim_cb(tr, 255);
|
||||
}
|
||||
@@ -1917,9 +1926,9 @@ lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj)
|
||||
scr = lv_obj_get_screen(obj); /*get the screen of `obj`*/
|
||||
|
||||
lv_disp_t * d;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_disp_ll), d) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_disp_ll), d) {
|
||||
lv_obj_t * s;
|
||||
LV_LL_READ(d->scr_ll, s) {
|
||||
_LV_LL_READ(d->scr_ll, s) {
|
||||
if(s == scr) return d;
|
||||
}
|
||||
}
|
||||
@@ -1958,10 +1967,10 @@ lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child)
|
||||
lv_obj_t * result = NULL;
|
||||
|
||||
if(child == NULL) {
|
||||
result = lv_ll_get_head(&obj->child_ll);
|
||||
result = _lv_ll_get_head(&obj->child_ll);
|
||||
}
|
||||
else {
|
||||
result = lv_ll_get_next(&obj->child_ll, child);
|
||||
result = _lv_ll_get_next(&obj->child_ll, child);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -1981,10 +1990,10 @@ lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child)
|
||||
lv_obj_t * result = NULL;
|
||||
|
||||
if(child == NULL) {
|
||||
result = lv_ll_get_tail(&obj->child_ll);
|
||||
result = _lv_ll_get_tail(&obj->child_ll);
|
||||
}
|
||||
else {
|
||||
result = lv_ll_get_prev(&obj->child_ll, child);
|
||||
result = _lv_ll_get_prev(&obj->child_ll, child);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -2002,7 +2011,7 @@ uint16_t lv_obj_count_children(const lv_obj_t * obj)
|
||||
lv_obj_t * i;
|
||||
uint16_t cnt = 0;
|
||||
|
||||
LV_LL_READ(obj->child_ll, i) cnt++;
|
||||
_LV_LL_READ(obj->child_ll, i) cnt++;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
@@ -2018,7 +2027,7 @@ uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj)
|
||||
lv_obj_t * i;
|
||||
uint16_t cnt = 0;
|
||||
|
||||
LV_LL_READ(obj->child_ll, i) {
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
cnt++; /*Count the child*/
|
||||
cnt += lv_obj_count_children_recursive(i); /*recursively count children's children*/
|
||||
}
|
||||
@@ -2382,7 +2391,7 @@ lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_styl
|
||||
lv_state_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_list_get_int(dsc, prop, &value_act);
|
||||
res = _lv_style_list_get_int(dsc, prop, &value_act);
|
||||
if(res == LV_RES_OK) return value_act;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -2445,7 +2454,7 @@ lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_
|
||||
lv_state_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_list_get_color(dsc, prop, &value_act);
|
||||
res = _lv_style_list_get_color(dsc, prop, &value_act);
|
||||
if(res == LV_RES_OK) return value_act;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -2501,7 +2510,7 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
|
||||
lv_state_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_list_get_opa(dsc, prop, &value_act);
|
||||
res = _lv_style_list_get_opa(dsc, prop, &value_act);
|
||||
if(res == LV_RES_OK) return value_act;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -2558,7 +2567,7 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
|
||||
lv_state_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_list_get_ptr(dsc, prop, &value_act);
|
||||
res = _lv_style_list_get_ptr(dsc, prop, &value_act);
|
||||
if(res == LV_RES_OK) return value_act;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -2578,7 +2587,7 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
|
||||
switch(prop) {
|
||||
case LV_STYLE_TEXT_FONT:
|
||||
case LV_STYLE_VALUE_FONT:
|
||||
return LV_THEME_DEFAULT_FONT_NORMAL;
|
||||
return lv_theme_get_font_normal();
|
||||
#if LV_USE_ANIMATION
|
||||
case LV_STYLE_TRANSITION_PATH:
|
||||
return &lv_anim_path_def;
|
||||
@@ -2725,6 +2734,8 @@ bool lv_obj_get_parent_event(const lv_obj_t * obj)
|
||||
|
||||
lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
#if LV_USE_BIDI
|
||||
const lv_obj_t * parent = obj;
|
||||
|
||||
@@ -2850,8 +2861,8 @@ void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf)
|
||||
|
||||
lv_obj_type_t tmp;
|
||||
|
||||
lv_memset_00(buf, sizeof(lv_obj_type_t));
|
||||
lv_memset_00(&tmp, sizeof(lv_obj_type_t));
|
||||
_lv_memset_00(buf, sizeof(lv_obj_type_t));
|
||||
_lv_memset_00(&tmp, sizeof(lv_obj_type_t));
|
||||
|
||||
obj->signal_cb((lv_obj_t *)obj, LV_SIGNAL_GET_TYPE, &tmp);
|
||||
|
||||
@@ -2902,7 +2913,7 @@ void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
lv_memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t));
|
||||
_lv_memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2963,7 +2974,7 @@ bool lv_obj_is_point_on_coords(lv_obj_t * obj, const lv_point_t * point)
|
||||
ext_area.y1 = obj->coords.y1 - obj->ext_click_pad_ver;
|
||||
ext_area.y2 = obj->coords.y2 + obj->ext_click_pad_ver;
|
||||
|
||||
if(!lv_area_is_point_on(&ext_area, point, 0)) {
|
||||
if(!_lv_area_is_point_on(&ext_area, point, 0)) {
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
lv_area_t ext_area;
|
||||
ext_area.x1 = obj->coords.x1 - obj->ext_click_pad.x1;
|
||||
@@ -2971,9 +2982,9 @@ bool lv_obj_is_point_on_coords(lv_obj_t * obj, const lv_point_t * point)
|
||||
ext_area.y1 = obj->coords.y1 - obj->ext_click_pad.y1;
|
||||
ext_area.y2 = obj->coords.y2 + obj->ext_click_pad.y2;
|
||||
|
||||
if(!lv_area_is_point_on(&ext_area, point, 0)) {
|
||||
if(!_lv_area_is_point_on(&ext_area, point, 0)) {
|
||||
#else
|
||||
if(!lv_area_is_point_on(&obj->coords, point, 0)) {
|
||||
if(!_lv_area_is_point_on(&obj->coords, point, 0)) {
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -3276,7 +3287,7 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
|
||||
const lv_font_t * font = lv_obj_get_style_value_font(obj, part);
|
||||
|
||||
lv_point_t txt_size;
|
||||
lv_txt_get_size(&txt_size, value_str, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
|
||||
_lv_txt_get_size(&txt_size, value_str, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
|
||||
|
||||
lv_area_t value_area;
|
||||
value_area.x1 = 0;
|
||||
@@ -3288,7 +3299,7 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
|
||||
lv_style_int_t xofs = lv_obj_get_style_value_ofs_x(obj, part);
|
||||
lv_style_int_t yofs = lv_obj_get_style_value_ofs_y(obj, part);
|
||||
lv_point_t p_align;
|
||||
lv_area_align(&obj->coords, &value_area, align, &p_align);
|
||||
_lv_area_align(&obj->coords, &value_area, align, &p_align);
|
||||
|
||||
value_area.x1 += p_align.x + xofs;
|
||||
value_area.y1 += p_align.y + yofs;
|
||||
@@ -3333,6 +3344,7 @@ void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay)
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)opa_scale_anim);
|
||||
lv_anim_set_ready_cb(&a, fade_in_anim_ready);
|
||||
lv_anim_set_time(&a, time);
|
||||
lv_anim_set_delay(&a, delay);
|
||||
lv_anim_start(&a);
|
||||
@@ -3405,10 +3417,10 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
/*Recursively delete the children*/
|
||||
lv_obj_t * i;
|
||||
lv_obj_t * i_next;
|
||||
i = lv_ll_get_head(&(obj->child_ll));
|
||||
i = _lv_ll_get_head(&(obj->child_ll));
|
||||
while(i != NULL) {
|
||||
/*Get the next object before delete this*/
|
||||
i_next = lv_ll_get_next(&(obj->child_ll), i);
|
||||
i_next = _lv_ll_get_next(&(obj->child_ll), i);
|
||||
|
||||
/*Call the recursive del to the child too*/
|
||||
obj_del_core(i);
|
||||
@@ -3445,10 +3457,10 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
||||
if(par == NULL) { /*It is a screen*/
|
||||
lv_disp_t * d = lv_obj_get_disp(obj);
|
||||
lv_ll_remove(&d->scr_ll, obj);
|
||||
_lv_ll_remove(&d->scr_ll, obj);
|
||||
}
|
||||
else {
|
||||
lv_ll_remove(&(par->child_ll), obj);
|
||||
_lv_ll_remove(&(par->child_ll), obj);
|
||||
}
|
||||
|
||||
/*Delete the base objects*/
|
||||
@@ -3481,7 +3493,7 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
|
||||
coords.y1 -= h;
|
||||
coords.y2 += h;
|
||||
|
||||
if(lv_area_is_in(clip_area, &coords, r) == false) return LV_DESIGN_RES_NOT_COVER;
|
||||
if(_lv_area_is_in(clip_area, &coords, r) == false) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
if(lv_obj_get_style_bg_opa(obj, LV_OBJ_PART_MAIN) < LV_OPA_MAX) return LV_DESIGN_RES_NOT_COVER;
|
||||
|
||||
@@ -3514,7 +3526,7 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
|
||||
lv_draw_rect(&coords, clip_area, &draw_dsc);
|
||||
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) {
|
||||
lv_draw_mask_radius_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
||||
lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
||||
|
||||
lv_coord_t r = lv_obj_get_style_radius(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
@@ -3526,7 +3538,7 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) {
|
||||
lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(obj + 8);
|
||||
lv_mem_buf_release(param);
|
||||
_lv_mem_buf_release(param);
|
||||
}
|
||||
|
||||
/*If the border is drawn later disable loading other properties*/
|
||||
@@ -3628,7 +3640,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
|
||||
static void refresh_children_position(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
LV_LL_READ(obj->child_ll, i) {
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
i->coords.x1 += x_diff;
|
||||
i->coords.y1 += y_diff;
|
||||
i->coords.x2 += x_diff;
|
||||
@@ -3718,7 +3730,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
{
|
||||
lv_style_trans_t * tr;
|
||||
lv_style_list_t * style_list = lv_obj_get_style_list(obj, part);
|
||||
lv_style_t * style_trans = lv_style_list_get_transition_style(style_list);
|
||||
lv_style_t * style_trans = _lv_style_list_get_transition_style(style_list);
|
||||
|
||||
/*Get the previous and current values*/
|
||||
if((prop & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/
|
||||
@@ -3744,7 +3756,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
}
|
||||
}
|
||||
|
||||
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
LV_ASSERT_MEM(tr);
|
||||
if(tr == NULL) return NULL;
|
||||
tr->start_value._int = int1;
|
||||
@@ -3764,7 +3776,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
_lv_style_set_color(style_trans, prop, c1); /*Be sure `trans_style` has a valid value */
|
||||
|
||||
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
LV_ASSERT_MEM(tr);
|
||||
if(tr == NULL) return NULL;
|
||||
tr->start_value._color = c1;
|
||||
@@ -3785,7 +3797,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
_lv_style_set_opa(style_trans, prop, o1); /*Be sure `trans_style` has a valid value */
|
||||
|
||||
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
LV_ASSERT_MEM(tr);
|
||||
if(tr == NULL) return NULL;
|
||||
tr->start_value._opa = o1;
|
||||
@@ -3805,7 +3817,7 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
|
||||
obj->state = new_state;
|
||||
_lv_style_set_ptr(style_trans, prop, p1); /*Be sure `trans_style` has a valid value */
|
||||
|
||||
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
tr = _lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
LV_ASSERT_MEM(tr);
|
||||
if(tr == NULL) return NULL;
|
||||
tr->start_value._ptr = p1;
|
||||
@@ -3828,22 +3840,22 @@ static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv
|
||||
{
|
||||
lv_style_trans_t * tr;
|
||||
lv_style_trans_t * tr_prev;
|
||||
tr = lv_ll_get_tail(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
tr = _lv_ll_get_tail(&LV_GC_ROOT(_lv_obj_style_trans_ll));
|
||||
while(tr != NULL) {
|
||||
if(tr == tr_limit) break;
|
||||
|
||||
/*'tr' might be deleted, so get the next object while 'tr' is valid*/
|
||||
tr_prev = lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
tr_prev = _lv_ll_get_prev(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
|
||||
if(tr->obj == obj && (part == tr->part || part == 0xFF) && (prop == tr->prop || prop == 0xFF)) {
|
||||
/* Remove the transitioned property from trans. style
|
||||
* to allow changing it by normal styles*/
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
lv_style_t * style_trans = lv_style_list_get_transition_style(list);
|
||||
lv_style_t * style_trans = _lv_style_list_get_transition_style(list);
|
||||
lv_style_remove_prop(style_trans, tr->prop);
|
||||
|
||||
lv_anim_del(tr, NULL);
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
}
|
||||
tr = tr_prev;
|
||||
@@ -3853,7 +3865,7 @@ static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv
|
||||
static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v)
|
||||
{
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
lv_style_t * style = lv_style_list_get_transition_style(list);
|
||||
lv_style_t * style = _lv_style_list_get_transition_style(list);
|
||||
|
||||
if((tr->prop & 0xF) < LV_STYLE_ID_COLOR) { /*Value*/
|
||||
lv_style_int_t x;
|
||||
@@ -3925,7 +3937,7 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
|
||||
bool running = false;
|
||||
lv_style_trans_t * tr_i;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_obj_style_trans_ll), tr_i) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_obj_style_trans_ll), tr_i) {
|
||||
if(tr_i != tr && tr_i->obj == tr->obj && tr_i->part == tr->part && tr_i->prop == tr->prop) {
|
||||
running = true;
|
||||
}
|
||||
@@ -3933,11 +3945,11 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
|
||||
if(!running) {
|
||||
lv_style_list_t * list = lv_obj_get_style_list(tr->obj, tr->part);
|
||||
lv_style_t * style_trans = lv_style_list_get_transition_style(list);
|
||||
lv_style_t * style_trans = _lv_style_list_get_transition_style(list);
|
||||
lv_style_remove_prop(style_trans, tr->prop);
|
||||
}
|
||||
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
}
|
||||
|
||||
@@ -3946,6 +3958,11 @@ static void opa_scale_anim(lv_obj_t * obj, lv_anim_value_t v)
|
||||
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
|
||||
}
|
||||
|
||||
static void fade_in_anim_ready(lv_anim_t * a)
|
||||
{
|
||||
lv_style_remove_prop(lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void lv_event_mark_deleted(lv_obj_t * obj)
|
||||
|
||||
@@ -20,10 +20,7 @@ extern "C" {
|
||||
#include "lv_style.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../lv_misc/lv_area.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_ll.h"
|
||||
#include "../lv_misc/lv_color.h"
|
||||
#include "../lv_misc/lv_bidi.h"
|
||||
#include "../lv_hal/lv_hal.h"
|
||||
#include "../lv_draw/lv_draw_rect.h"
|
||||
#include "../lv_draw/lv_draw_label.h"
|
||||
@@ -36,11 +33,11 @@ extern "C" {
|
||||
|
||||
/*Error check of lv_conf.h*/
|
||||
#if LV_HOR_RES_MAX == 0 || LV_VER_RES_MAX == 0
|
||||
#error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"
|
||||
#error "LVGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"
|
||||
#endif
|
||||
|
||||
#if LV_ANTIALIAS > 1
|
||||
#error "LittlevGL: LV_ANTIALIAS can be only 0 or 1"
|
||||
#error "LVGL: LV_ANTIALIAS can be only 0 or 1"
|
||||
#endif
|
||||
|
||||
#define LV_MAX_ANCESTOR_NUM 8
|
||||
@@ -126,7 +123,7 @@ enum {
|
||||
LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */
|
||||
LV_SIGNAL_BASE_DIR_CHG, /**<The base dir has changed*/
|
||||
LV_SIGNAL_REFR_EXT_DRAW_PAD, /**< Object's extra padding has changed */
|
||||
LV_SIGNAL_GET_TYPE, /**< LittlevGL needs to retrieve the object's type */
|
||||
LV_SIGNAL_GET_TYPE, /**< LVGL needs to retrieve the object's type */
|
||||
LV_SIGNAL_GET_STYLE, /**<Get the style of an object*/
|
||||
LV_SIGNAL_GET_STATE_DSC, /**<Get the state of the object*/
|
||||
|
||||
@@ -614,7 +611,7 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property
|
||||
* For example: `lv_obj_style_remove_border_opa()`
|
||||
* @return true: the property was found and removed; false: teh property was not found
|
||||
*/
|
||||
bool _lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
bool lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||
|
||||
/*-----------------
|
||||
* Attribute set
|
||||
@@ -1327,7 +1324,7 @@ lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name);
|
||||
/**
|
||||
* Initialize a rectangle descriptor from an object's styles
|
||||
* @param obj pointer to an object
|
||||
* @param type type of style. E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_STYLE_REL` or `LV_PAGE_STYLE_SCRL`
|
||||
* @param type type of style. E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_SLIDER_KOB`
|
||||
* @param draw_dsc the descriptor the initialize
|
||||
* @note Only the relevant fields will be set.
|
||||
* E.g. if `border width == 0` the other border properties won't be evaluated.
|
||||
@@ -1369,19 +1366,19 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
|
||||
|
||||
/**
|
||||
* Helps to quickly declare an event callback function.
|
||||
* Will be expanded to: `void <name> (lv_obj_t * obj, lv_event_t e)`
|
||||
* Will be expanded to: `static void <name> (lv_obj_t * obj, lv_event_t e)`
|
||||
*
|
||||
* Examples:
|
||||
* static LV_EVENT_CB_DECLARE(my_event1); //Protoype declaration
|
||||
* LV_EVENT_CB_DECLARE(my_event1); //Protoype declaration
|
||||
*
|
||||
* static LV_EVENT_CB_DECLARE(my_event1)
|
||||
* LV_EVENT_CB_DECLARE(my_event1)
|
||||
* {
|
||||
* if(e == LV_EVENT_CLICKED) {
|
||||
* lv_obj_set_hidden(obj ,true);
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
#define LV_EVENT_CB_DECLARE(name) void name(lv_obj_t * obj, lv_event_t e)
|
||||
#define LV_EVENT_CB_DECLARE(name) static void name(lv_obj_t * obj, lv_event_t e)
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -95,20 +95,8 @@ extern "C" {
|
||||
}
|
||||
|
||||
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type, scalar) \
|
||||
_OBJ_GET_STYLE_##scalar(prop_name, func_name, value_type, style_type) \
|
||||
_OBJ_GET_STYLE_##scalar(prop_name, func_name, value_type, style_type) \
|
||||
_OBJ_SET_STYLE_LOCAL_##scalar(prop_name, func_name, value_type, style_type) \
|
||||
static inline void lv_obj_get_style_local_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, void * res) \
|
||||
{ \
|
||||
_lv_style_get##style_type (lv_obj_get_local_style(obj, part), LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), res); \
|
||||
} \
|
||||
static inline void lv_obj_remove_style_local_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state) \
|
||||
{ \
|
||||
_lv_obj_remove_style_local_prop(obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS)); \
|
||||
} \
|
||||
static inline int16_t lv_style_get_##func_name (lv_style_t * style, lv_state_t state, void * res) \
|
||||
{ \
|
||||
return _lv_style_get##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), res); \
|
||||
} \
|
||||
_OBJ_SET_STYLE_##scalar(prop_name, func_name, value_type, style_type)
|
||||
|
||||
_LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t, _int, scalar)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
#include "../lv_font/lv_font_fmt_txt.h"
|
||||
|
||||
#if LV_USE_PERF_MONITOR
|
||||
#include "../lv_widgets/lv_label.h"
|
||||
@@ -64,7 +65,7 @@ static lv_disp_t * disp_refr; /*Display being refreshed*/
|
||||
/**
|
||||
* Initialize the screen refresh subsystem
|
||||
*/
|
||||
void lv_refr_init(void)
|
||||
void _lv_refr_init(void)
|
||||
{
|
||||
/*Nothing to do*/
|
||||
}
|
||||
@@ -83,13 +84,13 @@ void lv_refr_now(lv_disp_t * disp)
|
||||
#endif
|
||||
|
||||
if(disp) {
|
||||
lv_disp_refr_task(disp->refr_task);
|
||||
_lv_disp_refr_task(disp->refr_task);
|
||||
}
|
||||
else {
|
||||
lv_disp_t * d;
|
||||
d = lv_disp_get_next(NULL);
|
||||
while(d) {
|
||||
lv_disp_refr_task(d->refr_task);
|
||||
_lv_disp_refr_task(d->refr_task);
|
||||
d = lv_disp_get_next(d);
|
||||
}
|
||||
}
|
||||
@@ -101,7 +102,7 @@ void lv_refr_now(lv_disp_t * disp)
|
||||
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
|
||||
* only one display)
|
||||
*/
|
||||
void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
{
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) return;
|
||||
@@ -121,7 +122,7 @@ void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
lv_area_t com_area;
|
||||
bool suc;
|
||||
|
||||
suc = lv_area_intersect(&com_area, area_p, &scr_area);
|
||||
suc = _lv_area_intersect(&com_area, area_p, &scr_area);
|
||||
|
||||
/*The area is truncated to the screen*/
|
||||
if(suc != false) {
|
||||
@@ -130,7 +131,7 @@ void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
/*Save only if this area is not in one of the saved areas*/
|
||||
uint16_t i;
|
||||
for(i = 0; i < disp->inv_p; i++) {
|
||||
if(lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return;
|
||||
if(_lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return;
|
||||
}
|
||||
|
||||
/*Save the area*/
|
||||
@@ -150,7 +151,7 @@ void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p)
|
||||
* Get the display which is being refreshed
|
||||
* @return the display being refreshed
|
||||
*/
|
||||
lv_disp_t * lv_refr_get_disp_refreshing(void)
|
||||
lv_disp_t * _lv_refr_get_disp_refreshing(void)
|
||||
{
|
||||
return disp_refr;
|
||||
}
|
||||
@@ -161,7 +162,7 @@ lv_disp_t * lv_refr_get_disp_refreshing(void)
|
||||
* It can be used to trick the drawing functions about there is an active display.
|
||||
* @param the display being refreshed
|
||||
*/
|
||||
void lv_refr_set_disp_refreshing(lv_disp_t * disp)
|
||||
void _lv_refr_set_disp_refreshing(lv_disp_t * disp)
|
||||
{
|
||||
disp_refr = disp;
|
||||
}
|
||||
@@ -170,7 +171,7 @@ void lv_refr_set_disp_refreshing(lv_disp_t * disp)
|
||||
* Called periodically to handle the refreshing
|
||||
* @param task pointer to the task itself
|
||||
*/
|
||||
void lv_disp_refr_task(lv_task_t * task)
|
||||
void _lv_disp_refr_task(lv_task_t * task)
|
||||
{
|
||||
LV_LOG_TRACE("lv_refr_task: started");
|
||||
|
||||
@@ -225,7 +226,7 @@ void lv_disp_refr_task(lv_task_t * task)
|
||||
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
|
||||
|
||||
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
|
||||
lv_memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
|
||||
_lv_memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
|
||||
start_offs += hres * sizeof(lv_color_t);
|
||||
}
|
||||
}
|
||||
@@ -233,8 +234,8 @@ void lv_disp_refr_task(lv_task_t * task)
|
||||
} /*End of true double buffer handling*/
|
||||
|
||||
/*Clean up*/
|
||||
lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
lv_memset_00(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
|
||||
_lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
_lv_memset_00(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
|
||||
disp_refr->inv_p = 0;
|
||||
|
||||
elaps = lv_tick_elaps(start);
|
||||
@@ -244,7 +245,8 @@ void lv_disp_refr_task(lv_task_t * task)
|
||||
}
|
||||
}
|
||||
|
||||
lv_mem_buf_free_all();
|
||||
_lv_mem_buf_free_all();
|
||||
_lv_font_clean_up_fmt_txt();
|
||||
|
||||
#if LV_USE_PERF_MONITOR && LV_USE_LABEL
|
||||
static lv_obj_t * perf_label = NULL;
|
||||
@@ -306,11 +308,11 @@ static void lv_refr_join_area(void)
|
||||
}
|
||||
|
||||
/*Check if the areas are on each other*/
|
||||
if(lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) {
|
||||
if(_lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]);
|
||||
_lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]);
|
||||
|
||||
/*Join two area only if the joined area size is smaller*/
|
||||
if(lv_area_get_size(&joined_area) < (lv_area_get_size(&disp_refr->inv_areas[join_in]) +
|
||||
@@ -338,8 +340,8 @@ static void lv_refr_areas(void)
|
||||
int32_t last_i = 0;
|
||||
for(i = disp_refr->inv_p - 1; i >= 0; i--) {
|
||||
if(disp_refr->inv_area_joined[i] == 0) {
|
||||
last_i = i;
|
||||
break;
|
||||
last_i = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,8 +352,8 @@ static void lv_refr_areas(void)
|
||||
/*Refresh the unjoined areas*/
|
||||
if(disp_refr->inv_area_joined[i] == 0) {
|
||||
|
||||
if(i == last_i) disp_refr->driver.buffer->last_area = 1;
|
||||
disp_refr->driver.buffer->last_part = 0;
|
||||
if(i == last_i) disp_refr->driver.buffer->last_area = 1;
|
||||
disp_refr->driver.buffer->last_part = 0;
|
||||
lv_refr_area(&disp_refr->inv_areas[i]);
|
||||
|
||||
if(disp_refr->driver.monitor_cb) px_num += lv_area_get_size(&disp_refr->inv_areas[i]);
|
||||
@@ -383,7 +385,7 @@ static void lv_refr_area(const lv_area_t * 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 y2 =
|
||||
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? y2 = lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
area_p->y2 >= lv_disp_get_ver_res(disp_refr) ? lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
|
||||
int32_t max_row = (uint32_t)vdb->size / w;
|
||||
|
||||
@@ -468,7 +470,7 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
/*Get the new mask from the original area and the act. VDB
|
||||
It will be a part of 'area_p'*/
|
||||
lv_area_t start_mask;
|
||||
lv_area_intersect(&start_mask, area_p, &vdb->area);
|
||||
_lv_area_intersect(&start_mask, area_p, &vdb->area);
|
||||
|
||||
/*Get the most top object which is not covered by others*/
|
||||
top_p = lv_refr_get_top_obj(&start_mask, lv_disp_get_scr_act(disp_refr));
|
||||
@@ -498,13 +500,13 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
lv_obj_t * found_p = NULL;
|
||||
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
if(lv_area_is_in(area_p, &obj->coords, 0) && obj->hidden == 0) {
|
||||
if(_lv_area_is_in(area_p, &obj->coords, 0) && obj->hidden == 0) {
|
||||
lv_design_res_t design_res = obj->design_cb ? obj->design_cb(obj, area_p,
|
||||
LV_DESIGN_COVER_CHK) : LV_DESIGN_RES_NOT_COVER;
|
||||
if(design_res == LV_DESIGN_RES_MASKED) return NULL;
|
||||
|
||||
lv_obj_t * i;
|
||||
LV_LL_READ(obj->child_ll, i) {
|
||||
_LV_LL_READ(obj->child_ll, i) {
|
||||
found_p = lv_refr_get_top_obj(area_p, i);
|
||||
|
||||
/*If a children is ok then break*/
|
||||
@@ -549,12 +551,12 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
/*Do until not reach the screen*/
|
||||
while(par != NULL) {
|
||||
/*object before border_p has to be redrawn*/
|
||||
lv_obj_t * i = lv_ll_get_prev(&(par->child_ll), border_p);
|
||||
lv_obj_t * i = _lv_ll_get_prev(&(par->child_ll), border_p);
|
||||
|
||||
while(i != NULL) {
|
||||
/*Refresh the objects*/
|
||||
lv_refr_obj(i, mask_p);
|
||||
i = lv_ll_get_prev(&(par->child_ll), i);
|
||||
i = _lv_ll_get_prev(&(par->child_ll), i);
|
||||
}
|
||||
|
||||
/*Call the post draw design function of the parents of the to object*/
|
||||
@@ -590,7 +592,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
obj_area.y1 -= ext_size;
|
||||
obj_area.x2 += ext_size;
|
||||
obj_area.y2 += ext_size;
|
||||
union_ok = lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area);
|
||||
union_ok = _lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area);
|
||||
|
||||
/*Draw the parent and its children only if they ore on 'mask_parent'*/
|
||||
if(union_ok != false) {
|
||||
@@ -617,12 +619,12 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
#endif
|
||||
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/
|
||||
lv_obj_get_coords(obj, &obj_area);
|
||||
union_ok = lv_area_intersect(&obj_mask, mask_ori_p, &obj_area);
|
||||
union_ok = _lv_area_intersect(&obj_mask, mask_ori_p, &obj_area);
|
||||
if(union_ok != false) {
|
||||
lv_area_t mask_child; /*Mask from obj and its child*/
|
||||
lv_obj_t * child_p;
|
||||
lv_area_t child_area;
|
||||
LV_LL_READ_BACK(obj->child_ll, child_p) {
|
||||
_LV_LL_READ_BACK(obj->child_ll, child_p) {
|
||||
lv_obj_get_coords(child_p, &child_area);
|
||||
ext_size = child_p->ext_draw_pad;
|
||||
child_area.x1 -= ext_size;
|
||||
@@ -631,7 +633,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
child_area.y2 += ext_size;
|
||||
/* Get the union (common parts) of original mask (from obj)
|
||||
* and its child */
|
||||
union_ok = lv_area_intersect(&mask_child, &obj_mask, &child_area);
|
||||
union_ok = _lv_area_intersect(&mask_child, &obj_mask, &child_area);
|
||||
|
||||
/*If the parent and the child has common area then refresh the child */
|
||||
if(union_ok) {
|
||||
@@ -667,7 +669,7 @@ static void lv_refr_vdb_flush(void)
|
||||
else vdb->flushing_last = 0;
|
||||
|
||||
/*Flush the rendered content to the display*/
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver.flush_cb) disp->driver.flush_cb(&disp->driver, &vdb->area, vdb->buf_act);
|
||||
|
||||
if(vdb->buf1 && vdb->buf2) {
|
||||
|
||||
@@ -45,7 +45,7 @@ extern "C" {
|
||||
/**
|
||||
* Initialize the screen refresh subsystem
|
||||
*/
|
||||
void lv_refr_init(void);
|
||||
void _lv_refr_init(void);
|
||||
|
||||
/**
|
||||
* Redraw the invalidated areas now.
|
||||
@@ -62,13 +62,13 @@ void lv_refr_now(lv_disp_t * disp);
|
||||
* @param disp pointer to display where the area should be invalidated (NULL can be used if there is
|
||||
* only one display)
|
||||
*/
|
||||
void lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p);
|
||||
void _lv_inv_area(lv_disp_t * disp, const lv_area_t * area_p);
|
||||
|
||||
/**
|
||||
* Get the display which is being refreshed
|
||||
* @return the display being refreshed
|
||||
*/
|
||||
lv_disp_t * lv_refr_get_disp_refreshing(void);
|
||||
lv_disp_t * _lv_refr_get_disp_refreshing(void);
|
||||
|
||||
/**
|
||||
* Set the display which is being refreshed.
|
||||
@@ -76,13 +76,13 @@ lv_disp_t * lv_refr_get_disp_refreshing(void);
|
||||
* It can be used to trick the drawing functions about there is an active display.
|
||||
* @param the display being refreshed
|
||||
*/
|
||||
void lv_refr_set_disp_refreshing(lv_disp_t * disp);
|
||||
void _lv_refr_set_disp_refreshing(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Called periodically to handle the refreshing
|
||||
* @param task pointer to the task itself
|
||||
*/
|
||||
void lv_disp_refr_task(lv_task_t * task);
|
||||
void _lv_disp_refr_task(lv_task_t * task);
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
|
||||
@@ -60,7 +60,7 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
|
||||
*/
|
||||
void lv_style_init(lv_style_t * style)
|
||||
{
|
||||
lv_memset_00(style, sizeof(lv_style_t));
|
||||
_lv_memset_00(style, sizeof(lv_style_t));
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
style->sentinel = LV_DEBUG_STYLE_SENTINEL_VALUE;
|
||||
#endif
|
||||
@@ -80,9 +80,9 @@ void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
|
||||
|
||||
if(style_src->map == NULL) return;
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style_src);
|
||||
uint16_t size = _lv_style_get_mem_size(style_src);
|
||||
style_dest->map = lv_mem_alloc(size);
|
||||
lv_memcpy(style_dest->map, style_src->map, size);
|
||||
_lv_memcpy(style_dest->map, style_src->map, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +107,7 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
|
||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
||||
|
||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
||||
uint32_t map_size = lv_style_get_mem_size(style);
|
||||
uint32_t map_size = _lv_style_get_mem_size(style);
|
||||
uint8_t prop_size = sizeof(lv_style_property_t);
|
||||
if((prop & 0xF) < LV_STYLE_ID_COLOR) prop_size += sizeof(lv_style_int_t);
|
||||
else if((prop & 0xF) < LV_STYLE_ID_OPA) prop_size += sizeof(lv_color_t);
|
||||
@@ -135,7 +135,7 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
|
||||
*/
|
||||
void lv_style_list_init(lv_style_list_t * list)
|
||||
{
|
||||
lv_memset_00(list, sizeof(lv_style_list_t));
|
||||
_lv_memset_00(list, sizeof(lv_style_list_t));
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
list->sentinel = LV_DEBUG_STYLE_LIST_SENTINEL_VALUE;
|
||||
#endif
|
||||
@@ -151,7 +151,7 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
|
||||
LV_ASSERT_STYLE_LIST(list_dest);
|
||||
LV_ASSERT_STYLE_LIST(list_src);
|
||||
|
||||
lv_style_list_reset(list_dest);
|
||||
_lv_style_list_reset(list_dest);
|
||||
|
||||
if(list_src->style_list == NULL) return;
|
||||
|
||||
@@ -159,24 +159,24 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
|
||||
if(list_src->has_local == 0) {
|
||||
if(list_src->has_trans) {
|
||||
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
}
|
||||
else {
|
||||
list_dest->style_list = lv_mem_alloc(list_src->style_cnt * sizeof(lv_style_t *));
|
||||
lv_memcpy(list_dest->style_list, list_src->style_list, list_src->style_cnt * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list, list_src->style_cnt * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(list_src->has_trans) {
|
||||
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 2) * sizeof(lv_style_t *));
|
||||
lv_memcpy(list_dest->style_list, list_src->style_list + 2, (list_src->style_cnt - 2) * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 2, (list_src->style_cnt - 2) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 2;
|
||||
}
|
||||
else {
|
||||
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
|
||||
* @param list pointer to a style list
|
||||
* @param style pointer to a style to add
|
||||
*/
|
||||
void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
void _lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
LV_ASSERT_STYLE(style);
|
||||
@@ -200,7 +200,7 @@ void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
if(list == NULL) return;
|
||||
|
||||
/*Remove the style first if already exists*/
|
||||
lv_style_list_remove_style(list, style);
|
||||
_lv_style_list_remove_style(list, style);
|
||||
|
||||
lv_style_t ** new_classes;
|
||||
if(list->style_cnt == 0) new_classes = lv_mem_alloc(sizeof(lv_style_t *));
|
||||
@@ -230,7 +230,7 @@ void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
* @param style_list pointer to a style list
|
||||
* @param style pointer to a style to remove
|
||||
*/
|
||||
void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
||||
void _lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
LV_ASSERT_STYLE(style);
|
||||
@@ -279,7 +279,7 @@ void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
||||
* Leave `ignore_trans` flag as it is.
|
||||
* @param list pointer to a style list.
|
||||
*/
|
||||
void lv_style_list_reset(lv_style_list_t * list)
|
||||
void _lv_style_list_reset(lv_style_list_t * list)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -294,7 +294,7 @@ void lv_style_list_reset(lv_style_list_t * list)
|
||||
}
|
||||
|
||||
if(list->has_trans) {
|
||||
lv_style_t * trans = lv_style_list_get_transition_style(list);
|
||||
lv_style_t * trans = _lv_style_list_get_transition_style(list);
|
||||
if(trans) {
|
||||
lv_style_reset(trans);
|
||||
lv_mem_free(trans);
|
||||
@@ -329,7 +329,7 @@ void lv_style_reset(lv_style_t * style)
|
||||
* @param style pointer to a style
|
||||
* @return size of the properties in bytes
|
||||
*/
|
||||
uint16_t lv_style_get_mem_size(const lv_style_t * style)
|
||||
uint16_t _lv_style_get_mem_size(const lv_style_t * style)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
@@ -373,7 +373,7 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
||||
|
||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
||||
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
|
||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -383,16 +383,16 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style);
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
size += sizeof(lv_style_property_t) + sizeof(lv_style_int_t);
|
||||
style->map = lv_mem_realloc(style->map, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
|
||||
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
lv_memcpy_small(style->map + size - sizeof(lv_style_int_t) - end_mark_size, &value, sizeof(lv_style_int_t));
|
||||
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(lv_style_int_t) - end_mark_size, &value, sizeof(lv_style_int_t));
|
||||
_lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,7 +419,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
||||
|
||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
||||
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
|
||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -429,7 +429,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style);
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(lv_color_t);
|
||||
@@ -437,9 +437,9 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
|
||||
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
lv_memcpy_small(style->map + size - sizeof(lv_color_t) - end_mark_size, &color, sizeof(lv_color_t));
|
||||
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(lv_color_t) - end_mark_size, &color, sizeof(lv_color_t));
|
||||
_lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -466,7 +466,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
||||
|
||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
||||
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
|
||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -476,7 +476,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style);
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(lv_opa_t);
|
||||
@@ -484,9 +484,9 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
|
||||
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
lv_memcpy_small(style->map + size - sizeof(lv_opa_t) - end_mark_size, &opa, sizeof(lv_opa_t));
|
||||
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(lv_opa_t) - end_mark_size, &opa, sizeof(lv_opa_t));
|
||||
_lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -513,27 +513,27 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
attr_goal.full = (prop >> 8) & 0xFFU;
|
||||
|
||||
if(attr_found.bits.state == attr_goal.bits.state) {
|
||||
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void * ));
|
||||
_lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(const void *));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void * ));
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void *));
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = lv_style_get_mem_size(style);
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(const void * );
|
||||
size += sizeof(lv_style_property_t) + sizeof(const void *);
|
||||
style->map = lv_mem_realloc(style->map, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
|
||||
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
lv_memcpy_small(style->map + size - sizeof(const void * ) - end_mark_size, &p, sizeof(const void * ));
|
||||
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(const void *) - end_mark_size, &p, sizeof(const void *));
|
||||
_lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -559,7 +559,7 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
|
||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act.full = style->map[id + 1];
|
||||
|
||||
@@ -596,7 +596,7 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
|
||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act.full = style->map[id + 1];
|
||||
|
||||
@@ -630,7 +630,7 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
|
||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act.full = style->map[id + 1];
|
||||
|
||||
@@ -665,7 +665,7 @@ int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(const void *));
|
||||
_lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(const void *));
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act.full = style->map[id + 1];
|
||||
|
||||
@@ -695,7 +695,7 @@ lv_style_t * lv_style_list_get_local_style(lv_style_list_t * list)
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @return pointer to the transition style if exists else `NULL`.
|
||||
*/
|
||||
lv_style_t * lv_style_list_get_transition_style(lv_style_list_t * list)
|
||||
lv_style_t * _lv_style_list_get_transition_style(lv_style_list_t * list)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -708,10 +708,10 @@ lv_style_t * lv_style_list_get_transition_style(lv_style_list_t * list)
|
||||
* @param list pointer to a style list
|
||||
* @return the transition style of a style list
|
||||
*/
|
||||
lv_style_t * lv_style_list_add_trans_style(lv_style_list_t * list)
|
||||
lv_style_t * _lv_style_list_add_trans_style(lv_style_list_t * list)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
if(list->has_trans) return lv_style_list_get_transition_style(list);
|
||||
if(list->has_trans) return _lv_style_list_get_transition_style(list);
|
||||
|
||||
lv_style_t * trans_style = lv_mem_alloc(sizeof(lv_style_t));
|
||||
LV_ASSERT_MEM(trans_style);
|
||||
@@ -722,7 +722,7 @@ lv_style_t * lv_style_list_add_trans_style(lv_style_list_t * list)
|
||||
|
||||
lv_style_init(trans_style);
|
||||
|
||||
lv_style_list_add_style(list, trans_style);
|
||||
_lv_style_list_add_style(list, trans_style);
|
||||
list->has_trans = 1;
|
||||
|
||||
/*If the list has local style trans was added after it. But trans should be the first so swap them*/
|
||||
@@ -743,7 +743,7 @@ lv_style_t * lv_style_list_add_trans_style(lv_style_list_t * list)
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value)
|
||||
void _lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -759,7 +759,7 @@ void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t pro
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value)
|
||||
void _lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -775,7 +775,7 @@ void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t pro
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value)
|
||||
void _lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -791,7 +791,7 @@ void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t p
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
|
||||
void _lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -812,7 +812,7 @@ void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t pro
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res)
|
||||
lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -864,7 +864,7 @@ lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop,
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res)
|
||||
lv_res_t _lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -914,7 +914,7 @@ lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pro
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res)
|
||||
lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -964,7 +964,7 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res)
|
||||
lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res)
|
||||
{
|
||||
LV_ASSERT_STYLE_LIST(list);
|
||||
|
||||
@@ -1082,7 +1082,7 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
|
||||
lv_style_init(local_style);
|
||||
|
||||
/*Add the local style to the furst place*/
|
||||
lv_style_list_add_style(list, local_style);
|
||||
_lv_style_list_add_style(list, local_style);
|
||||
list->has_local = 1;
|
||||
|
||||
return local_style;
|
||||
|
||||
@@ -267,21 +267,21 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
|
||||
* @param list pointer to a style list
|
||||
* @param style pointer to a style to add
|
||||
*/
|
||||
void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style);
|
||||
void _lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Remove a style from a style list
|
||||
* @param style_list pointer to a style list
|
||||
* @param style pointer to a style to remove
|
||||
*/
|
||||
void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style);
|
||||
void _lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Remove all styles added from style list, clear the local style, transition style and free all allocated memories.
|
||||
* Leave `ignore_trans` flag as it is.
|
||||
* @param list pointer to a style list.
|
||||
*/
|
||||
void lv_style_list_reset(lv_style_list_t * style_list);
|
||||
void _lv_style_list_reset(lv_style_list_t * style_list);
|
||||
|
||||
static inline lv_style_t * lv_style_list_get_style(lv_style_list_t * list, uint8_t id)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void lv_style_reset(lv_style_t * style);
|
||||
* @param style pointer to a style
|
||||
* @return size of the properties in bytes
|
||||
*/
|
||||
uint16_t lv_style_get_mem_size(const lv_style_t * style);
|
||||
uint16_t _lv_style_get_mem_size(const lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Copy a style to an other
|
||||
@@ -367,8 +367,6 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
*/
|
||||
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get an integer typed property from a style.
|
||||
* @param style pointer to a style from where the property should be get
|
||||
@@ -441,14 +439,14 @@ lv_style_t * lv_style_list_get_local_style(lv_style_list_t * list);
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @return pointer to the transition style if exists else `NULL`.
|
||||
*/
|
||||
lv_style_t * lv_style_list_get_transition_style(lv_style_list_t * list);
|
||||
lv_style_t * _lv_style_list_get_transition_style(lv_style_list_t * list);
|
||||
|
||||
/**
|
||||
* Allocate the transition style in a style list. If already exists simply return it.
|
||||
* @param list pointer to a style list
|
||||
* @return the transition style of a style list
|
||||
*/
|
||||
lv_style_t * lv_style_list_add_trans_style(lv_style_list_t * list);
|
||||
lv_style_t * _lv_style_list_add_trans_style(lv_style_list_t * list);
|
||||
|
||||
/**
|
||||
* Set a local integer typed property in a style list.
|
||||
@@ -458,7 +456,7 @@ lv_style_t * lv_style_list_add_trans_style(lv_style_list_t * list);
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value);
|
||||
void _lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value);
|
||||
|
||||
/**
|
||||
* Set a local color typed property in a style list.
|
||||
@@ -468,7 +466,7 @@ void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t pro
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value);
|
||||
void _lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value);
|
||||
|
||||
/**
|
||||
* Set a local opacity typed property in a style list.
|
||||
@@ -478,7 +476,7 @@ void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t p
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value);
|
||||
void _lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value);
|
||||
|
||||
/**
|
||||
* Set a local pointer typed property in a style list.
|
||||
@@ -488,7 +486,7 @@ void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t pro
|
||||
* @param value the value to set
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value);
|
||||
void _lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value);
|
||||
|
||||
/**
|
||||
* Get an integer typed property from a style list.
|
||||
@@ -501,7 +499,7 @@ void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t pro
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res);
|
||||
lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * res);
|
||||
|
||||
/**
|
||||
* Get a color typed property from a style list.
|
||||
@@ -514,7 +512,7 @@ lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop,
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res);
|
||||
lv_res_t _lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * res);
|
||||
|
||||
|
||||
/**
|
||||
@@ -528,7 +526,7 @@ lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pro
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res);
|
||||
lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * res);
|
||||
|
||||
/**
|
||||
* Get a pointer typed property from a style list.
|
||||
@@ -541,7 +539,7 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
|
||||
* LV_RES_INV: there was NO matching property in the list
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res);
|
||||
lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res);
|
||||
|
||||
|
||||
/*************************
|
||||
|
||||
@@ -75,6 +75,8 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
|
||||
if(dsc->width == 0) return;
|
||||
if(start_angle == end_angle) return;
|
||||
|
||||
if(dsc->width > radius) dsc->width = radius;
|
||||
|
||||
lv_draw_rect_dsc_t cir_dsc;
|
||||
lv_draw_rect_dsc_init(&cir_dsc);
|
||||
cir_dsc.radius = LV_RADIUS_CIRCLE;
|
||||
@@ -175,13 +177,13 @@ static void draw_quarter_0(quarter_draw_dsc_t * q)
|
||||
|
||||
if(q->start_quarter == 0 && q->end_quarter == 0 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 0 || q->end_quarter == 0) {
|
||||
@@ -190,20 +192,20 @@ static void draw_quarter_0(quarter_draw_dsc_t * q)
|
||||
quarter_area.x1 = q->center_x;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 0) {
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y1 = q->center_y;
|
||||
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -217,7 +219,7 @@ static void draw_quarter_0(quarter_draw_dsc_t * q)
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -228,13 +230,13 @@ static void draw_quarter_1(quarter_draw_dsc_t * q)
|
||||
|
||||
if(q->start_quarter == 1 && q->end_quarter == 1 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 1 || q->end_quarter == 1) {
|
||||
@@ -243,20 +245,20 @@ static void draw_quarter_1(quarter_draw_dsc_t * q)
|
||||
quarter_area.x1 = q->center_x - q->radius;
|
||||
quarter_area.y1 = q->center_y;
|
||||
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 1) {
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -270,7 +272,7 @@ static void draw_quarter_1(quarter_draw_dsc_t * q)
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y2 = q->center_y + q->radius;
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -281,13 +283,13 @@ static void draw_quarter_2(quarter_draw_dsc_t * q)
|
||||
|
||||
if(q->start_quarter == 2 && q->end_quarter == 2 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * q->radius) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 2 || q->end_quarter == 2) {
|
||||
@@ -296,20 +298,20 @@ static void draw_quarter_2(quarter_draw_dsc_t * q)
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y1 = q->center_y - q->radius;
|
||||
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 2) {
|
||||
quarter_area.x1 = q->center_x - q->radius;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -323,7 +325,7 @@ static void draw_quarter_2(quarter_draw_dsc_t * q)
|
||||
quarter_area.x2 = q->center_x - 1;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -335,13 +337,13 @@ static void draw_quarter_3(quarter_draw_dsc_t * q)
|
||||
|
||||
if(q->start_quarter == 3 && q->end_quarter == 3 && q->start_angle < q->end_angle) {
|
||||
/*Small arc here*/
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
else if(q->start_quarter == 3 || q->end_quarter == 3) {
|
||||
@@ -350,20 +352,20 @@ static void draw_quarter_3(quarter_draw_dsc_t * q)
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
quarter_area.x1 = q->center_x + ((lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x1 = q->center_x + ((_lv_trigo_sin(q->start_angle + 90) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y1 = q->center_y + ((_lv_trigo_sin(q->start_angle) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
if(q->end_quarter == 3) {
|
||||
quarter_area.x1 = q->center_x;
|
||||
quarter_area.y1 = q->center_y - q->radius;
|
||||
|
||||
quarter_area.x2 = q->center_x + ((lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.x2 = q->center_x + ((_lv_trigo_sin(q->end_angle + 90) * (q->radius)) >> LV_TRIGO_SHIFT);
|
||||
quarter_area.y2 = q->center_y + ((_lv_trigo_sin(q->end_angle) * (q->radius - q->width)) >> LV_TRIGO_SHIFT);
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -377,7 +379,7 @@ static void draw_quarter_3(quarter_draw_dsc_t * q)
|
||||
quarter_area.x2 = q->center_x + q->radius;
|
||||
quarter_area.y2 = q->center_y - 1;
|
||||
|
||||
bool ok = lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
bool ok = _lv_area_intersect(&quarter_area, &quarter_area, q->clip_area);
|
||||
if(ok) lv_draw_rect(q->draw_area, &quarter_area, q->draw_dsc);
|
||||
}
|
||||
}
|
||||
@@ -403,8 +405,8 @@ static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness,
|
||||
int32_t cir_x;
|
||||
int32_t cir_y;
|
||||
|
||||
cir_x = ((radius - rx_corr - thick_half) * lv_trigo_sin(90 - angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_y = ((radius - ry_corr - thick_half) * lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_x = ((radius - rx_corr - thick_half) * _lv_trigo_sin(90 - angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
cir_y = ((radius - ry_corr - thick_half) * _lv_trigo_sin(angle)) >> (LV_TRIGO_SHIFT - ps);
|
||||
|
||||
/* Actually the center of the pixel need to be calculated so apply 1/2 px offset*/
|
||||
if(cir_x > 0) {
|
||||
|
||||
@@ -31,9 +31,10 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
static void fill_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
@@ -43,9 +44,10 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res);
|
||||
|
||||
static void map_blended(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
@@ -72,13 +74,13 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
||||
|
||||
|
||||
#define FILL_NORMAL_MASK_PX_SCR_TRANSP(out_x, color) \
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[out_x] = color; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_tmp[out_x], disp_buf_tmp[out_x].ch.alpha, \
|
||||
color, *mask_tmp_x, &disp_buf_tmp[out_x], &disp_buf_tmp[out_x].ch.alpha); \
|
||||
else disp_buf_tmp[out_x] = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[out_x] = color; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_first[out_x], disp_buf_first[out_x].ch.alpha, \
|
||||
color, *mask_tmp_x, &disp_buf_first[out_x], &disp_buf_first[out_x].ch.alpha); \
|
||||
else disp_buf_first[out_x] = lv_color_mix(color, disp_buf_first[out_x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
|
||||
|
||||
#define MAP_NORMAL_MASK_PX(x) \
|
||||
@@ -89,13 +91,13 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
||||
mask_tmp_x++;
|
||||
|
||||
#define MAP_NORMAL_MASK_PX_SCR_TRANSP(x) \
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[x] = map_buf_tmp[x]; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[x].ch.alpha, \
|
||||
map_buf_tmp[x], *mask_tmp_x, &disp_buf_tmp[x], &disp_buf_tmp[x].ch.alpha); \
|
||||
else disp_buf_tmp[x] = lv_color_mix(map_buf_tmp[x], disp_buf_tmp[x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[x] = map_buf_first[x]; \
|
||||
else if(disp->driver.screen_transp) lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, \
|
||||
map_buf_first[x], *mask_tmp_x, &disp_buf_first[x], &disp_buf_first[x].ch.alpha); \
|
||||
else disp_buf_first[x] = lv_color_mix(map_buf_first[x], disp_buf_first[x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
@@ -115,17 +117,15 @@ mask_tmp_x++;
|
||||
* @param opa overall opacity in 0x00..0xff range
|
||||
* @param mode blend mode from `lv_blend_mode_t`
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode)
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area,
|
||||
lv_color_t color, lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa,
|
||||
lv_blend_mode_t mode)
|
||||
{
|
||||
static int asd = 0;
|
||||
asd++;
|
||||
/*Do not draw transparent things*/
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) return;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
@@ -135,7 +135,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_a
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, clip_area, fill_area);
|
||||
is_common = _lv_area_intersect(&draw_area, clip_area, fill_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
@@ -181,9 +181,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_a
|
||||
* @param opa overall opacity in 0x00..0xff range
|
||||
* @param mode blend mode from `lv_blend_mode_t`
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res,
|
||||
lv_opa_t opa, lv_blend_mode_t mode)
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area,
|
||||
const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res,
|
||||
lv_opa_t opa, lv_blend_mode_t mode)
|
||||
{
|
||||
/*Do not draw transparent things*/
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
@@ -193,10 +194,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_ar
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, clip_area, map_area);
|
||||
is_common = _lv_area_intersect(&draw_area, clip_area, map_area);
|
||||
if(!is_common) return;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
@@ -240,7 +241,7 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
{
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
int32_t disp_w = lv_area_get_width(disp_area);
|
||||
@@ -287,13 +288,14 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
* LV_MASK_RES_TRANSP: the mask has only 0x00 values (full transparent),
|
||||
* LV_MASK_RES_CHANGED: the mask has mixed values
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
lv_color_t color, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
{
|
||||
|
||||
#if LV_USE_GPU
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
#if LV_USE_GPU || LV_COLOR_SCREEN_TRANSP
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
#endif
|
||||
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
@@ -460,8 +462,8 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
const lv_opa_t * mask_tmp_x = mask;
|
||||
for(x = 0; x < draw_area_w; x++) {
|
||||
if(*mask_tmp_x) {
|
||||
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa : (uint32_t)((uint32_t)(
|
||||
*mask_tmp_x) * opa) >> 8;
|
||||
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa :
|
||||
(uint32_t)((uint32_t)(*mask_tmp_x) * opa) >> 8;
|
||||
if(*mask_tmp_x != last_mask || last_dest_color.full != disp_buf_first[x].full) {
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp->driver.screen_transp) {
|
||||
@@ -585,7 +587,7 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
|
||||
{
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
int32_t disp_w = lv_area_get_width(disp_area);
|
||||
@@ -642,9 +644,10 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
* LV_MASK_RES_TRANSP: the mask has only 0x00 values (full transparent),
|
||||
* LV_MASK_RES_CHANGED: the mask has mixed values
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf,
|
||||
const lv_area_t * draw_area,
|
||||
const lv_area_t * map_area, const lv_color_t * map_buf, lv_opa_t opa,
|
||||
const lv_opa_t * mask, lv_draw_mask_res_t mask_res)
|
||||
{
|
||||
|
||||
/*Get the width of the `disp_area` it will be used to go to the next line*/
|
||||
@@ -663,11 +666,8 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
const lv_color_t * map_buf_first = map_buf + map_w * (draw_area->y1 - (map_area->y1 - disp_area->y1));
|
||||
map_buf_first += (draw_area->x1 - (map_area->x1 - disp_area->x1));
|
||||
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
lv_opa_t opa_composed;
|
||||
#endif
|
||||
#if LV_COLOR_SCREEN_TRANSP || LV_USE_GPU
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
#endif
|
||||
|
||||
int32_t x;
|
||||
@@ -688,28 +688,28 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
|
||||
if(opa > LV_OPA_MAX) {
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_copy(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_copy(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Software rendering*/
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
lv_memcpy(disp_buf_first, map_buf_first, draw_area_w * sizeof(lv_color_t));
|
||||
_lv_memcpy(disp_buf_first, map_buf_first, draw_area_w * sizeof(lv_color_t));
|
||||
disp_buf_first += disp_w;
|
||||
map_buf_first += map_w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, map_buf_first, opa, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, map_buf_first, opa, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*Software rendering*/
|
||||
/*Software rendering*/
|
||||
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
for(x = 0; x < draw_area_w; x++) {
|
||||
@@ -746,9 +746,9 @@ LV_ATTRIBUTE_FAST_MEM static void map_normal(const lv_area_t * disp_area, lv_col
|
||||
#else
|
||||
for(x = 0; x < draw_area_w && ((lv_uintptr_t)mask_tmp_x & 0x3); x++) {
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
MAP_NORMAL_MASK_PX_SCR_TRANSP(x)
|
||||
MAP_NORMAL_MASK_PX_SCR_TRANSP(x)
|
||||
#else
|
||||
MAP_NORMAL_MASK_PX(x)
|
||||
MAP_NORMAL_MASK_PX(x)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -36,13 +36,16 @@ typedef uint8_t lv_blend_mode_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
//! @cond Doxygen_Suppress
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_blend_fill(const lv_area_t * clip_area, const lv_area_t * fill_area, lv_color_t color,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area, const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_area_t * map_area,
|
||||
const lv_color_t * map_buf,
|
||||
lv_opa_t * mask, lv_draw_mask_res_t mask_res, lv_opa_t opa, lv_blend_mode_t mode);
|
||||
|
||||
//! @endcond
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -27,12 +27,14 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask, const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
|
||||
const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area, const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte);
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc,
|
||||
bool chroma_key, bool alpha_byte);
|
||||
|
||||
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg);
|
||||
|
||||
@@ -50,7 +52,7 @@ static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, co
|
||||
|
||||
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t));
|
||||
_lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t));
|
||||
dsc->recolor = LV_COLOR_BLACK;
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->zoom = LV_IMG_ZOOM_NONE;
|
||||
@@ -146,12 +148,10 @@ bool lv_img_cf_is_chroma_keyed(lv_img_cf_t cf)
|
||||
switch(cf) {
|
||||
case LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED:
|
||||
case LV_IMG_CF_RAW_CHROMA_KEYED:
|
||||
#if LV_INDEXED_CHROMA
|
||||
case LV_IMG_CF_INDEXED_1BIT:
|
||||
case LV_IMG_CF_INDEXED_2BIT:
|
||||
case LV_IMG_CF_INDEXED_4BIT:
|
||||
case LV_IMG_CF_INDEXED_8BIT:
|
||||
#endif
|
||||
is_chroma_keyed = true;
|
||||
break;
|
||||
|
||||
@@ -230,12 +230,13 @@ lv_img_src_t lv_img_src_get_type(const void * src)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * mask, const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
|
||||
const void * src,
|
||||
lv_draw_img_dsc_t * draw_dsc)
|
||||
{
|
||||
if(draw_dsc->opa <= LV_OPA_MIN) return LV_RES_OK;
|
||||
|
||||
lv_img_cache_entry_t * cdsc = lv_img_cache_open(src, draw_dsc->recolor);
|
||||
lv_img_cache_entry_t * cdsc = _lv_img_cache_open(src, draw_dsc->recolor);
|
||||
|
||||
if(cdsc == NULL) return LV_RES_INV;
|
||||
|
||||
@@ -245,7 +246,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
if(cdsc->dec_dsc.error_msg != NULL) {
|
||||
LV_LOG_WARN("Image draw error");
|
||||
|
||||
show_error(coords, mask, cdsc->dec_dsc.error_msg);
|
||||
show_error(coords, clip_area, cdsc->dec_dsc.error_msg);
|
||||
}
|
||||
/* The decoder could open the image and gave the entire uncompressed image.
|
||||
* Just draw it!*/
|
||||
@@ -256,7 +257,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
int32_t w = lv_area_get_width(coords);
|
||||
int32_t h = lv_area_get_height(coords);
|
||||
|
||||
lv_img_buf_get_transformed_area(&map_area_rot, w, h, draw_dsc->angle, draw_dsc->zoom, &draw_dsc->pivot);
|
||||
_lv_img_buf_get_transformed_area(&map_area_rot, w, h, draw_dsc->angle, draw_dsc->zoom, &draw_dsc->pivot);
|
||||
|
||||
map_area_rot.x1 += coords->x1;
|
||||
map_area_rot.y1 += coords->y1;
|
||||
@@ -266,7 +267,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = lv_area_intersect(&mask_com, mask, &map_area_rot);
|
||||
union_ok = _lv_area_intersect(&mask_com, clip_area, &map_area_rot);
|
||||
if(union_ok == false) {
|
||||
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
|
||||
successfully.*/
|
||||
@@ -278,7 +279,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
else {
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = lv_area_intersect(&mask_com, mask, coords);
|
||||
union_ok = _lv_area_intersect(&mask_com, clip_area, coords);
|
||||
if(union_ok == false) {
|
||||
return LV_RES_OK; /*Out of mask. There is nothing to draw so the image is drawn
|
||||
successfully.*/
|
||||
@@ -286,8 +287,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
|
||||
int32_t width = lv_area_get_width(&mask_com);
|
||||
|
||||
uint8_t * buf = lv_mem_buf_get(lv_area_get_width(&mask_com) *
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
uint8_t * buf = _lv_mem_buf_get(lv_area_get_width(&mask_com) *
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
|
||||
lv_area_t line;
|
||||
lv_area_copy(&line, &mask_com);
|
||||
@@ -298,14 +299,14 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
lv_res_t read_res;
|
||||
for(row = mask_com.y1; row <= mask_com.y2; row++) {
|
||||
lv_area_t mask_line;
|
||||
union_ok = lv_area_intersect(&mask_line, mask, &line);
|
||||
union_ok = _lv_area_intersect(&mask_line, clip_area, &line);
|
||||
if(union_ok == false) continue;
|
||||
|
||||
read_res = lv_img_decoder_read_line(&cdsc->dec_dsc, x, y, width, buf);
|
||||
if(read_res != LV_RES_OK) {
|
||||
lv_img_decoder_close(&cdsc->dec_dsc);
|
||||
LV_LOG_WARN("Image draw can't read the line");
|
||||
lv_mem_buf_release(buf);
|
||||
_lv_mem_buf_release(buf);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -315,7 +316,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
line.y2++;
|
||||
y++;
|
||||
}
|
||||
lv_mem_buf_release(buf);
|
||||
_lv_mem_buf_release(buf);
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
@@ -335,14 +336,15 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
* @param zoom zoom factor
|
||||
* @param antialias anti-alias transformations (rotate, zoom) or not
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area, const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc, bool chroma_key, bool alpha_byte)
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p,
|
||||
lv_draw_img_dsc_t * draw_dsc, bool chroma_key, bool alpha_byte)
|
||||
{
|
||||
/* Use the clip area as draw area*/
|
||||
lv_area_t draw_area;
|
||||
lv_area_copy(&draw_area, clip_area);
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
|
||||
@@ -358,8 +360,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
/*The simplest case just copy the pixels into the VDB*/
|
||||
if(other_mask_cnt == 0 && draw_dsc->angle == 0 && draw_dsc->zoom == LV_IMG_ZOOM_NONE &&
|
||||
chroma_key == false && alpha_byte == false && draw_dsc->recolor_opa == LV_OPA_TRANSP) {
|
||||
lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
_lv_blend_map(clip_area, map_area, (lv_color_t *)map_p, NULL, LV_DRAW_MASK_RES_FULL_COVER, draw_dsc->opa,
|
||||
draw_dsc->blend_mode);
|
||||
}
|
||||
/*In the other cases every pixel need to be checked one-by-one*/
|
||||
else {
|
||||
@@ -368,12 +370,11 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
|
||||
/*Build the image and a mask line-by-line*/
|
||||
uint32_t mask_buf_size = lv_area_get_size(&draw_area) > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : lv_area_get_size(&draw_area);
|
||||
lv_color_t * map2 = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
lv_color_t * map2 = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||
|
||||
/*Go to the first displayed pixel of the map*/
|
||||
int32_t map_w = lv_area_get_width(map_area);
|
||||
int32_t map_h = lv_area_get_height(map_area);
|
||||
const uint8_t * map_buf_tmp = map_p;
|
||||
map_buf_tmp += map_w * (draw_area.y1 - (map_area->y1 - disp_area->y1)) * px_size_byte;
|
||||
map_buf_tmp += (draw_area.x1 - (map_area->x1 - disp_area->x1)) * px_size_byte;
|
||||
@@ -393,8 +394,11 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
lv_coord_t draw_area_h = lv_area_get_height(&draw_area);
|
||||
lv_coord_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
bool transform = draw_dsc->angle != 0 || draw_dsc->zoom != LV_IMG_ZOOM_NONE ? true : false;
|
||||
|
||||
#else
|
||||
bool transform = false;
|
||||
#endif
|
||||
/*Simple ARGB image. Handle it as special case because it's very common*/
|
||||
if(other_mask_cnt == 0 && !transform && !chroma_key && draw_dsc->recolor_opa == LV_OPA_TRANSP && alpha_byte) {
|
||||
#if LV_USE_GPU_STM32_DMA2D && LV_COLOR_DEPTH == 32
|
||||
@@ -403,7 +407,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
int32_t disp_w = lv_area_get_width(disp_area);
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area.y1 + draw_area.x1;
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w, draw_area_h);
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w,
|
||||
draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -416,15 +421,16 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
mask_buf[px_i] = px_opa;
|
||||
if(px_opa) {
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
c.full = map_px[0];
|
||||
map2[px_i].full = map_px[0];
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
c.full = map_px[0] + (map_px[1] << 8);
|
||||
map2[px_i].full = map_px[0] + (map_px[1] << 8);
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
c.full = *((uint32_t *)map_px);
|
||||
c.ch.alpha = 0xFF;
|
||||
map2[px_i].full = *((uint32_t *)map_px);
|
||||
#endif
|
||||
map2[px_i].full = c.full;
|
||||
}
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
map2[px_i].ch.alpha = 0xFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
map_buf_tmp += map_w * px_size_byte;
|
||||
@@ -432,7 +438,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
blend_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
|
||||
blend_area.y1 = blend_area.y2 + 1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
@@ -443,16 +449,18 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
/*Flush the last part*/
|
||||
if(blend_area.y1 != blend_area.y2) {
|
||||
blend_area.y2--;
|
||||
lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, LV_DRAW_MASK_RES_CHANGED, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(map2);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(map2);
|
||||
}
|
||||
/*Most complicated case: transform or other mask or chroma keyed*/
|
||||
else {
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
lv_img_transform_dsc_t trans_dsc;
|
||||
lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
|
||||
_lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
|
||||
if(transform) {
|
||||
lv_img_cf_t cf = LV_IMG_CF_TRUE_COLOR;
|
||||
if(alpha_byte) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
@@ -462,16 +470,16 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
trans_dsc.cfg.zoom = draw_dsc->zoom;
|
||||
trans_dsc.cfg.src = map_p;
|
||||
trans_dsc.cfg.src_w = map_w;
|
||||
trans_dsc.cfg.src_h = map_h;
|
||||
trans_dsc.cfg.src_h = lv_area_get_height(map_area);;
|
||||
trans_dsc.cfg.cf = cf;
|
||||
trans_dsc.cfg.pivot_x = draw_dsc->pivot.x;
|
||||
trans_dsc.cfg.pivot_y = draw_dsc->pivot.y;
|
||||
trans_dsc.cfg.color = draw_dsc->recolor;
|
||||
trans_dsc.cfg.antialias = draw_dsc->antialias;
|
||||
|
||||
lv_img_buf_transform_init(&trans_dsc);
|
||||
_lv_img_buf_transform_init(&trans_dsc);
|
||||
}
|
||||
|
||||
#endif
|
||||
uint16_t recolor_premult[3] = {0};
|
||||
lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa;
|
||||
if(draw_dsc->recolor_opa != 0) {
|
||||
@@ -479,30 +487,57 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
}
|
||||
|
||||
lv_draw_mask_res_t mask_res;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(other_mask_cnt) {
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
_lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
int32_t rot_y = disp_area->y1 + draw_area.y1 - map_area->y1;
|
||||
#endif
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
map_px = map_buf_tmp;
|
||||
uint32_t px_i_start = px_i;
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
int32_t rot_x = disp_area->x1 + draw_area.x1 - map_area->x1;
|
||||
#endif
|
||||
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
|
||||
|
||||
if(transform == false) {
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
if(transform) {
|
||||
|
||||
/*Transform*/
|
||||
bool ret;
|
||||
ret = _lv_img_buf_transform(&trans_dsc, rot_x + x, rot_y + y);
|
||||
if(ret == false) {
|
||||
mask_buf[px_i] = LV_OPA_TRANSP;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = trans_dsc.res.opa;
|
||||
c.full = trans_dsc.res.color.full;
|
||||
}
|
||||
}
|
||||
/*No transform*/
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(alpha_byte) {
|
||||
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
|
||||
mask_buf[px_i] = px_opa;
|
||||
if(px_opa < LV_OPA_MIN) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = 0xFF;
|
||||
}
|
||||
|
||||
@@ -521,21 +556,6 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*Transform*/
|
||||
bool ret;
|
||||
int32_t rot_x = x + (disp_area->x1 + draw_area.x1) - map_area->x1;
|
||||
int32_t rot_y = y + (disp_area->y1 + draw_area.y1) - map_area->y1;
|
||||
ret = lv_img_buf_transform(&trans_dsc, rot_x, rot_y);
|
||||
if(ret == false) {
|
||||
mask_buf[px_i] = LV_OPA_TRANSP;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
mask_buf[px_i] = trans_dsc.res.opa;
|
||||
c.full = trans_dsc.res.color.full;
|
||||
}
|
||||
}
|
||||
|
||||
if(draw_dsc->recolor_opa != 0) {
|
||||
c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv);
|
||||
@@ -550,7 +570,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1,
|
||||
lv_area_get_width(&draw_area));
|
||||
if(mask_res_sub == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area));
|
||||
_lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area));
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
|
||||
@@ -563,29 +583,30 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
blend_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
|
||||
blend_area.y1 = blend_area.y2 + 1;
|
||||
blend_area.y2 = blend_area.y1;
|
||||
|
||||
px_i = 0;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle || draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
mask_res = (alpha_byte || chroma_key || draw_dsc->angle ||
|
||||
draw_dsc->zoom != LV_IMG_ZOOM_NONE) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
|
||||
|
||||
/*Prepare the `mask_buf`if there are other masks*/
|
||||
if(other_mask_cnt) {
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
_lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Flush the last part*/
|
||||
if(blend_area.y1 != blend_area.y2) {
|
||||
blend_area.y2--;
|
||||
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
_lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
|
||||
}
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(map2);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(map2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@ typedef uint8_t cmd_state_t;
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
||||
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
|
||||
const lv_font_t * font_p,
|
||||
uint32_t letter, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
|
||||
const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
|
||||
@@ -54,30 +56,31 @@ const uint8_t _lv_bpp1_opa_table[2] = {0, 255}; /*Opacity mapping with
|
||||
const uint8_t _lv_bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping with bpp = 2*/
|
||||
|
||||
const uint8_t _lv_bpp3_opa_table[8] = {0, 36, 73, 109, /*Opacity mapping with bpp = 3*/
|
||||
146, 182, 219, 255};
|
||||
146, 182, 219, 255
|
||||
};
|
||||
|
||||
const uint8_t _lv_bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
|
||||
68, 85, 102, 119,
|
||||
136, 153, 170, 187,
|
||||
204, 221, 238, 255
|
||||
};
|
||||
68, 85, 102, 119,
|
||||
136, 153, 170, 187,
|
||||
204, 221, 238, 255
|
||||
};
|
||||
const uint8_t _lv_bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
|
||||
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
|
||||
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -89,7 +92,7 @@ const uint8_t _lv_bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
|
||||
_lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->color = LV_COLOR_BLACK;
|
||||
dsc->font = LV_THEME_DEFAULT_FONT_NORMAL;
|
||||
@@ -105,9 +108,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
* @param mask the label will be drawn only in this area
|
||||
* @param dsc pointer to draw descriptor
|
||||
* @param txt `\0` terminated text to write
|
||||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the drawer to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_label_dsc_t * dsc,
|
||||
const char * txt, lv_draw_label_hint_t * hint)
|
||||
const char * txt, lv_draw_label_hint_t * hint)
|
||||
{
|
||||
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
@@ -118,7 +123,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
if(txt[0] == '\0') return;
|
||||
|
||||
lv_area_t clipped_area;
|
||||
bool clip_ok = lv_area_intersect(&clipped_area, coords, mask);
|
||||
bool clip_ok = _lv_area_intersect(&clipped_area, coords, mask);
|
||||
if(!clip_ok) return;
|
||||
|
||||
|
||||
@@ -129,8 +134,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
else {
|
||||
/*If EXAPND is enabled then not limit the text's width to the object's width*/
|
||||
lv_point_t p;
|
||||
lv_txt_get_size(&p, txt, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
|
||||
dsc->flag);
|
||||
_lv_txt_get_size(&p, txt, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
|
||||
dsc->flag);
|
||||
w = p.x;
|
||||
}
|
||||
|
||||
@@ -167,13 +172,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
pos.y += hint->y;
|
||||
}
|
||||
|
||||
uint32_t line_end = line_start + lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
uint32_t line_end = line_start + _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
|
||||
/*Go the first visible line*/
|
||||
while(pos.y + line_height_font < mask->y1) {
|
||||
/*Go to next line*/
|
||||
line_start = line_end;
|
||||
line_end += lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
pos.y += line_height;
|
||||
|
||||
/*Save at the threshold coordinate*/
|
||||
@@ -188,14 +193,14 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
|
||||
/*Align to middle*/
|
||||
if(dsc->flag & LV_TXT_FLAG_CENTER) {
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
line_width = _lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
|
||||
pos.x += (lv_area_get_width(coords) - line_width) / 2;
|
||||
|
||||
}
|
||||
/*Align to the right*/
|
||||
else if(dsc->flag & LV_TXT_FLAG_RIGHT) {
|
||||
line_width = lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
line_width = _lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
}
|
||||
|
||||
@@ -238,8 +243,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
i = 0;
|
||||
#if LV_USE_BIDI
|
||||
char * bidi_txt = lv_mem_buf_get(line_end - line_start + 1);
|
||||
lv_bidi_process_paragraph(txt + line_start, bidi_txt, line_end - line_start, dsc->bidi_dir, NULL, 0);
|
||||
char * bidi_txt = _lv_mem_buf_get(line_end - line_start + 1);
|
||||
_lv_bidi_process_paragraph(txt + line_start, bidi_txt, line_end - line_start, dsc->bidi_dir, NULL, 0);
|
||||
#else
|
||||
const char * bidi_txt = txt + line_start;
|
||||
#endif
|
||||
@@ -248,16 +253,16 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
uint16_t logical_char_pos = 0;
|
||||
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
|
||||
#if LV_USE_BIDI
|
||||
logical_char_pos = lv_txt_encoded_get_char_id(txt, line_start);
|
||||
uint16_t t = lv_txt_encoded_get_char_id(bidi_txt, i);
|
||||
logical_char_pos += lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, dsc->bidi_dir, t, NULL);
|
||||
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start);
|
||||
uint16_t t = _lv_txt_encoded_get_char_id(bidi_txt, i);
|
||||
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, dsc->bidi_dir, t, NULL);
|
||||
#else
|
||||
logical_char_pos = lv_txt_encoded_get_char_id(txt, line_start + i);
|
||||
logical_char_pos = _lv_txt_encoded_get_char_id(txt, line_start + i);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t letter = lv_txt_encoded_next(bidi_txt, &i);
|
||||
uint32_t letter_next = lv_txt_encoded_next(&bidi_txt[i], NULL);
|
||||
uint32_t letter = _lv_txt_encoded_next(bidi_txt, &i);
|
||||
uint32_t letter_next = _lv_txt_encoded_next(&bidi_txt[i], NULL);
|
||||
|
||||
/*Handle the re-color command*/
|
||||
if((dsc->flag & LV_TXT_FLAG_RECOLOR) != 0) {
|
||||
@@ -282,7 +287,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
/*Get the parameter*/
|
||||
if(i - par_start == LABEL_RECOLOR_PAR_LENGTH + 1) {
|
||||
char buf[LABEL_RECOLOR_PAR_LENGTH + 1];
|
||||
lv_memcpy_small(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
|
||||
_lv_memcpy_small(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
|
||||
buf[LABEL_RECOLOR_PAR_LENGTH] = '\0';
|
||||
int r, g, b;
|
||||
r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]);
|
||||
@@ -344,18 +349,18 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
}
|
||||
|
||||
#if LV_USE_BIDI
|
||||
lv_mem_buf_release(bidi_txt);
|
||||
_lv_mem_buf_release(bidi_txt);
|
||||
bidi_txt = NULL;
|
||||
#endif
|
||||
/*Go to next line*/
|
||||
line_start = line_end;
|
||||
line_end += lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
line_end += _lv_txt_get_next_line(&txt[line_start], font, dsc->letter_space, w, dsc->flag);
|
||||
|
||||
pos.x = coords->x1;
|
||||
/*Align to middle*/
|
||||
if(dsc->flag & LV_TXT_FLAG_CENTER) {
|
||||
line_width =
|
||||
lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
_lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
|
||||
pos.x += (lv_area_get_width(coords) - line_width) / 2;
|
||||
|
||||
@@ -363,7 +368,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
/*Align to the right*/
|
||||
else if(dsc->flag & LV_TXT_FLAG_RIGHT) {
|
||||
line_width =
|
||||
lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
_lv_txt_get_width(&txt[line_start], line_end - line_start, font, dsc->letter_space, dsc->flag);
|
||||
pos.x += lv_area_get_width(coords) - line_width;
|
||||
}
|
||||
|
||||
@@ -390,9 +395,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
* @param color color of letter
|
||||
* @param opa opacity of letter (0..255)
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area, const lv_font_t * font_p,
|
||||
uint32_t letter,
|
||||
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const lv_area_t * clip_area,
|
||||
const lv_font_t * font_p,
|
||||
uint32_t letter,
|
||||
lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
if(opa < LV_OPA_MIN) return;
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
@@ -443,8 +449,9 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_letter(const lv_point_t * pos_p, const
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g,
|
||||
const lv_area_t * clip_area,
|
||||
const uint8_t * map_p, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
const uint8_t * bpp_opa_table_p;
|
||||
uint32_t bitmask_init;
|
||||
@@ -513,8 +520,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
uint32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
|
||||
uint32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? box_w * box_h : LV_HOR_RES_MAX;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
uint32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : box_w * box_h;
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
|
||||
lv_area_t fill_area;
|
||||
@@ -563,17 +570,17 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2,
|
||||
lv_area_get_width(&fill_area));
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&fill_area));
|
||||
_lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&fill_area));
|
||||
}
|
||||
}
|
||||
|
||||
if((uint32_t) mask_p + (row_end - row_start) < mask_buf_size) {
|
||||
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
fill_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||
blend_mode);
|
||||
_lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||
blend_mode);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
@@ -588,13 +595,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_letter_normal(lv_coord_t pos_x, lv_coord_
|
||||
/*Flush the last part*/
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||
blend_mode);
|
||||
_lv_blend_fill(clip_area, &fill_area,
|
||||
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
|
||||
blend_mode);
|
||||
mask_p = 0;
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
|
||||
static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_dsc_t * g, const lv_area_t * clip_area,
|
||||
@@ -650,13 +657,13 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
int32_t col_bit;
|
||||
col_bit = bit_ofs & 0x7; /* "& 0x7" equals to "% 8" just faster */
|
||||
|
||||
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? g->box_w * g->box_h : LV_HOR_RES_MAX;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_buf_size = box_w * box_h > LV_HOR_RES_MAX ? LV_HOR_RES_MAX : g->box_w * g->box_h;
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||
int32_t mask_p = 0;
|
||||
|
||||
lv_color_t * color_buf = lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
lv_color_t * color_buf = _lv_mem_buf_get(mask_buf_size * sizeof(lv_color_t));
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
int32_t vdb_width = lv_area_get_width(&vdb->area);
|
||||
@@ -722,7 +729,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
#endif
|
||||
|
||||
#if LV_FONT_SUBPX_BGR
|
||||
res_color.ch.blue = (uint326_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
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;
|
||||
#else
|
||||
res_color.ch.red = (uint32_t)((uint16_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8;
|
||||
@@ -737,6 +744,10 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
res_color.ch.green_l = green & 0x7;
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 32
|
||||
res_color.ch.alpha = 0xff;
|
||||
#endif
|
||||
|
||||
if(font_rgb[0] == 0 && font_rgb[1] == 0 && font_rgb[2] == 0) mask_buf[mask_p] = LV_OPA_TRANSP;
|
||||
else mask_buf[mask_p] = LV_OPA_COVER;
|
||||
color_buf[mask_p] = res_color;
|
||||
@@ -763,15 +774,15 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, map_area.x1, map_area.y2,
|
||||
lv_area_get_width(&map_area));
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&map_area));
|
||||
_lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&map_area));
|
||||
}
|
||||
}
|
||||
|
||||
if((uint32_t) mask_p + (row_end - row_start) < mask_buf_size) {
|
||||
if((uint32_t) mask_p + (col_end - col_start) < mask_buf_size) {
|
||||
map_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||
_lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||
|
||||
map_area.y1 = map_area.y2 + 1;
|
||||
map_area.y2 = map_area.y1;
|
||||
@@ -790,11 +801,11 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_
|
||||
/*Flush the last part*/
|
||||
if(map_area.y1 != map_area.y2) {
|
||||
map_area.y2--;
|
||||
lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||
_lv_blend_map(clip_area, &map_area, color_buf, mask_buf, LV_DRAW_MASK_RES_CHANGED, opa, blend_mode);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(color_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(color_buf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,6 +64,8 @@ typedef struct {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
@@ -72,10 +74,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
|
||||
* @param mask the label will be drawn only in this area
|
||||
* @param dsc pointer to draw descriptor
|
||||
* @param txt `\0` terminated text to write
|
||||
* @param hint pointer to a `lv_draw_label_hint_t` variable.
|
||||
* It is managed by the drawer to speed up the drawing of very long texts (thousands of lines).
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_label_dsc_t * dsc,
|
||||
const char * txt, lv_draw_label_hint_t * hint);
|
||||
const char * txt, lv_draw_label_hint_t * hint);
|
||||
|
||||
//! @endcond
|
||||
/***********************
|
||||
* GLOBAL VARIABLES
|
||||
***********************/
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -45,7 +48,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t));
|
||||
_lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t));
|
||||
dsc->width = 1;
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->color = LV_COLOR_BLACK;
|
||||
@@ -60,7 +63,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
* @param opa_scale scale down all opacities by the factor
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
if(dsc->width == 0) return;
|
||||
if(dsc->opa <= LV_OPA_MIN) return;
|
||||
@@ -74,7 +77,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_poin
|
||||
clip_line.y2 = LV_MATH_MAX(point1->y, point2->y) + dsc->width / 2;
|
||||
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&clip_line, &clip_line, clip);
|
||||
is_common = _lv_area_intersect(&clip_line, &clip_line, clip);
|
||||
if(!is_common) return;
|
||||
|
||||
if(point1->y == point2->y) draw_line_hor(point1, point2, &clip_line, dsc);
|
||||
@@ -115,12 +118,13 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_poin
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -143,16 +147,16 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
|
||||
/*If there is no mask then simply draw a rectangle*/
|
||||
if(simple_mode) {
|
||||
lv_blend_fill(clip, &draw_area,
|
||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->blend_mode);
|
||||
_lv_blend_fill(clip, &draw_area,
|
||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
/*If there other mask apply it*/
|
||||
else {
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
@@ -175,10 +179,10 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
dash_start = (vdb->area.x1 + draw_area.x1) % (dsc->dash_gap + dsc->dash_width);
|
||||
}
|
||||
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||
int32_t h;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
if(dashed) {
|
||||
@@ -203,24 +207,25 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
}
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
dsc->color, mask_buf, mask_res, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->color, mask_buf, mask_res, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
}
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_opa_t opa = dsc->opa;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -243,16 +248,16 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
|
||||
/*If there is no mask then simply draw a rectangle*/
|
||||
if(simple_mode) {
|
||||
lv_blend_fill(clip, &draw_area,
|
||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->blend_mode);
|
||||
_lv_blend_fill(clip, &draw_area,
|
||||
dsc->color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
/*If there other mask apply it*/
|
||||
else {
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
is_common = _lv_area_intersect(&draw_area, clip, &draw_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/* Now `draw_area` has absolute coordinates.
|
||||
@@ -270,7 +275,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
fill_area.y1 = draw_area.y1 + disp_area->y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||
|
||||
lv_style_int_t dash_start = 0;
|
||||
if(dashed) {
|
||||
@@ -281,7 +286,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
|
||||
int32_t h;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
if(dashed) {
|
||||
@@ -297,20 +302,21 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
dash_cnt ++;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
dsc->color, mask_buf, mask_res, dsc->opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->color, mask_buf, mask_res, dsc->opa,
|
||||
LV_BLEND_MODE_NORMAL);
|
||||
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
}
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
const lv_area_t * clip,
|
||||
lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
/*Keep the great y in p1*/
|
||||
lv_point_t p1;
|
||||
@@ -358,7 +364,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
/* Get the union of `coords` and `clip`*/
|
||||
/* `clip` is already truncated to the `vdb` size
|
||||
* in 'lv_refr_area' function */
|
||||
bool is_common = lv_area_intersect(&draw_area, &draw_area, clip);
|
||||
bool is_common = _lv_area_intersect(&draw_area, &draw_area, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
lv_draw_mask_line_param_t mask_left_param;
|
||||
@@ -401,7 +407,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
mask_bottom_id = lv_draw_mask_add(&mask_bottom_param, NULL);
|
||||
}
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -420,7 +426,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
/*Draw the background line by line*/
|
||||
int32_t h;
|
||||
size_t mask_buf_size = LV_MATH_MIN(lv_area_get_size(&draw_area), LV_HOR_RES_MAX);
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(mask_buf_size);
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(mask_buf_size);
|
||||
|
||||
lv_area_t fill_area;
|
||||
fill_area.x1 = draw_area.x1 + disp_area->x1;
|
||||
@@ -432,13 +438,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
|
||||
uint32_t mask_p = 0;
|
||||
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
_lv_memset_ff(mask_buf, mask_buf_size);
|
||||
/*Fill the first row with 'color'*/
|
||||
for(h = draw_area.y1 + disp_area->y1; h <= draw_area.y2 + disp_area->y1; h++) {
|
||||
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(&mask_buf[mask_p], x, h, draw_area_w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[mask_p], draw_area_w);
|
||||
_lv_memset_00(&mask_buf[mask_p], draw_area_w);
|
||||
}
|
||||
|
||||
mask_p += draw_area_w;
|
||||
@@ -446,27 +452,27 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, cons
|
||||
fill_area.y2 ++;
|
||||
}
|
||||
else {
|
||||
lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
_lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
fill_area.y1 = fill_area.y2 + 1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
mask_p = 0;
|
||||
lv_memset_ff(mask_buf, mask_buf_size);
|
||||
_lv_memset_ff(mask_buf, mask_buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
/*Flush the last part*/
|
||||
if(fill_area.y1 != fill_area.y2) {
|
||||
fill_area.y2--;
|
||||
lv_blend_fill( &fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
_lv_blend_fill(&fill_area, clip,
|
||||
dsc->color, mask_buf, LV_DRAW_MASK_RES_CHANGED, dsc->opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
|
||||
lv_draw_mask_remove_id(mask_left_id);
|
||||
lv_draw_mask_remove_id(mask_right_id);
|
||||
|
||||
@@ -38,6 +38,7 @@ typedef struct {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
/**
|
||||
* Draw a line
|
||||
* @param point1 first point of the line
|
||||
@@ -47,10 +48,13 @@ typedef struct {
|
||||
* @param opa_scale scale down all opacities by the factor
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * mask,
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
lv_draw_line_dsc_t * dsc);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
|
||||
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -31,21 +31,28 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * param);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * param);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p);
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void sqrt_approx(lv_sqrt_res_t * q, lv_sqrt_res_t * ref, uint32_t x);
|
||||
@@ -99,7 +106,8 @@ int16_t lv_draw_mask_add(void * param, void * custom_id)
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len)
|
||||
{
|
||||
bool changed = false;
|
||||
lv_draw_mask_common_dsc_t * dsc;
|
||||
@@ -186,7 +194,7 @@ LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void)
|
||||
void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x,
|
||||
lv_coord_t p2y, lv_draw_mask_line_side_t side)
|
||||
{
|
||||
lv_memset_00(param, sizeof(lv_draw_mask_line_param_t));
|
||||
_lv_memset_00(param, sizeof(lv_draw_mask_line_param_t));
|
||||
|
||||
if(p1y > p2y) {
|
||||
lv_coord_t t;
|
||||
@@ -285,8 +293,8 @@ void lv_draw_mask_line_angle_init(lv_draw_mask_line_param_t * param, lv_coord_t
|
||||
int32_t p2x;
|
||||
int32_t p2y;
|
||||
|
||||
p2x = (lv_trigo_sin(angle + 90) >> 5) + p1x;
|
||||
p2y = (lv_trigo_sin(angle) >> 5) + py;
|
||||
p2x = (_lv_trigo_sin(angle + 90) >> 5) + p1x;
|
||||
p2y = (_lv_trigo_sin(angle) >> 5) + py;
|
||||
|
||||
lv_draw_mask_line_points_init(param, p1x, py, p2x, p2y, side);
|
||||
}
|
||||
@@ -425,8 +433,9 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
/*Make to points relative to the vertex*/
|
||||
abs_y -= p->origo.y;
|
||||
@@ -456,7 +465,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
else {
|
||||
int32_t k = - abs_x;
|
||||
if(k < 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(k >= 0 && k < len) lv_memset_00(&mask_buf[k], len - k);
|
||||
if(k >= 0 && k < len) _lv_memset_00(&mask_buf[k], len - k);
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
@@ -466,7 +475,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
int32_t k = - abs_x;
|
||||
if(k < 0) k = 0;
|
||||
if(k >= len) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(k >= 0 && k < len) lv_memset_00(&mask_buf[0], k);
|
||||
else if(k >= 0 && k < len) _lv_memset_00(&mask_buf[0], k);
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
@@ -484,8 +493,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
return res;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
int32_t y_at_x;
|
||||
y_at_x = (int32_t)((int32_t)p->yx_steep * abs_x) >> 10;
|
||||
@@ -584,7 +594,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(k >= 0) {
|
||||
lv_memset_00(&mask_buf[0], k);
|
||||
_lv_memset_00(&mask_buf[0], k);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -593,15 +603,16 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(k <= len) {
|
||||
lv_memset_00(&mask_buf[k], len - k);
|
||||
_lv_memset_00(&mask_buf[k], len - k);
|
||||
}
|
||||
}
|
||||
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
lv_draw_mask_line_param_t * p)
|
||||
{
|
||||
int32_t k;
|
||||
int32_t x_at_y;
|
||||
@@ -662,13 +673,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
if(k >= len) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(k >= 0) lv_memset_00(&mask_buf[0], k);
|
||||
if(k >= 0) _lv_memset_00(&mask_buf[0], k);
|
||||
|
||||
}
|
||||
else {
|
||||
if(k > len) k = len;
|
||||
if(k == 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(k > 0) lv_memset_00(&mask_buf[k], len - k);
|
||||
else if(k > 0) _lv_memset_00(&mask_buf[k], len - k);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -697,12 +708,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
k = xsi - abs_x - 1;
|
||||
|
||||
if(k > len) k = len;
|
||||
else if(k > 0) lv_memset_00(&mask_buf[0], k);
|
||||
else if(k > 0) _lv_memset_00(&mask_buf[0], k);
|
||||
|
||||
}
|
||||
else {
|
||||
if(k > len) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
if(k >= 0) lv_memset_00(&mask_buf[k], len - k);
|
||||
if(k >= 0) _lv_memset_00(&mask_buf[k], len - k);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -727,13 +738,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
if(p->inv) {
|
||||
k = xsi - abs_x;
|
||||
if(k > len) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(k >= 0) lv_memset_00(&mask_buf[0], k);
|
||||
if(k >= 0) _lv_memset_00(&mask_buf[0], k);
|
||||
|
||||
}
|
||||
else {
|
||||
if(k > len) k = len;
|
||||
if(k == 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(k > 0) lv_memset_00(&mask_buf[k], len - k);
|
||||
else if(k > 0) _lv_memset_00(&mask_buf[k], len - k);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -742,8 +753,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_angle_param_t * p)
|
||||
{
|
||||
int32_t rel_y = abs_y - p->cfg.vertex_p.y;
|
||||
int32_t rel_x = abs_x - p->cfg.vertex_p.x;
|
||||
@@ -782,7 +794,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp > 0) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, &p->start_line);
|
||||
if(res1 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[0], tmp);
|
||||
_lv_memset_00(&mask_buf[0], tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,7 +802,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp < 0) tmp = 0;
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x + tmp, abs_y, len - tmp, &p->end_line);
|
||||
if(res2 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[tmp], len - tmp);
|
||||
_lv_memset_00(&mask_buf[tmp], len - tmp);
|
||||
}
|
||||
if(res1 == res2) return res1;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -824,7 +836,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp > 0) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, (lv_draw_mask_line_param_t *)&p->end_line);
|
||||
if(res1 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[0], tmp);
|
||||
_lv_memset_00(&mask_buf[0], tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,7 +844,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp < 0) tmp = 0;
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x + tmp, abs_y, len - tmp, (lv_draw_mask_line_param_t *)&p->start_line);
|
||||
if(res2 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[tmp], len - tmp);
|
||||
_lv_memset_00(&mask_buf[tmp], len - tmp);
|
||||
}
|
||||
if(res1 == res2) return res1;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -881,8 +893,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
}
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_radius_param_t * p)
|
||||
{
|
||||
bool outer = p->cfg.outer;
|
||||
int32_t radius = p->cfg.radius;
|
||||
@@ -890,7 +903,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
lv_area_copy(&rect, &p->cfg.rect);
|
||||
|
||||
if(outer == false) {
|
||||
if(abs_y < rect.y1 || abs_y >rect.y2) {
|
||||
if(abs_y < rect.y1 || abs_y > rect.y2) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
}
|
||||
@@ -907,13 +920,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
int32_t last = rect.x1 - abs_x;
|
||||
if(last > len) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(last >= 0) {
|
||||
lv_memset_00(&mask_buf[0], last);
|
||||
_lv_memset_00(&mask_buf[0], last);
|
||||
}
|
||||
|
||||
int32_t first = rect.x2 - abs_x + 1;
|
||||
if(first <= 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(first < len) {
|
||||
lv_memset_00(&mask_buf[first], len - first);
|
||||
_lv_memset_00(&mask_buf[first], len - first);
|
||||
}
|
||||
if(last == 0 && first == len) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -925,7 +938,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
int32_t last = rect.x2 - abs_x - first + 1;
|
||||
if(first + last > len) last = len - first;
|
||||
if(last >= 0) {
|
||||
lv_memset_00(&mask_buf[first], last);
|
||||
_lv_memset_00(&mask_buf[first], last);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -961,11 +974,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
if(y == p->y_prev) {
|
||||
x0.f = p->y_prev_x.f;
|
||||
x0.i = p->y_prev_x.i;
|
||||
} else {
|
||||
lv_sqrt(r2 - (y * y), &x0, sqrt_mask);
|
||||
}
|
||||
lv_sqrt(r2 - ((y - 1) * (y - 1)), &x1, sqrt_mask);
|
||||
p->y_prev = y-1;
|
||||
else {
|
||||
_lv_sqrt(r2 - (y * y), &x0, sqrt_mask);
|
||||
}
|
||||
_lv_sqrt(r2 - ((y - 1) * (y - 1)), &x1, sqrt_mask);
|
||||
p->y_prev = y - 1;
|
||||
p->y_prev_x.f = x1.f;
|
||||
p->y_prev_x.i = x1.i;
|
||||
}
|
||||
@@ -978,11 +992,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
if((y - 1) == p->y_prev) {
|
||||
x1.f = p->y_prev_x.f;
|
||||
x1.i = p->y_prev_x.i;
|
||||
} else {
|
||||
lv_sqrt(r2 - ((y - 1) * (y - 1)), &x1, sqrt_mask);
|
||||
}
|
||||
else {
|
||||
_lv_sqrt(r2 - ((y - 1) * (y - 1)), &x1, sqrt_mask);
|
||||
}
|
||||
|
||||
lv_sqrt(r2 - (y * y), &x0, sqrt_mask);
|
||||
_lv_sqrt(r2 - (y * y), &x0, sqrt_mask);
|
||||
p->y_prev = y;
|
||||
p->y_prev_x.f = x0.f;
|
||||
p->y_prev_x.i = x0.i;
|
||||
@@ -1021,13 +1036,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(kl >= 0) {
|
||||
lv_memset_00(&mask_buf[0], kl);
|
||||
_lv_memset_00(&mask_buf[0], kl);
|
||||
}
|
||||
if(kr < 0) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(kr <= len) {
|
||||
lv_memset_00(&mask_buf[kr], len - kr);
|
||||
_lv_memset_00(&mask_buf[kr], len - kr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1038,7 +1053,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
int32_t len_tmp = kr - first;
|
||||
if(len_tmp + first > len) len_tmp = len - first;
|
||||
if(first < len && len_tmp >= 0) {
|
||||
lv_memset_00(&mask_buf[first], len_tmp);
|
||||
_lv_memset_00(&mask_buf[first], len_tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1055,7 +1070,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
int32_t len_tmp = kr - first;
|
||||
if(len_tmp + first > len) len_tmp = len - first;
|
||||
if(first < len && len_tmp >= 0) {
|
||||
lv_memset_00(&mask_buf[first], len_tmp);
|
||||
_lv_memset_00(&mask_buf[first], len_tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1064,7 +1079,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
lv_sqrt_res_t y_prev;
|
||||
lv_sqrt_res_t y_next;
|
||||
|
||||
lv_sqrt(r2 - (x0.i * x0.i), &y_prev, sqrt_mask);
|
||||
_lv_sqrt(r2 - (x0.i * x0.i), &y_prev, sqrt_mask);
|
||||
|
||||
if(y_prev.f == 0) {
|
||||
y_prev.i--;
|
||||
@@ -1073,7 +1088,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
/*The first y intersection is special as it might be in the previous line*/
|
||||
if(y_prev.i >= y) {
|
||||
lv_sqrt(r2 - (i * i), &y_next, sqrt_mask);
|
||||
_lv_sqrt(r2 - (i * i), &y_next, sqrt_mask);
|
||||
m = 255 - (((255 - x0.f) * (255 - y_next.f)) >> 9);
|
||||
|
||||
if(outer) m = 255 - m;
|
||||
@@ -1116,12 +1131,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
if(kl > len) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(kl >= 0) lv_memset_00(&mask_buf[0], kl);
|
||||
if(kl >= 0) _lv_memset_00(&mask_buf[0], kl);
|
||||
|
||||
if(kr < 0) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(kr < len) lv_memset_00(&mask_buf[kr], len - kr);
|
||||
if(kr < len) _lv_memset_00(&mask_buf[kr], len - kr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1130,8 +1145,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
}
|
||||
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_fade_param_t * p)
|
||||
{
|
||||
if(abs_y < p->cfg.coords.y1) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
if(abs_y > p->cfg.coords.y2) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
@@ -1175,8 +1191,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_fade(lv_opa_t * mas
|
||||
}
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * p)
|
||||
LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t len,
|
||||
lv_draw_mask_map_param_t * p)
|
||||
{
|
||||
/*Handle out of the mask cases*/
|
||||
if(abs_y < p->cfg.coords.y1) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
@@ -1229,7 +1246,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void sqrt_approx(lv_sqrt_res_t * q, lv_sqrt_
|
||||
x = x << 8; /*Upscale for extra precision*/
|
||||
|
||||
uint32_t raw = (ref->i << 4) + (ref->f >> 4);
|
||||
uint32_t raw2 = raw*raw;
|
||||
uint32_t raw2 = raw * raw;
|
||||
|
||||
int32_t d = x - raw2;
|
||||
d = (int32_t)d / (int32_t)(2 * raw) + raw;
|
||||
|
||||
@@ -57,8 +57,9 @@ enum {
|
||||
* A common callback type for every mask type.
|
||||
* Used internally by the library.
|
||||
*/
|
||||
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
|
||||
void * p);
|
||||
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len,
|
||||
void * p);
|
||||
|
||||
typedef uint8_t lv_draw_mask_line_side_t;
|
||||
|
||||
@@ -172,6 +173,9 @@ typedef struct _lv_draw_mask_map_param_t {
|
||||
*/
|
||||
int16_t lv_draw_mask_add(void * param, void * custom_id);
|
||||
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Apply the added buffers on a line. Used internally by the library's drawing routines.
|
||||
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
|
||||
@@ -183,7 +187,11 @@ int16_t lv_draw_mask_add(void * param, void * custom_id);
|
||||
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
|
||||
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len);
|
||||
LV_ATTRIBUTE_FAST_MEM lv_draw_mask_res_t lv_draw_mask_apply(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y,
|
||||
lv_coord_t len);
|
||||
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Remove a mask with a given ID
|
||||
@@ -201,12 +209,17 @@ void * lv_draw_mask_remove_id(int16_t id);
|
||||
*/
|
||||
void * lv_draw_mask_remove_custom(void * custom_id);
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Count the currently added masks
|
||||
* @return number of active masks
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM uint8_t lv_draw_mask_get_cnt(void);
|
||||
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
*Initialize a line mask from two points.
|
||||
* @param param pointer to a `lv_draw_mask_param_t` to initialize
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "lv_draw_rect.h"
|
||||
#include "lv_draw_blend.h"
|
||||
#include "lv_draw_mask.h"
|
||||
#include "../lv_misc/lv_circ.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
@@ -29,12 +28,15 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc);
|
||||
static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
||||
#if LV_USE_SHADOW
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t s, lv_coord_t r);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t s,
|
||||
lv_coord_t r);
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
|
||||
#endif
|
||||
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
|
||||
@@ -44,9 +46,9 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
#if LV_USE_SHADOW && LV_SHADOW_CACHE_SIZE
|
||||
static uint8_t sh_cache[LV_SHADOW_CACHE_SIZE * LV_SHADOW_CACHE_SIZE];
|
||||
static int32_t sh_cache_size = -1;
|
||||
static int32_t sh_cache_r = -1;
|
||||
static uint8_t sh_cache[LV_SHADOW_CACHE_SIZE * LV_SHADOW_CACHE_SIZE];
|
||||
static int32_t sh_cache_size = -1;
|
||||
static int32_t sh_cache_r = -1;
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -59,7 +61,7 @@ static int32_t sh_cache_r = -1;
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_rect_dsc_t));
|
||||
_lv_memset_00(dsc, sizeof(lv_draw_rect_dsc_t));
|
||||
dsc->bg_color = LV_COLOR_WHITE;
|
||||
dsc->bg_grad_color = LV_COLOR_BLACK;
|
||||
dsc->border_color = LV_COLOR_BLACK;
|
||||
@@ -156,14 +158,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, &coords_bg, clip);
|
||||
is_common = _lv_area_intersect(&draw_area, &coords_bg, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -178,7 +180,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
/*Create a mask if there is a radius*/
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||
|
||||
uint16_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||
bool simple_mode = true;
|
||||
@@ -197,9 +199,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
/*Most simple case: just a plain rectangle*/
|
||||
if(simple_mode && rout == 0 && (dsc->bg_grad_dir == LV_GRAD_DIR_NONE)) {
|
||||
lv_blend_fill(clip, &coords_bg,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &coords_bg,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
|
||||
dsc->bg_blend_mode);
|
||||
}
|
||||
/*More complex case: there is a radius, gradient or other mask.*/
|
||||
else {
|
||||
@@ -218,7 +220,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
lv_color_t * grad_map = NULL;
|
||||
/*In case of horizontal gradient pre-compute a line with a gradient*/
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR && dsc->bg_color.full != dsc->bg_grad_color.full) {
|
||||
grad_map = lv_mem_buf_get(coords_w * sizeof(lv_color_t));
|
||||
grad_map = _lv_mem_buf_get(coords_w * sizeof(lv_color_t));
|
||||
|
||||
int32_t i;
|
||||
for(i = 0; i < coords_w; i++) {
|
||||
@@ -242,13 +244,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
y < coords_bg.y2 - rout - 1) {
|
||||
mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
if(simple_mode == false) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
}
|
||||
}
|
||||
/*In corner areas apply the mask anyway*/
|
||||
else {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
}
|
||||
|
||||
@@ -270,15 +272,15 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
fill_area2.y1 = fill_area.y1;
|
||||
fill_area2.y2 = fill_area.y2;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
|
||||
/*Center part*/
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
|
||||
fill_area2.x1 = coords_bg.x1 + rout;
|
||||
fill_area2.x2 = coords_bg.x2 - rout;
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
}
|
||||
|
||||
/*Right part*/
|
||||
@@ -287,22 +289,22 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
|
||||
int32_t mask_ofs = (coords_bg.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||
if(mask_ofs < 0) mask_ofs = 0;
|
||||
lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, mask_buf + mask_ofs, mask_res, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2,
|
||||
grad_color, mask_buf + mask_ofs, mask_res, opa, dsc->bg_blend_mode);
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
if(dsc->bg_grad_dir == LV_GRAD_DIR_HOR) {
|
||||
lv_blend_map(clip, &fill_area, grad_map, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_map(clip, &fill_area, grad_map, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
}
|
||||
else if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
}
|
||||
else if(other_mask_cnt != 0 || !split) {
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
|
||||
}
|
||||
}
|
||||
fill_area.y1++;
|
||||
@@ -316,37 +318,38 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
fill_area.y1 = coords_bg.y1;
|
||||
fill_area.y2 = coords_bg.y1 + rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
|
||||
fill_area.y1 = coords_bg.y2 - rout;
|
||||
if(fill_area.y1 <= fill_area.y2) fill_area.y1 = fill_area.y2 + 1; /*Avoid overdrawing the last line*/
|
||||
fill_area.y2 = coords_bg.y2;
|
||||
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
|
||||
fill_area.x1 = coords_bg.x1;
|
||||
fill_area.x2 = coords_bg.x2;
|
||||
fill_area.y1 = coords_bg.y1 + rout + 1;
|
||||
fill_area.y2 = coords_bg.y2 - rout - 1;
|
||||
|
||||
lv_blend_fill(clip, &fill_area,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area,
|
||||
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
|
||||
|
||||
}
|
||||
|
||||
if(grad_map) lv_mem_buf_release(grad_map);
|
||||
if(grad_map) _lv_mem_buf_release(grad_map);
|
||||
}
|
||||
|
||||
lv_draw_mask_remove_id(mask_rout_id);
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(dsc->border_opa <= LV_OPA_MIN) return;
|
||||
if(dsc->border_width == 0) return;
|
||||
@@ -356,14 +359,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, coords, clip);
|
||||
is_common = _lv_area_intersect(&draw_area, coords, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -378,7 +381,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
int32_t draw_area_w = lv_area_get_width(&draw_area);
|
||||
|
||||
/*Create a mask if there is a radius*/
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||
|
||||
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||
bool simple_mode = true;
|
||||
@@ -438,7 +441,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
for(h = draw_area.y1; h <= upper_corner_end; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
lv_area_t fill_area2;
|
||||
@@ -448,14 +451,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
fill_area2.x1 = coords->x1;
|
||||
fill_area2.x2 = coords->x1 + rout - 1;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
|
||||
/*Draw the top horizontal line*/
|
||||
if(fill_area2.y2 < coords->y1 + dsc->border_width) {
|
||||
fill_area2.x1 = coords->x1 + rout;
|
||||
fill_area2.x2 = coords->x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
}
|
||||
|
||||
fill_area2.x1 = coords->x2 - rout + 1;
|
||||
@@ -463,7 +466,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
|
||||
int32_t mask_ofs = (coords->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||
if(mask_ofs < 0) mask_ofs = 0;
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
@@ -476,7 +479,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
for(h = lower_corner_end; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
lv_area_t fill_area2;
|
||||
@@ -485,21 +488,21 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
fill_area2.y1 = fill_area.y1;
|
||||
fill_area2.y2 = fill_area.y2;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
|
||||
/*Draw the bottom horizontal line*/
|
||||
if(fill_area2.y2 > coords->y2 - dsc->border_width) {
|
||||
fill_area2.x1 = coords->x1 + rout;
|
||||
fill_area2.x2 = coords->x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
}
|
||||
fill_area2.x1 = coords->x2 - rout + 1;
|
||||
fill_area2.x2 = coords->x2;
|
||||
|
||||
int32_t mask_ofs = (coords->x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||
if(mask_ofs < 0) mask_ofs = 0;
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
|
||||
|
||||
fill_area.y1++;
|
||||
@@ -512,13 +515,13 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
|
||||
fill_area.x1 = coords->x1;
|
||||
fill_area.x2 = coords->x1 + dsc->border_width - 1;
|
||||
lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
|
||||
/*Draw the right vertical border*/
|
||||
fill_area.x1 = coords->x2 - dsc->border_width + 1;
|
||||
fill_area.x2 = coords->x2;
|
||||
|
||||
lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
}
|
||||
/*Process line by line if there is other mask too*/
|
||||
else {
|
||||
@@ -545,9 +548,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
if(normal ||
|
||||
(top_only && fill_area.y1 <= coords->y1 + corner_size) ||
|
||||
(bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||
}
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
@@ -556,7 +559,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
}
|
||||
lv_draw_mask_remove_id(mask_rin_id);
|
||||
lv_draw_mask_remove_id(mask_rout_id);
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i)
|
||||
@@ -575,7 +578,8 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc
|
||||
}
|
||||
|
||||
#if LV_USE_SHADOW
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
|
||||
lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
/*Check whether the shadow is visible*/
|
||||
if(dsc->shadow_width == 0) return;
|
||||
@@ -604,14 +608,14 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
|
||||
if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, &sh_area, clip);
|
||||
is_common = _lv_area_intersect(&draw_area, &sh_area, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -649,21 +653,22 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
if(sh_cache_size == corner_size && sh_cache_r == r_sh) {
|
||||
/*Use the cache if available*/
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size);
|
||||
lv_memcpy(sh_buf, sh_cache, corner_size * corner_size);
|
||||
} else {
|
||||
_lv_memcpy(sh_buf, sh_cache, corner_size * corner_size);
|
||||
}
|
||||
else {
|
||||
/*A larger buffer is required for calculation */
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
|
||||
shadow_draw_corner_buf(&sh_rect_area, (uint16_t *)sh_buf, dsc->shadow_width, r_sh);
|
||||
|
||||
/*Cache the corner if it fits into the cache size*/
|
||||
if(corner_size * corner_size < sizeof(sh_cache)) {
|
||||
lv_memcpy(sh_cache, sh_buf, corner_size * corner_size);
|
||||
_lv_memcpy(sh_cache, sh_buf, corner_size * corner_size);
|
||||
sh_cache_size = corner_size;
|
||||
sh_cache_r = r_sh;
|
||||
}
|
||||
}
|
||||
#else
|
||||
sh_buf = lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
|
||||
sh_buf = _lv_mem_buf_get(corner_size * corner_size * sizeof(uint16_t));
|
||||
shadow_draw_corner_buf(&sh_rect_area, (uint16_t *)sh_buf, dsc->shadow_width, r_sh);
|
||||
#endif
|
||||
|
||||
@@ -677,7 +682,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
|
||||
/*Create a mask*/
|
||||
lv_draw_mask_res_t mask_res;
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(lv_area_get_width(&sh_area));
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(lv_area_get_width(&sh_area));
|
||||
|
||||
lv_draw_mask_radius_param_t mask_rout_param;
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &bg_coords, r_bg, true);
|
||||
@@ -695,7 +700,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y2 = a.y1 + corner_size - 1;
|
||||
|
||||
lv_area_t ca;
|
||||
bool has_com = lv_area_intersect(&ca, &a, clip);
|
||||
bool has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
/*Avoid overlap in the middle with large radius*/
|
||||
if(ca.y2 > h_half) ca.y2 = h_half;
|
||||
@@ -712,12 +717,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
fa.y2 = fa.y1;
|
||||
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
_lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -731,7 +736,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y2 - corner_size + 1;
|
||||
a.y2 = sh_area.y2;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
/*Avoid overlap in the middle with large radius*/
|
||||
if(ca.y1 <= h_half) ca.y1 = h_half + 1;
|
||||
@@ -749,12 +754,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
fa.y1 = fa.y2; /*Fill from bottom to top*/
|
||||
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
_lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1--;
|
||||
fa.y2--;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -768,7 +773,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y1 + corner_size;
|
||||
a.y2 = sh_area.y2 - corner_size;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
if(simple_mode) ca.x1 = LV_MATH_MAX(ca.x1, coords->x2);
|
||||
/*Draw horizontal lines*/
|
||||
@@ -785,17 +790,18 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
fa.y2 = fa.y1;
|
||||
mask_res = LV_DRAW_MASK_RES_FULL_COVER;
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
_lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fa,
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa,
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
}
|
||||
@@ -820,7 +826,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y1;
|
||||
a.y2 = a.y1 + corner_size - 1;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
/*Avoid overlap in the middle with large radius*/
|
||||
if(ca.y2 > h_half) ca.y2 = h_half;
|
||||
@@ -837,12 +843,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
fa.y2 = fa.y1;
|
||||
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
_lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -856,7 +862,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y2 - corner_size + 1;
|
||||
a.y2 = sh_area.y2;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
/*Avoid overlap in the middle with large radius*/
|
||||
if(ca.y1 <= h_half) ca.y1 = h_half + 1;
|
||||
@@ -873,12 +879,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
fa.y1 = fa.y2; /*Fill from bottom to top*/
|
||||
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
_lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, opa, dsc->shadow_blend_mode);
|
||||
fa.y1--;
|
||||
fa.y2--;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -892,7 +898,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y1 + corner_size;
|
||||
a.y2 = sh_area.y2 - corner_size;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
|
||||
if(simple_mode) ca.x2 = LV_MATH_MIN(coords->x1, ca.x2);
|
||||
@@ -908,16 +914,17 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_area_copy(&fa, &ca);
|
||||
fa.y2 = fa.y1;
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
_lv_memcpy(mask_buf, sh_buf_tmp, w);
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fa,
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa,
|
||||
dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
}
|
||||
@@ -930,7 +937,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y1;
|
||||
a.y2 = sh_area.y1 + corner_size - 1;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
if(simple_mode) ca.y2 = LV_MATH_MIN(ca.y2, coords->y1);
|
||||
/*Draw horizontal lines*/
|
||||
@@ -947,17 +954,18 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_opa_t opa_tmp = sh_buf_tmp[0];
|
||||
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
|
||||
|
||||
lv_memset(mask_buf, opa_tmp, w);
|
||||
_lv_memset(mask_buf, opa_tmp, w);
|
||||
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -971,7 +979,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y2 - corner_size + 1;
|
||||
a.y2 = sh_area.y2;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com) {
|
||||
if(simple_mode) ca.y1 = LV_MATH_MAX(ca.y1, coords->y2);
|
||||
/*Draw horizontal lines*/
|
||||
@@ -987,16 +995,17 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_opa_t opa_tmp = sh_buf_tmp[0];
|
||||
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
|
||||
|
||||
lv_memset(mask_buf, opa_tmp, w);
|
||||
_lv_memset(mask_buf, opa_tmp, w);
|
||||
if(simple_mode) {
|
||||
mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
fa.y1--;
|
||||
fa.y2--;
|
||||
sh_buf_tmp += corner_size;
|
||||
@@ -1009,7 +1018,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
a.y1 = sh_area.y1 + corner_size;
|
||||
a.y2 = sh_area.y2 - corner_size;
|
||||
|
||||
has_com = lv_area_intersect(&ca, &a, clip);
|
||||
has_com = _lv_area_intersect(&ca, &a, clip);
|
||||
if(has_com && simple_mode == false) {
|
||||
/*Draw horizontal lines*/
|
||||
lv_coord_t w = lv_area_get_width(&ca);
|
||||
@@ -1019,20 +1028,20 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
lv_area_copy(&fa, &ca);
|
||||
fa.y2 = fa.y1;
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memset(mask_buf, dsc->shadow_opa, w);
|
||||
_lv_memset(mask_buf, dsc->shadow_opa, w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, fa.x1, fa.y1, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
|
||||
lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
_lv_blend_fill(clip, &fa, dsc->shadow_color, mask_buf,
|
||||
mask_res, LV_OPA_COVER, dsc->shadow_blend_mode);
|
||||
fa.y1++;
|
||||
fa.y2++;
|
||||
}
|
||||
}
|
||||
|
||||
lv_draw_mask_remove_id(mask_rout_id);
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(sh_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(sh_buf);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1042,7 +1051,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
* @param sw shadow width
|
||||
* @param r radius
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t sw, lv_coord_t r)
|
||||
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t sw,
|
||||
lv_coord_t r)
|
||||
{
|
||||
int32_t sw_ori = sw;
|
||||
int32_t size = sw_ori + r;
|
||||
@@ -1065,13 +1075,13 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
||||
#endif
|
||||
|
||||
int32_t y;
|
||||
lv_opa_t * mask_line = lv_mem_buf_get(size);
|
||||
lv_opa_t * mask_line = _lv_mem_buf_get(size);
|
||||
uint16_t * sh_ups_tmp_buf = (uint16_t *)sh_buf;
|
||||
for(y = 0; y < size; y++) {
|
||||
lv_memset_ff(mask_line, size);
|
||||
_lv_memset_ff(mask_line, size);
|
||||
lv_draw_mask_res_t mask_res = mask_param.dsc.cb(mask_line, 0, y, size, &mask_param);
|
||||
if(mask_res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(sh_ups_tmp_buf, size * sizeof(sh_ups_tmp_buf[0]));
|
||||
_lv_memset_00(sh_ups_tmp_buf, size * sizeof(sh_ups_tmp_buf[0]));
|
||||
}
|
||||
else {
|
||||
int32_t i;
|
||||
@@ -1084,7 +1094,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
|
||||
|
||||
sh_ups_tmp_buf += size;
|
||||
}
|
||||
lv_mem_buf_release(mask_line);
|
||||
_lv_mem_buf_release(mask_line);
|
||||
|
||||
if(sw == 1) {
|
||||
uint32_t i;
|
||||
@@ -1132,7 +1142,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
|
||||
if((sw & 1) == 0) s_left--;
|
||||
|
||||
/*Horizontal blur*/
|
||||
uint16_t * sh_ups_blur_buf = lv_mem_buf_get(size * sizeof(uint16_t));
|
||||
uint16_t * sh_ups_blur_buf = _lv_mem_buf_get(size * sizeof(uint16_t));
|
||||
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
@@ -1155,7 +1165,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
|
||||
else left_val = sh_ups_tmp_buf[x - s_left - 1];
|
||||
v += left_val;
|
||||
}
|
||||
lv_memcpy(sh_ups_tmp_buf, sh_ups_blur_buf, size * sizeof(uint16_t));
|
||||
_lv_memcpy(sh_ups_tmp_buf, sh_ups_blur_buf, size * sizeof(uint16_t));
|
||||
sh_ups_tmp_buf += size;
|
||||
}
|
||||
|
||||
@@ -1193,7 +1203,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
|
||||
}
|
||||
}
|
||||
|
||||
lv_mem_buf_release(sh_ups_blur_buf);
|
||||
_lv_mem_buf_release(sh_ups_blur_buf);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1242,14 +1252,14 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
short_side = LV_MATH_MIN(coords_out_w, coords_out_h);
|
||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
/* Get clipped fill area which is the real draw area.
|
||||
* It is always the same or inside `fill_area` */
|
||||
lv_area_t draw_area;
|
||||
bool is_common;
|
||||
is_common = lv_area_intersect(&draw_area, &area_outer, clip);
|
||||
is_common = _lv_area_intersect(&draw_area, &area_outer, clip);
|
||||
if(is_common == false) return;
|
||||
|
||||
const lv_area_t * disp_area = &vdb->area;
|
||||
@@ -1272,7 +1282,7 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
lv_draw_mask_radius_init(&mask_rout_param, &area_outer, rout, false);
|
||||
int16_t mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
|
||||
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(draw_area_w);
|
||||
lv_opa_t * mask_buf = _lv_mem_buf_get(draw_area_w);
|
||||
|
||||
int32_t corner_size = LV_MATH_MAX(rout, dsc->outline_width - 1);
|
||||
|
||||
@@ -1293,7 +1303,7 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
fill_area.y1 = disp_area->y1 + draw_area.y1;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
for(h = draw_area.y1; h <= upper_corner_end; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
lv_area_t fill_area2;
|
||||
@@ -1303,14 +1313,14 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
fill_area2.x1 = area_outer.x1;
|
||||
fill_area2.x2 = area_outer.x1 + rout - 1;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
|
||||
/*Draw the top horizontal line*/
|
||||
if(fill_area2.y2 < area_outer.y1 + dsc->outline_width) {
|
||||
fill_area2.x1 = area_outer.x1 + rout;
|
||||
fill_area2.x2 = area_outer.x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
}
|
||||
|
||||
fill_area2.x1 = area_outer.x2 - rout + 1;
|
||||
@@ -1318,7 +1328,7 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
|
||||
int32_t mask_ofs = (area_outer.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||
if(mask_ofs < 0) mask_ofs = 0;
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
@@ -1330,7 +1340,7 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
fill_area.y1 = disp_area->y1 + lower_corner_end;
|
||||
fill_area.y2 = fill_area.y1;
|
||||
for(h = lower_corner_end; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
lv_area_t fill_area2;
|
||||
@@ -1339,21 +1349,21 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
fill_area2.y1 = fill_area.y1;
|
||||
fill_area2.y2 = fill_area.y2;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf, mask_res, opa, blend_mode);
|
||||
|
||||
/*Draw the bottom horizontal line*/
|
||||
if(fill_area2.y2 > area_outer.y2 - dsc->outline_width) {
|
||||
fill_area2.x1 = area_outer.x1 + rout;
|
||||
fill_area2.x2 = area_outer.x2 - rout;
|
||||
|
||||
lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
}
|
||||
fill_area2.x1 = area_outer.x2 - rout + 1;
|
||||
fill_area2.x2 = area_outer.x2;
|
||||
|
||||
int32_t mask_ofs = (area_outer.x2 - rout + 1) - (vdb->area.x1 + draw_area.x1);
|
||||
if(mask_ofs < 0) mask_ofs = 0;
|
||||
lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area2, color, mask_buf + mask_ofs, mask_res, opa, blend_mode);
|
||||
|
||||
|
||||
fill_area.y1++;
|
||||
@@ -1366,13 +1376,13 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
|
||||
fill_area.x1 = area_outer.x1;
|
||||
fill_area.x2 = area_outer.x1 + dsc->outline_width - 1;
|
||||
lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
|
||||
/*Draw the right vertical border*/
|
||||
fill_area.x1 = area_outer.x2 - dsc->outline_width + 1;
|
||||
fill_area.x2 = area_outer.x2;
|
||||
|
||||
lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, blend_mode);
|
||||
}
|
||||
/*Process line by line if there is other mask too*/
|
||||
else {
|
||||
@@ -1382,10 +1392,10 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
fill_area.y2 = fill_area.y1;
|
||||
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
_lv_memset_ff(mask_buf, draw_area_w);
|
||||
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
|
||||
|
||||
lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||
_lv_blend_fill(clip, &fill_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||
fill_area.y1++;
|
||||
fill_area.y2++;
|
||||
|
||||
@@ -1393,7 +1403,7 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
}
|
||||
lv_draw_mask_remove_id(mask_rin_id);
|
||||
lv_draw_mask_remove_id(mask_rout_id);
|
||||
lv_mem_buf_release(mask_buf);
|
||||
_lv_mem_buf_release(mask_buf);
|
||||
}
|
||||
|
||||
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
|
||||
@@ -1430,8 +1440,8 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
label_dsc.font = dsc->pattern_font;
|
||||
label_dsc.opa = dsc->pattern_opa;
|
||||
lv_point_t s;
|
||||
lv_txt_get_size(&s, dsc->pattern_image, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
|
||||
LV_TXT_FLAG_NONE);
|
||||
_lv_txt_get_size(&s, dsc->pattern_image, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
|
||||
LV_TXT_FLAG_NONE);
|
||||
img_w = s.x;
|
||||
img_h = s.y;
|
||||
|
||||
@@ -1484,7 +1494,7 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_dr
|
||||
}
|
||||
|
||||
int16_t radius_mask_id = LV_MASK_ID_INV;
|
||||
if(lv_area_is_in(&coords_tmp, coords, dsc->radius) == false) {
|
||||
if(_lv_area_is_in(&coords_tmp, coords, dsc->radius) == false) {
|
||||
lv_draw_mask_radius_param_t radius_mask_param;
|
||||
lv_draw_mask_radius_init(&radius_mask_param, coords, dsc->radius, false);
|
||||
radius_mask_id = lv_draw_mask_add(&radius_mask_param, NULL);
|
||||
@@ -1504,8 +1514,8 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
|
||||
if(dsc->value_opa <= LV_OPA_MIN) return;
|
||||
|
||||
lv_point_t s;
|
||||
lv_txt_get_size(&s, dsc->value_str, dsc->value_font, dsc->value_letter_space, dsc->value_line_space, LV_COORD_MAX,
|
||||
LV_TXT_FLAG_NONE);
|
||||
_lv_txt_get_size(&s, dsc->value_str, dsc->value_font, dsc->value_letter_space, dsc->value_line_space, LV_COORD_MAX,
|
||||
LV_TXT_FLAG_NONE);
|
||||
|
||||
lv_area_t value_area;
|
||||
value_area.x1 = 0;
|
||||
@@ -1514,7 +1524,7 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
|
||||
value_area.y2 = s.y - 1;
|
||||
|
||||
lv_point_t p_align;
|
||||
lv_area_align(coords, &value_area, dsc->value_align, &p_align);
|
||||
_lv_area_align(coords, &value_area, dsc->value_align, &p_align);
|
||||
|
||||
value_area.x1 += p_align.x + dsc->value_ofs_x;
|
||||
value_area.y1 += p_align.y + dsc->value_ofs_y;
|
||||
|
||||
@@ -86,6 +86,8 @@ typedef struct {
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Draw a rectangle
|
||||
* @param coords the coordinates of the rectangle
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* @param clip_area the triangle will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip_area, lv_draw_rect_dsc_t * draw_dsc)
|
||||
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, lv_draw_rect_dsc_t * draw_dsc)
|
||||
{
|
||||
lv_draw_polygon(points, 3, clip_area, draw_dsc);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip_area, lv
|
||||
* @param clip_area polygon will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_area_t * clip_area,
|
||||
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * clip_area,
|
||||
lv_draw_rect_dsc_t * draw_dsc)
|
||||
{
|
||||
if(point_cnt < 3) return;
|
||||
@@ -71,7 +71,7 @@ void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_are
|
||||
|
||||
bool is_common;
|
||||
lv_area_t poly_mask;
|
||||
is_common = lv_area_intersect(&poly_mask, &poly_coords, clip_area);
|
||||
is_common = _lv_area_intersect(&poly_mask, &poly_coords, clip_area);
|
||||
if(!is_common) return;
|
||||
|
||||
/*Find the lowest point*/
|
||||
@@ -85,7 +85,7 @@ void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_are
|
||||
}
|
||||
}
|
||||
|
||||
lv_draw_mask_line_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_line_param_t) * point_cnt);
|
||||
lv_draw_mask_line_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_line_param_t) * point_cnt);
|
||||
lv_draw_mask_line_param_t * mp_next = mp;
|
||||
|
||||
int32_t i_prev_left = y_min_i;
|
||||
@@ -156,7 +156,7 @@ void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_are
|
||||
|
||||
lv_draw_mask_remove_custom(mp);
|
||||
|
||||
lv_mem_buf_release(mp);
|
||||
_lv_mem_buf_release(mp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ extern "C" {
|
||||
* @param clip_area the triangle will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip, lv_draw_rect_dsc_t * draw_dsc);
|
||||
void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, lv_draw_rect_dsc_t * draw_dsc);
|
||||
|
||||
/**
|
||||
* Draw a polygon. Only convex polygons are supported.
|
||||
@@ -42,7 +42,7 @@ void lv_draw_triangle(const lv_point_t * points, const lv_area_t * clip, lv_draw
|
||||
* @param clip_area polygon will be drawn only in this area
|
||||
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
|
||||
*/
|
||||
void lv_draw_polygon(const lv_point_t * points, uint16_t point_cnt, const lv_area_t * mask,
|
||||
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask,
|
||||
lv_draw_rect_dsc_t * draw_dsc);
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static inline bool transform_anti_alias(lv_img_transform_dsc_t * dsc);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -59,7 +58,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||
_lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||
#if LV_COLOR_SIZE == 32
|
||||
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a deafult alpha value*/
|
||||
#endif
|
||||
@@ -246,12 +245,12 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&buf_u8[px], &c, px_size);
|
||||
_lv_memcpy_small(&buf_u8[px], &c, px_size);
|
||||
}
|
||||
else if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
|
||||
_lv_memcpy_small(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
|
||||
}
|
||||
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
|
||||
buf_u8 += sizeof(lv_color32_t) * 2; /*Skip the palette*/
|
||||
@@ -319,7 +318,7 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
lv_color32_t c32;
|
||||
c32.full = lv_color_to32(c);
|
||||
uint8_t * buf = (uint8_t *)dsc->data;
|
||||
lv_memcpy_small(&buf[id * sizeof(c32)], &c32, sizeof(c32));
|
||||
_lv_memcpy_small(&buf[id * sizeof(c32)], &c32, sizeof(c32));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -336,7 +335,7 @@ lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
if(dsc == NULL)
|
||||
return NULL;
|
||||
|
||||
lv_memset_00(dsc, sizeof(lv_img_dsc_t));
|
||||
_lv_memset_00(dsc, sizeof(lv_img_dsc_t));
|
||||
|
||||
/* Get image data size */
|
||||
dsc->data_size = lv_img_buf_get_img_size(w, h, cf);
|
||||
@@ -351,7 +350,7 @@ lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
lv_mem_free(dsc);
|
||||
return NULL;
|
||||
}
|
||||
lv_memset_00((uint8_t *)dsc->data, dsc->data_size);
|
||||
_lv_memset_00((uint8_t *)dsc->data, dsc->data_size);
|
||||
|
||||
/* Fill in header */
|
||||
dsc->header.always_zero = 0;
|
||||
@@ -412,11 +411,13 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
/**
|
||||
* Initialize a descriptor to tranform an image
|
||||
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
|
||||
*/
|
||||
void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
{
|
||||
dsc->tmp.pivot_x_256 = dsc->cfg.pivot_x * 256;
|
||||
dsc->tmp.pivot_y_256 = dsc->cfg.pivot_y * 256;
|
||||
@@ -425,11 +426,11 @@ void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
int32_t angle_hight = angle_low + 1;
|
||||
int32_t angle_rem = dsc->cfg.angle - (angle_low * 10);
|
||||
|
||||
int32_t s1 = lv_trigo_sin(-angle_low);
|
||||
int32_t s2 = lv_trigo_sin(-angle_hight);
|
||||
int32_t s1 = _lv_trigo_sin(-angle_low);
|
||||
int32_t s2 = _lv_trigo_sin(-angle_hight);
|
||||
|
||||
int32_t c1 = lv_trigo_sin(-angle_low + 90);
|
||||
int32_t c2 = lv_trigo_sin(-angle_hight + 90);
|
||||
int32_t c1 = _lv_trigo_sin(-angle_low + 90);
|
||||
int32_t c2 = _lv_trigo_sin(-angle_hight + 90);
|
||||
|
||||
dsc->tmp.sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
|
||||
dsc->tmp.cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
|
||||
@@ -455,93 +456,7 @@ void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
|
||||
dsc->res.opa = LV_OPA_COVER;
|
||||
dsc->res.color = dsc->cfg.color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which color and opa would come to a pixel if it were rotated
|
||||
* @param dsc a descriptor initialized by `lv_img_buf_rotate_init`
|
||||
* @param x the coordinate which color and opa should be get
|
||||
* @param y the coordinate which color and opa should be get
|
||||
* @return true: there is valid pixel on these x/y coordinates; false: the rotated pixel was out of the image
|
||||
* @note the result is written back to `dsc->res_color` and `dsc->res_opa`
|
||||
*/
|
||||
bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
const uint8_t * src_u8 = dsc->cfg.src;
|
||||
|
||||
/*Get the target point relative coordinates to the pivot*/
|
||||
int32_t xt = x - dsc->cfg.pivot_x;
|
||||
int32_t yt = y - dsc->cfg.pivot_y;
|
||||
|
||||
int32_t xs;
|
||||
int32_t ys;
|
||||
if(dsc->cfg.zoom == LV_IMG_ZOOM_NONE) {
|
||||
/*Get the source pixel from the upscaled image*/
|
||||
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (LV_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_x_256;
|
||||
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (LV_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
else {
|
||||
xt *= dsc->tmp.zoom_inv;
|
||||
yt *= dsc->tmp.zoom_inv;
|
||||
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (LV_TRIGO_SHIFT)) + dsc->tmp.pivot_x_256;
|
||||
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (LV_TRIGO_SHIFT)) + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
|
||||
/*Get the integer part of the source pixel*/
|
||||
int xs_int = xs >> 8;
|
||||
int ys_int = ys >> 8;
|
||||
|
||||
if(xs_int >= dsc->cfg.src_w) return false;
|
||||
else if(xs_int < 0) return false;
|
||||
|
||||
if(ys_int >= dsc->cfg.src_h) return false;
|
||||
else if(ys_int < 0) return false;
|
||||
|
||||
/* If the fractional < 0x70 mix the source pixel with the left/top pixel
|
||||
* If the fractional > 0x90 mix the source pixel with the right/bottom pixel
|
||||
* In the 0x70..0x90 range use the unchanged source pixel */
|
||||
|
||||
uint8_t px_size;
|
||||
uint32_t pxi;
|
||||
if(dsc->tmp.native_color) {
|
||||
if(dsc->tmp.has_alpha == 0) {
|
||||
px_size = LV_COLOR_SIZE >> 3;
|
||||
|
||||
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
|
||||
lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size);
|
||||
}
|
||||
else {
|
||||
px_size = LV_IMG_PX_SIZE_ALPHA_BYTE;
|
||||
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
|
||||
lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size - 1);
|
||||
dsc->res.opa = src_u8[pxi + px_size - 1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
pxi = 0; /*unused*/
|
||||
px_size = 0; /*unused*/
|
||||
dsc->res.color = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, xs_int, ys_int, dsc->cfg.color);
|
||||
dsc->res.opa = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, xs_int, ys_int);
|
||||
}
|
||||
|
||||
if(dsc->tmp.chroma_keyed) {
|
||||
lv_color_t ct = LV_COLOR_TRANSP;
|
||||
if(dsc->res.color.full == ct.full) return false;
|
||||
}
|
||||
|
||||
if(dsc->cfg.antialias == false) return true;
|
||||
|
||||
dsc->tmp.xs = xs;
|
||||
dsc->tmp.ys = ys;
|
||||
dsc->tmp.xs_int = xs_int;
|
||||
dsc->tmp.ys_int = ys_int;
|
||||
dsc->tmp.pxi = pxi;
|
||||
dsc->tmp.px_size = px_size;
|
||||
|
||||
bool ret;
|
||||
ret = transform_anti_alias(dsc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the area of a rectangle if its rotated and scaled
|
||||
@@ -552,19 +467,19 @@ bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
* @param zoom zoom, (256 no zoom)
|
||||
* @param pivot x,y pivot coordinates of rotation
|
||||
*/
|
||||
void lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
|
||||
lv_point_t * pivot)
|
||||
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
|
||||
lv_point_t * pivot)
|
||||
{
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
int32_t angle_low = angle / 10;
|
||||
int32_t angle_hight = angle_low + 1;
|
||||
int32_t angle_rem = angle - (angle_low * 10);
|
||||
|
||||
int32_t s1 = lv_trigo_sin(angle_low);
|
||||
int32_t s2 = lv_trigo_sin(angle_hight);
|
||||
int32_t s1 = _lv_trigo_sin(angle_low);
|
||||
int32_t s2 = _lv_trigo_sin(angle_hight);
|
||||
|
||||
int32_t c1 = lv_trigo_sin(angle_low + 90);
|
||||
int32_t c2 = lv_trigo_sin(angle_hight + 90);
|
||||
int32_t c1 = _lv_trigo_sin(angle_low + 90);
|
||||
int32_t c2 = _lv_trigo_sin(angle_hight + 90);
|
||||
|
||||
int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
|
||||
int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
|
||||
@@ -607,13 +522,20 @@ void lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h
|
||||
res->x2 = LV_MATH_MAX4(lb.x, lt.x, rb.x, rt.x);
|
||||
res->y1 = LV_MATH_MIN4(lb.y, lt.y, rb.y, rt.y);
|
||||
res->y2 = LV_MATH_MAX4(lb.y, lt.y, rb.y, rt.y);
|
||||
|
||||
#else
|
||||
res->x1 = 0;
|
||||
res->y1 = 0;
|
||||
res->x2 = w;
|
||||
res->y2 = h;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
static inline bool transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
/**
|
||||
* Continue transformation by taking the neighbors into account
|
||||
* @param dsc pointer to the transformation descriptor
|
||||
*/
|
||||
bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
{
|
||||
const uint8_t * src_u8 = dsc->cfg.src;
|
||||
|
||||
@@ -669,10 +591,10 @@ static inline bool transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
lv_opa_t a11 = 0;
|
||||
|
||||
if(dsc->tmp.native_color) {
|
||||
lv_memcpy_small(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
|
||||
lv_memcpy_small(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
|
||||
lv_memcpy_small(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
|
||||
sizeof(lv_color_t));
|
||||
_lv_memcpy_small(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
|
||||
_lv_memcpy_small(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
|
||||
_lv_memcpy_small(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
|
||||
sizeof(lv_color_t));
|
||||
if(dsc->tmp.has_alpha) {
|
||||
a10 = src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
|
||||
a01 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size - 1];
|
||||
@@ -728,3 +650,8 @@ static inline bool transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ extern "C" {
|
||||
#define LV_IMG_PX_SIZE_ALPHA_BYTE 4
|
||||
#endif
|
||||
|
||||
|
||||
#define LV_IMG_BUF_SIZE_TRUE_COLOR(w, h) ((LV_COLOR_SIZE / 8) * w * h)
|
||||
#define LV_IMG_BUF_SIZE_TRUE_COLOR_CHROMA_KEYED(w, h) ((LV_COLOR_SIZE / 8) * w * h)
|
||||
#define LV_IMG_BUF_SIZE_TRUE_COLOR_ALPHA(w, h) (LV_IMG_PX_SIZE_ALPHA_BYTE * w * h)
|
||||
@@ -101,7 +100,7 @@ typedef uint8_t lv_img_cf_t;
|
||||
|
||||
|
||||
/**
|
||||
* LittlevGL image header
|
||||
* LVGL image header
|
||||
*/
|
||||
typedef struct {
|
||||
|
||||
@@ -252,11 +251,19 @@ void lv_img_buf_free(lv_img_dsc_t * dsc);
|
||||
uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf);
|
||||
|
||||
|
||||
#if LV_USE_IMG_TRANSFORM
|
||||
/**
|
||||
* Initialize a descriptor to rotate an image
|
||||
* @param dsc pointer to an `lv_img_transform_dsc_t` variable whose `cfg` field is initialized
|
||||
*/
|
||||
void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc);
|
||||
void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc);
|
||||
|
||||
/**
|
||||
* Continue transformation by taking the neighbors into account
|
||||
* @param dsc pointer to the transformation descriptor
|
||||
*/
|
||||
bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc);
|
||||
|
||||
|
||||
/**
|
||||
* Get which color and opa would come to a pixel if it were rotated
|
||||
@@ -266,8 +273,87 @@ void lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc);
|
||||
* @return true: there is valid pixel on these x/y coordinates; false: the rotated pixel was out of the image
|
||||
* @note the result is written back to `dsc->res_color` and `dsc->res_opa`
|
||||
*/
|
||||
bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t y);
|
||||
static inline bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
const uint8_t * src_u8 = (const uint8_t *)dsc->cfg.src;
|
||||
|
||||
/*Get the target point relative coordinates to the pivot*/
|
||||
int32_t xt = x - dsc->cfg.pivot_x;
|
||||
int32_t yt = y - dsc->cfg.pivot_y;
|
||||
|
||||
int32_t xs;
|
||||
int32_t ys;
|
||||
if(dsc->cfg.zoom == LV_IMG_ZOOM_NONE) {
|
||||
/*Get the source pixel from the upscaled image*/
|
||||
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (LV_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_x_256;
|
||||
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (LV_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
else if(dsc->cfg.angle == 0) {
|
||||
xt *= dsc->tmp.zoom_inv;
|
||||
yt *= dsc->tmp.zoom_inv;
|
||||
xs = xt + dsc->tmp.pivot_x_256;
|
||||
ys = yt + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
else {
|
||||
xt *= dsc->tmp.zoom_inv;
|
||||
yt *= dsc->tmp.zoom_inv;
|
||||
xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (LV_TRIGO_SHIFT)) + dsc->tmp.pivot_x_256;
|
||||
ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (LV_TRIGO_SHIFT)) + dsc->tmp.pivot_y_256;
|
||||
}
|
||||
|
||||
/*Get the integer part of the source pixel*/
|
||||
int32_t xs_int = xs >> 8;
|
||||
int32_t ys_int = ys >> 8;
|
||||
|
||||
if(xs_int >= dsc->cfg.src_w) return false;
|
||||
else if(xs_int < 0) return false;
|
||||
|
||||
if(ys_int >= dsc->cfg.src_h) return false;
|
||||
else if(ys_int < 0) return false;
|
||||
|
||||
uint8_t px_size;
|
||||
uint32_t pxi;
|
||||
if(dsc->tmp.native_color) {
|
||||
if(dsc->tmp.has_alpha == 0) {
|
||||
px_size = LV_COLOR_SIZE >> 3;
|
||||
|
||||
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
|
||||
_lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size);
|
||||
}
|
||||
else {
|
||||
px_size = LV_IMG_PX_SIZE_ALPHA_BYTE;
|
||||
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
|
||||
_lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size - 1);
|
||||
dsc->res.opa = src_u8[pxi + px_size - 1];
|
||||
}
|
||||
}
|
||||
else {
|
||||
pxi = 0; /*unused*/
|
||||
px_size = 0; /*unused*/
|
||||
dsc->res.color = lv_img_buf_get_px_color(&dsc->tmp.img_dsc, xs_int, ys_int, dsc->cfg.color);
|
||||
dsc->res.opa = lv_img_buf_get_px_alpha(&dsc->tmp.img_dsc, xs_int, ys_int);
|
||||
}
|
||||
|
||||
if(dsc->tmp.chroma_keyed) {
|
||||
lv_color_t ct = LV_COLOR_TRANSP;
|
||||
if(dsc->res.color.full == ct.full) return false;
|
||||
}
|
||||
|
||||
if(dsc->cfg.antialias == false) return true;
|
||||
|
||||
dsc->tmp.xs = xs;
|
||||
dsc->tmp.ys = ys;
|
||||
dsc->tmp.xs_int = xs_int;
|
||||
dsc->tmp.ys_int = ys_int;
|
||||
dsc->tmp.pxi = pxi;
|
||||
dsc->tmp.px_size = px_size;
|
||||
|
||||
bool ret;
|
||||
ret = _lv_img_buf_transform_anti_alias(dsc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Get the area of a rectangle if its rotated and scaled
|
||||
* @param res store the coordinates here
|
||||
@@ -277,8 +363,8 @@ bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
* @param zoom zoom, (256 no zoom)
|
||||
* @param pivot x,y pivot coordinates of rotation
|
||||
*/
|
||||
void lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
|
||||
lv_point_t * pivot);
|
||||
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
|
||||
lv_point_t * pivot);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -62,7 +62,7 @@ static uint16_t entry_cnt;
|
||||
* @param style style of the image
|
||||
* @return pointer to the cache entry or NULL if can open the image
|
||||
*/
|
||||
lv_img_cache_entry_t * lv_img_cache_open(const void * src, lv_color_t color)
|
||||
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
|
||||
{
|
||||
if(entry_cnt == 0) {
|
||||
LV_LOG_WARN("lv_img_cache_open: the cache size is 0");
|
||||
@@ -130,8 +130,8 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, lv_color_t color)
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_img_decoder_close(&cached_src->dec_dsc);
|
||||
lv_memset_00(&cached_src->dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
|
||||
_lv_memset_00(&cached_src->dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
|
||||
return NULL;
|
||||
}
|
||||
@@ -175,8 +175,8 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
|
||||
/*Clean the cache*/
|
||||
uint16_t i;
|
||||
for(i = 0; i < entry_cnt; i++) {
|
||||
lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i], sizeof(lv_img_cache_entry_t));
|
||||
_lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i], sizeof(lv_img_cache_entry_t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,8 +197,8 @@ void lv_img_cache_invalidate_src(const void * src)
|
||||
lv_img_decoder_close(&cache[i].dec_dsc);
|
||||
}
|
||||
|
||||
lv_memset_00(&cache[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
lv_memset_00(&cache[i], sizeof(lv_img_cache_entry_t));
|
||||
_lv_memset_00(&cache[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(&cache[i], sizeof(lv_img_cache_entry_t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct {
|
||||
* @param style style of the image
|
||||
* @return pointer to the cache entry or NULL if can open the image
|
||||
*/
|
||||
lv_img_cache_entry_t * lv_img_cache_open(const void * src, lv_color_t color);
|
||||
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color);
|
||||
|
||||
/**
|
||||
* Set the number of images to be cached.
|
||||
|
||||
@@ -59,9 +59,9 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
/**
|
||||
* Initialize the image decoder module
|
||||
* */
|
||||
void lv_img_decoder_init(void)
|
||||
void _lv_img_decoder_init(void)
|
||||
{
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_img_defoder_ll), sizeof(lv_img_decoder_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_img_defoder_ll), sizeof(lv_img_decoder_t));
|
||||
|
||||
lv_img_decoder_t * decoder;
|
||||
|
||||
@@ -92,7 +92,7 @@ lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
|
||||
|
||||
lv_res_t res = LV_RES_INV;
|
||||
lv_img_decoder_t * d;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) {
|
||||
res = LV_RES_INV;
|
||||
if(d->info_cb) {
|
||||
res = d->info_cb(d, src, header);
|
||||
@@ -133,7 +133,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
lv_res_t res = LV_RES_INV;
|
||||
|
||||
lv_img_decoder_t * d;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_img_defoder_ll), d) {
|
||||
/*Info an Open callbacks are required*/
|
||||
if(d->info_cb == NULL || d->open_cb == NULL) continue;
|
||||
|
||||
@@ -151,7 +151,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
}
|
||||
|
||||
if(res == LV_RES_INV) {
|
||||
lv_memset_00(dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
_lv_memset_00(dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -197,11 +197,11 @@ void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc)
|
||||
lv_img_decoder_t * lv_img_decoder_create(void)
|
||||
{
|
||||
lv_img_decoder_t * decoder;
|
||||
decoder = lv_ll_ins_head(&LV_GC_ROOT(_lv_img_defoder_ll));
|
||||
decoder = _lv_ll_ins_head(&LV_GC_ROOT(_lv_img_defoder_ll));
|
||||
LV_ASSERT_MEM(decoder);
|
||||
if(decoder == NULL) return NULL;
|
||||
|
||||
lv_memset_00(decoder, sizeof(lv_img_decoder_t));
|
||||
_lv_memset_00(decoder, sizeof(lv_img_decoder_t));
|
||||
|
||||
return decoder;
|
||||
}
|
||||
@@ -212,7 +212,7 @@ lv_img_decoder_t * lv_img_decoder_create(void)
|
||||
*/
|
||||
void lv_img_decoder_delete(lv_img_decoder_t * decoder)
|
||||
{
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_img_defoder_ll), decoder);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_img_defoder_ll), decoder);
|
||||
lv_mem_free(decoder);
|
||||
}
|
||||
|
||||
@@ -341,7 +341,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
_lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
}
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
@@ -353,7 +353,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
lv_memcpy_small(user_data->f, &f, sizeof(f));
|
||||
_lv_memcpy_small(user_data->f, &f, sizeof(f));
|
||||
|
||||
#else
|
||||
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
|
||||
@@ -399,7 +399,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
lv_img_decoder_built_in_close(decoder, dsc);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
_lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
}
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
@@ -639,7 +639,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
uint8_t * fs_buf = lv_mem_buf_get(w);
|
||||
uint8_t * fs_buf = _lv_mem_buf_get(w);
|
||||
#endif
|
||||
|
||||
const uint8_t * data_tmp = NULL;
|
||||
@@ -673,7 +673,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
||||
}
|
||||
}
|
||||
#if LV_USE_FILESYSTEM
|
||||
lv_mem_buf_release(fs_buf);
|
||||
_lv_mem_buf_release(fs_buf);
|
||||
#endif
|
||||
return LV_RES_OK;
|
||||
|
||||
@@ -727,7 +727,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
|
||||
#if LV_USE_FILESYSTEM
|
||||
uint8_t * fs_buf = lv_mem_buf_get(w);
|
||||
uint8_t * fs_buf = _lv_mem_buf_get(w);
|
||||
#endif
|
||||
const uint8_t * data_tmp = NULL;
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
@@ -771,7 +771,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
}
|
||||
}
|
||||
#if LV_USE_FILESYSTEM
|
||||
lv_mem_buf_release(fs_buf);
|
||||
_lv_mem_buf_release(fs_buf);
|
||||
#endif
|
||||
return LV_RES_OK;
|
||||
#else
|
||||
|
||||
@@ -135,7 +135,7 @@ typedef struct _lv_img_decoder_dsc {
|
||||
/**
|
||||
* Initialize the image decoder module
|
||||
*/
|
||||
void lv_img_decoder_init(void);
|
||||
void _lv_img_decoder_init(void);
|
||||
|
||||
/**
|
||||
* Get information about an image.
|
||||
@@ -221,8 +221,6 @@ void lv_img_decoder_set_read_line_cb(lv_img_decoder_t * decoder, lv_img_decoder_
|
||||
*/
|
||||
void lv_img_decoder_set_close_cb(lv_img_decoder_t * decoder, lv_img_decoder_close_f_t close_cb);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get info about a built-in image
|
||||
* @param decoder the decoder where this function belongs
|
||||
|
||||
@@ -22,7 +22,7 @@ CSRCS += lv_font_montserrat_48.c
|
||||
CSRCS += lv_font_montserrat_12_subpx.c
|
||||
CSRCS += lv_font_montserrat_28_compressed.c
|
||||
CSRCS += lv_font_unscii_8.c
|
||||
CSRCS += lv_font_ap_18.c
|
||||
CSRCS += lv_font_dejavu_16_persian_hebrew.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font
|
||||
|
||||
@@ -40,6 +40,7 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element);
|
||||
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp);
|
||||
static inline void decompress_line(uint8_t * out, lv_coord_t w);
|
||||
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len);
|
||||
static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint8_t len);
|
||||
static inline void rle_init(const uint8_t * in, uint8_t bpp);
|
||||
static inline uint8_t rle_next(void);
|
||||
|
||||
@@ -47,7 +48,7 @@ static inline uint8_t rle_next(void);
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static uint8_t * decompr_buf;
|
||||
static uint32_t rle_rdp;
|
||||
static const uint8_t * rle_in;
|
||||
static uint8_t rle_bpp;
|
||||
@@ -88,19 +89,34 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
||||
}
|
||||
/*Handle compressed bitmap*/
|
||||
else {
|
||||
static uint8_t * buf = NULL;
|
||||
|
||||
uint32_t gsize = gdsc->box_w * gdsc->box_h;
|
||||
if(gsize == 0) return NULL;
|
||||
|
||||
if(lv_mem_get_size(buf) < gsize) {
|
||||
buf = lv_mem_realloc(buf, gsize);
|
||||
LV_ASSERT_MEM(buf);
|
||||
if(buf == NULL) return NULL;
|
||||
uint32_t buf_size = gsize;
|
||||
/*Compute memory size needed to hold decompressed glyph, rounding up*/
|
||||
switch(fdsc->bpp) {
|
||||
case 1:
|
||||
buf_size = (gsize + 7) >> 3;
|
||||
break;
|
||||
case 2:
|
||||
buf_size = (gsize + 3) >> 2;
|
||||
break;
|
||||
case 3:
|
||||
buf_size = (gsize + 1) >> 1;
|
||||
break;
|
||||
case 4:
|
||||
buf_size = (gsize + 1) >> 1;
|
||||
break;
|
||||
}
|
||||
|
||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp);
|
||||
return buf;
|
||||
if(_lv_mem_get_size(decompr_buf) < buf_size) {
|
||||
decompr_buf = lv_mem_realloc(decompr_buf, buf_size);
|
||||
LV_ASSERT_MEM(decompr_buf);
|
||||
if(decompr_buf == NULL) return NULL;
|
||||
}
|
||||
|
||||
decompress(&fdsc->glyph_bitmap[gdsc->bitmap_index], decompr_buf, gdsc->box_w, gdsc->box_h, (uint8_t)fdsc->bpp);
|
||||
return decompr_buf;
|
||||
}
|
||||
|
||||
/*If not returned earlier then the letter is not found in this font*/
|
||||
@@ -151,13 +167,25 @@ bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t *
|
||||
dsc_out->box_w = gdsc->box_w;
|
||||
dsc_out->ofs_x = gdsc->ofs_x;
|
||||
dsc_out->ofs_y = gdsc->ofs_y;
|
||||
dsc_out->bpp = fdsc->bitmap_format == LV_FONT_FMT_TXT_PLAIN ? (uint8_t)fdsc->bpp : 8;
|
||||
dsc_out->bpp = (uint8_t)fdsc->bpp;
|
||||
|
||||
if(is_tab) dsc_out->box_w = dsc_out->box_w * 2;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free the allocated memories.
|
||||
*/
|
||||
void _lv_font_clean_up_fmt_txt(void)
|
||||
{
|
||||
if(decompr_buf) {
|
||||
lv_mem_free(decompr_buf);
|
||||
decompr_buf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -186,8 +214,8 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
|
||||
glyph_id = fdsc->cmaps[i].glyph_id_start + gid_ofs_8[rcp];
|
||||
}
|
||||
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_TINY) {
|
||||
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
||||
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||
uint8_t * p = _lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
||||
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||
|
||||
if(p) {
|
||||
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
|
||||
@@ -196,8 +224,8 @@ static uint32_t get_glyph_dsc_id(const lv_font_t * font, uint32_t letter)
|
||||
}
|
||||
}
|
||||
else if(fdsc->cmaps[i].type == LV_FONT_FMT_TXT_CMAP_SPARSE_FULL) {
|
||||
uint8_t * p = lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
||||
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||
uint8_t * p = _lv_utils_bsearch(&rcp, fdsc->cmaps[i].unicode_list, fdsc->cmaps[i].list_length,
|
||||
sizeof(fdsc->cmaps[i].unicode_list[0]), unicode_list_compare);
|
||||
|
||||
if(p) {
|
||||
lv_uintptr_t ofs = (lv_uintptr_t)(p - (uint8_t *) fdsc->cmaps[i].unicode_list);
|
||||
@@ -233,7 +261,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t
|
||||
* The pairs are ordered left_id first, then right_id secondly. */
|
||||
const uint8_t * g_ids = kdsc->glyph_ids;
|
||||
uint16_t g_id_both = (gid_right << 8) + gid_left; /*Create one number from the ids*/
|
||||
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
|
||||
uint8_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 2, kern_pair_8_compare);
|
||||
|
||||
/*If the `g_id_both` were found get its index from the pointer*/
|
||||
if(kid_p) {
|
||||
@@ -247,7 +275,7 @@ static int8_t get_kern_value(const lv_font_t * font, uint32_t gid_left, uint32_t
|
||||
* The pairs are ordered left_id first, then right_id secondly. */
|
||||
const uint16_t * g_ids = kdsc->glyph_ids;
|
||||
lv_uintptr_t g_id_both = (uint32_t)((uint32_t)gid_right << 8) + gid_left; /*Create one number from the ids*/
|
||||
uint8_t * kid_p = lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
|
||||
uint8_t * kid_p = _lv_utils_bsearch(&g_id_both, g_ids, kdsc->pair_cnt, 4, kern_pair_16_compare);
|
||||
|
||||
/*If the `g_id_both` were found get its index from the pointer*/
|
||||
if(kid_p) {
|
||||
@@ -307,32 +335,14 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element)
|
||||
*/
|
||||
static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp)
|
||||
{
|
||||
uint32_t wrp = 0;
|
||||
uint8_t wr_size = bpp;
|
||||
if(bpp == 3) wr_size = 4;
|
||||
|
||||
rle_init(in, bpp);
|
||||
|
||||
const uint8_t * bpp_opa_table;
|
||||
switch(bpp) {
|
||||
case 1:
|
||||
bpp_opa_table = _lv_bpp1_opa_table;
|
||||
break;
|
||||
case 2:
|
||||
bpp_opa_table = _lv_bpp2_opa_table;
|
||||
break;
|
||||
case 3:
|
||||
bpp_opa_table = _lv_bpp3_opa_table;
|
||||
break;
|
||||
case 4:
|
||||
bpp_opa_table = _lv_bpp4_opa_table;
|
||||
break;
|
||||
case 8:
|
||||
bpp_opa_table = _lv_bpp8_opa_table;
|
||||
break;
|
||||
default:
|
||||
LV_LOG_WARN("Invalid bpp (%d)", bpp);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t * line_buf1 = lv_mem_buf_get(w);
|
||||
uint8_t * line_buf2 = lv_mem_buf_get(w);
|
||||
uint8_t * line_buf1 = _lv_mem_buf_get(w);
|
||||
uint8_t * line_buf2 = _lv_mem_buf_get(w);
|
||||
|
||||
decompress_line(line_buf1, w);
|
||||
|
||||
@@ -340,8 +350,8 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
||||
lv_coord_t x;
|
||||
|
||||
for(x = 0; x < w; x++) {
|
||||
*out = bpp_opa_table[line_buf1[x]];
|
||||
out++;
|
||||
bits_write(out, wrp, line_buf1[x], bpp);
|
||||
wrp += wr_size;
|
||||
}
|
||||
|
||||
for(y = 1; y < h; y++) {
|
||||
@@ -349,13 +359,13 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord
|
||||
|
||||
for(x = 0; x < w; x++) {
|
||||
line_buf1[x] = line_buf2[x] ^ line_buf1[x];
|
||||
*out = bpp_opa_table[line_buf1[x]];
|
||||
out++;
|
||||
bits_write(out, wrp, line_buf1[x], bpp);
|
||||
wrp += wr_size;
|
||||
}
|
||||
}
|
||||
|
||||
lv_mem_buf_release(line_buf1);
|
||||
lv_mem_buf_release(line_buf2);
|
||||
_lv_mem_buf_release(line_buf1);
|
||||
_lv_mem_buf_release(line_buf2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,6 +423,55 @@ static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write `val` data to `bit_pos` position of `out`. The write can NOT cross byte boundary.
|
||||
* @param out buffer where to write
|
||||
* @param bit_pos bit index to write
|
||||
* @param val value to write
|
||||
* @param len length of bits to write from `val`. (Counted from the LSB).
|
||||
* @note `len == 3` will be converted to `len = 4` and `val` will be upscaled too
|
||||
*/
|
||||
static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint8_t len)
|
||||
{
|
||||
if(len == 3) {
|
||||
len = 4;
|
||||
switch(val) {
|
||||
case 0:
|
||||
val = 0;
|
||||
break;
|
||||
case 1:
|
||||
val = 2;
|
||||
break;
|
||||
case 2:
|
||||
val = 4;
|
||||
break;
|
||||
case 3:
|
||||
val = 6;
|
||||
break;
|
||||
case 4:
|
||||
val = 9;
|
||||
break;
|
||||
case 5:
|
||||
val = 11;
|
||||
break;
|
||||
case 6:
|
||||
val = 13;
|
||||
break;
|
||||
case 7:
|
||||
val = 15;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t byte_pos = bit_pos >> 3;
|
||||
bit_pos = bit_pos & 0x7;
|
||||
bit_pos = 8 - bit_pos - len;
|
||||
|
||||
uint8_t bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
|
||||
out[byte_pos] &= ((~bit_mask) << bit_pos);
|
||||
out[byte_pos] |= (val << bit_pos);
|
||||
}
|
||||
|
||||
static inline void rle_init(const uint8_t * in, uint8_t bpp)
|
||||
{
|
||||
rle_in = in;
|
||||
|
||||
@@ -59,7 +59,7 @@ typedef uint8_t lv_font_fmt_txt_cmap_type_t;
|
||||
|
||||
/* Map codepoints to a `glyph_dsc`s
|
||||
* Several formats are supported to optimize memory usage
|
||||
* See https://github.com/littlevgl/lv_font_conv/blob/master/doc/font_spec.md
|
||||
* See https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
|
||||
*/
|
||||
typedef struct {
|
||||
/** First Unicode character for this range */
|
||||
@@ -74,7 +74,7 @@ typedef struct {
|
||||
|
||||
/*
|
||||
According the specification there are 4 formats:
|
||||
https://github.com/littlevgl/lv_font_conv/blob/master/doc/font_spec.md
|
||||
https://github.com/lvgl/lv_font_conv/blob/master/doc/font_spec.md
|
||||
|
||||
For simplicity introduce "relative code point":
|
||||
rcp = codepoint - range_start
|
||||
@@ -218,6 +218,11 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t lett
|
||||
bool lv_font_get_glyph_dsc_fmt_txt(const lv_font_t * font, lv_font_glyph_dsc_t * dsc_out, uint32_t unicode_letter,
|
||||
uint32_t unicode_letter_next);
|
||||
|
||||
/**
|
||||
* Free the allocated memories.
|
||||
*/
|
||||
void _lv_font_clean_up_fmt_txt(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -10,28 +10,35 @@
|
||||
#include "../lv_core/lv_refr.h"
|
||||
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
#include "stm32f7xx_hal.h"
|
||||
|
||||
#if defined(STM32F4)
|
||||
#include "stm32f4xx_hal.h"
|
||||
#elif defined(STM32F7)
|
||||
#include "stm32f7xx_hal.h"
|
||||
#else
|
||||
#error "Not supported STM32 family to use DMA2D"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#if LV_COLOR_16_SWAP
|
||||
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
||||
#error "Can't use DMA2D with LV_COLOR_16_SWAP 1"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 8
|
||||
#error "Can't use DMA2D with LV_COLOR_DEPTH == 8"
|
||||
#error "Can't use DMA2D with LV_COLOR_DEPTH == 8"
|
||||
#endif
|
||||
|
||||
#if LV_COLOR_DEPTH == 16
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_RGB565
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_RGB565
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_RGB565
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_RGB565
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_ARGB8888
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_ARGB8888
|
||||
#define DMA2D_OUTPUT_FORMAT DMA2D_OUTPUT_ARGB8888
|
||||
#define DMA2D_INPUT_FORMAT DMA2D_INPUT_ARGB8888
|
||||
#else
|
||||
/*Can't use GPU with other formats*/
|
||||
/*Can't use GPU with other formats*/
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@@ -96,7 +103,8 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
|
||||
* @param fill_h height to fill in pixels
|
||||
* @note `buf_w - fill_w` is offset to the next line after fill
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
|
||||
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
@@ -124,7 +132,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
HAL_DMA2D_Init(&hdma2d);
|
||||
HAL_DMA2D_ConfigLayer(&hdma2d, 0);
|
||||
HAL_DMA2D_ConfigLayer(&hdma2d, 1);
|
||||
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
|
||||
HAL_DMA2D_BlendingStart(&hdma2d, (uint32_t) mask, (uint32_t) buf, (uint32_t)buf, fill_w, fill_h);
|
||||
dma2d_wait();
|
||||
}
|
||||
|
||||
@@ -138,7 +146,8 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w,
|
||||
lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
@@ -152,7 +161,6 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
hdma2d.LayerCfg[1].InputAlpha = 0xFF;
|
||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
||||
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
|
||||
/* DMA2D Initialization */
|
||||
HAL_DMA2D_Init(&hdma2d);
|
||||
@@ -173,7 +181,8 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa,
|
||||
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
{
|
||||
invalidate_cache();
|
||||
|
||||
@@ -186,14 +195,12 @@ void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color
|
||||
hdma2d.LayerCfg[0].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
||||
hdma2d.LayerCfg[0].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[0].InputOffset = buf_w - copy_w;
|
||||
hdma2d.LayerCfg[0].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
|
||||
/* Foreground layer */
|
||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_COMBINE_ALPHA;
|
||||
hdma2d.LayerCfg[1].InputAlpha = opa;
|
||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
||||
hdma2d.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
|
||||
/* DMA2D Initialization */
|
||||
HAL_DMA2D_Init(&hdma2d);
|
||||
@@ -218,7 +225,7 @@ static void invalidate_cache(void)
|
||||
|
||||
static void dma2d_wait(void)
|
||||
{
|
||||
lv_disp_t * disp = lv_refr_get_disp_refreshing();
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
while(HAL_DMA2D_PollForTransfer(&hdma2d, 0) == HAL_TIMEOUT) {
|
||||
if(disp->driver.wait_cb) disp->driver.wait_cb(&disp->driver);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,8 @@ extern "C" {
|
||||
* @param fill_h height to fill in pixels
|
||||
* @note `buf_w - fill_w` is offset to the next line after fill
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w,
|
||||
lv_coord_t fill_h);
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,7 +52,8 @@ void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t colo
|
||||
* @param fill_h height to fill in pixels
|
||||
* @note `buf_w - fill_w` is offset to the next line after fill
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask,
|
||||
lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
|
||||
/**
|
||||
* Copy a map (typically RGB image) to a buffer
|
||||
@@ -63,7 +65,8 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w,
|
||||
lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
/**
|
||||
* Blend a map (e.g. ARGB image or RGB image with opacity) to a buffer
|
||||
* @param buf a buffer where `map` should be copied
|
||||
@@ -75,7 +78,8 @@ void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_
|
||||
* @param copy_h height of the area to copy in pixels
|
||||
* @note `map_w - fill_w` is offset to the next line after copy
|
||||
*/
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa,
|
||||
lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -56,7 +56,7 @@ static lv_disp_t * disp_def;
|
||||
*/
|
||||
void lv_disp_drv_init(lv_disp_drv_t * driver)
|
||||
{
|
||||
lv_memset_00(driver, sizeof(lv_disp_drv_t));
|
||||
_lv_memset_00(driver, sizeof(lv_disp_drv_t));
|
||||
|
||||
driver->flush_cb = NULL;
|
||||
driver->hor_res = LV_HOR_RES_MAX;
|
||||
@@ -89,7 +89,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
|
||||
/**
|
||||
* Initialize a display buffer
|
||||
* @param disp_buf pointer `lv_disp_buf_t` variable to initialize
|
||||
* @param buf1 A buffer to be used by LittlevGL to draw the image.
|
||||
* @param buf1 A buffer to be used by LVGL to draw the image.
|
||||
* Always has to specified and can't be NULL.
|
||||
* Can be an array allocated by the user. E.g. `static lv_color_t disp_buf1[1024 * 10]`
|
||||
* Or a memory address e.g. in external SRAM
|
||||
@@ -97,13 +97,13 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
|
||||
* (sending to the display) parallel.
|
||||
* In the `disp_drv->flush` you should use DMA or similar hardware to send
|
||||
* the image to the display in the background.
|
||||
* It lets LittlevGL to render next frame into the other buffer while previous is being
|
||||
* It lets LVGL to render next frame into the other buffer while previous is being
|
||||
* sent. Set to `NULL` if unused.
|
||||
* @param size_in_px_cnt size of the `buf1` and `buf2` in pixel count.
|
||||
*/
|
||||
void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt)
|
||||
{
|
||||
lv_memset_00(disp_buf, sizeof(lv_disp_buf_t));
|
||||
_lv_memset_00(disp_buf, sizeof(lv_disp_buf_t));
|
||||
|
||||
disp_buf->buf1 = buf1;
|
||||
disp_buf->buf2 = buf2;
|
||||
@@ -119,16 +119,16 @@ void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32
|
||||
*/
|
||||
lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
{
|
||||
lv_disp_t * disp = lv_ll_ins_head(&LV_GC_ROOT(_lv_disp_ll));
|
||||
lv_disp_t * disp = _lv_ll_ins_head(&LV_GC_ROOT(_lv_disp_ll));
|
||||
if(!disp) {
|
||||
LV_ASSERT_MEM(disp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t));
|
||||
lv_memset_00(&disp->inv_area_joined, sizeof(disp->inv_area_joined));
|
||||
lv_memset_00(&disp->inv_areas, sizeof(disp->inv_areas));
|
||||
lv_ll_init(&disp->scr_ll, sizeof(lv_obj_t));
|
||||
_lv_memset_00(disp, sizeof(lv_disp_t));
|
||||
_lv_memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t));
|
||||
|
||||
_lv_ll_init(&disp->scr_ll, sizeof(lv_obj_t));
|
||||
disp->last_activity_time = 0;
|
||||
|
||||
if(disp_def == NULL) disp_def = disp;
|
||||
@@ -137,7 +137,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
disp_def = disp; /*Temporarily change the default screen to create the default screens on the
|
||||
new display*/
|
||||
/*Create a refresh task*/
|
||||
disp->refr_task = lv_task_create(lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_REFR_TASK_PRIO, disp);
|
||||
disp->refr_task = lv_task_create(_lv_disp_refr_task, LV_DISP_DEF_REFR_PERIOD, LV_REFR_TASK_PRIO, disp);
|
||||
LV_ASSERT_MEM(disp->refr_task);
|
||||
if(disp->refr_task == NULL) return NULL;
|
||||
|
||||
@@ -171,7 +171,7 @@ void lv_disp_drv_update(lv_disp_t * disp, lv_disp_drv_t * new_drv)
|
||||
memcpy(&disp->driver, new_drv, sizeof(lv_disp_drv_t));
|
||||
|
||||
lv_obj_t * scr;
|
||||
LV_LL_READ(disp->scr_ll, scr) {
|
||||
_LV_LL_READ(disp->scr_ll, scr) {
|
||||
lv_obj_set_size(scr, lv_disp_get_hor_res(disp), lv_disp_get_ver_res(disp));
|
||||
}
|
||||
}
|
||||
@@ -195,10 +195,10 @@ void lv_disp_remove(lv_disp_t * disp)
|
||||
indev = lv_indev_get_next(indev);
|
||||
}
|
||||
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_disp_ll), disp);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_disp_ll), disp);
|
||||
lv_mem_free(disp);
|
||||
|
||||
if(was_default) lv_disp_set_default(lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll)));
|
||||
if(was_default) lv_disp_set_default(_lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,7 +274,7 @@ bool lv_disp_get_antialiasing(lv_disp_t * disp)
|
||||
uint32_t lv_disp_get_dpi(lv_disp_t * disp)
|
||||
{
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
if(disp == NULL) return 1; /*Do not return 0 because it might be a divider*/
|
||||
if(disp == NULL) return LV_DPI; /*Do not return 0 because it might be a divider*/
|
||||
return disp->driver.dpi;
|
||||
}
|
||||
|
||||
@@ -286,9 +286,14 @@ uint32_t lv_disp_get_dpi(lv_disp_t * disp)
|
||||
lv_disp_size_t lv_disp_get_size_category(lv_disp_t * disp)
|
||||
{
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
if(disp == NULL) return LV_DISP_SIZE_SMALL;
|
||||
|
||||
uint32_t w = lv_disp_get_hor_res(disp) * 10 / disp->driver.dpi;
|
||||
uint32_t w;
|
||||
if(disp == NULL) w = LV_HOR_RES_MAX;
|
||||
else w = lv_disp_get_hor_res(disp);
|
||||
|
||||
uint32_t dpi = lv_disp_get_dpi(disp);
|
||||
|
||||
w = w * 10 / dpi;
|
||||
|
||||
if(w < LV_DISP_SMALL_LIMIT) return LV_DISP_SIZE_SMALL;
|
||||
if(w < LV_DISP_MEDIUM_LIMIT) return LV_DISP_SIZE_MEDIUM;
|
||||
@@ -305,7 +310,7 @@ LV_ATTRIBUTE_FLUSH_READY void lv_disp_flush_ready(lv_disp_drv_t * disp_drv)
|
||||
/*If the screen is transparent initialize it when the flushing is ready*/
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp_drv->screen_transp) {
|
||||
lv_memset_00(disp_drv->buffer->buf_act, disp_drv->buffer->size * sizeof(lv_color32_t));
|
||||
_lv_memset_00(disp_drv->buffer->buf_act, disp_drv->buffer->size * sizeof(lv_color32_t));
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -333,9 +338,9 @@ LV_ATTRIBUTE_FLUSH_READY bool lv_disp_flush_is_last(lv_disp_drv_t * disp_drv)
|
||||
lv_disp_t * lv_disp_get_next(lv_disp_t * disp)
|
||||
{
|
||||
if(disp == NULL)
|
||||
return lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll));
|
||||
return _lv_ll_get_head(&LV_GC_ROOT(_lv_disp_ll));
|
||||
else
|
||||
return lv_ll_get_next(&LV_GC_ROOT(_lv_disp_ll), disp);
|
||||
return _lv_ll_get_next(&LV_GC_ROOT(_lv_disp_ll), disp);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -361,7 +366,7 @@ uint16_t lv_disp_get_inv_buf_size(lv_disp_t * disp)
|
||||
* Pop (delete) the last 'num' invalidated areas from the buffer
|
||||
* @param num number of areas to delete
|
||||
*/
|
||||
void lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num)
|
||||
void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num)
|
||||
{
|
||||
|
||||
if(disp->inv_p < num)
|
||||
|
||||
@@ -52,10 +52,12 @@ typedef struct {
|
||||
void * buf_act;
|
||||
uint32_t size; /*In pixel count*/
|
||||
lv_area_t area;
|
||||
volatile int flushing; /*1: flushing is in progress. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
volatile int flushing_last; /*1: It was the last chunk to flush. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
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 int
|
||||
flushing; /*1: flushing is in progress. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
volatile int
|
||||
flushing_last; /*1: It was the last chunk to flush. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
|
||||
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*/
|
||||
} lv_disp_buf_t;
|
||||
|
||||
/**
|
||||
@@ -67,7 +69,7 @@ typedef struct _disp_drv_t {
|
||||
lv_coord_t ver_res; /**< Vertical resolution. */
|
||||
|
||||
/** Pointer to a buffer initialized with `lv_disp_buf_init()`.
|
||||
* LittlevGL will use this buffer(s) to draw the screens contents */
|
||||
* LVGL will use this buffer(s) to draw the screens contents */
|
||||
lv_disp_buf_t * buffer;
|
||||
|
||||
#if LV_ANTIALIAS
|
||||
@@ -84,7 +86,7 @@ typedef struct _disp_drv_t {
|
||||
/** DPI (dot per inch) of the display.
|
||||
* Set to `LV_DPI` from `lv_Conf.h` by default.
|
||||
*/
|
||||
uint32_t dpi :10;
|
||||
uint32_t dpi : 10;
|
||||
|
||||
/** MANDATORY: Write the internal buffer (VDB) to the display. 'lv_disp_flush_ready()' has to be
|
||||
* called when finished */
|
||||
@@ -163,7 +165,7 @@ typedef enum {
|
||||
LV_DISP_SIZE_MEDIUM,
|
||||
LV_DISP_SIZE_LARGE,
|
||||
LV_DISP_SIZE_EXTRA_LARGE,
|
||||
}lv_disp_size_t;
|
||||
} lv_disp_size_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@@ -180,7 +182,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver);
|
||||
/**
|
||||
* Initialize a display buffer
|
||||
* @param disp_buf pointer `lv_disp_buf_t` variable to initialize
|
||||
* @param buf1 A buffer to be used by LittlevGL to draw the image.
|
||||
* @param buf1 A buffer to be used by LVGL to draw the image.
|
||||
* Always has to specified and can't be NULL.
|
||||
* Can be an array allocated by the user. E.g. `static lv_color_t disp_buf1[1024 * 10]`
|
||||
* Or a memory address e.g. in external SRAM
|
||||
@@ -188,7 +190,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver);
|
||||
* (sending to the display) parallel.
|
||||
* In the `disp_drv->flush` you should use DMA or similar hardware to send
|
||||
* the image to the display in the background.
|
||||
* It lets LittlevGL to render next frame into the other buffer while previous is being
|
||||
* It lets LVGL to render next frame into the other buffer while previous is being
|
||||
* sent. Set to `NULL` if unused.
|
||||
* @param size_in_px_cnt size of the `buf1` and `buf2` in pixel count.
|
||||
*/
|
||||
@@ -304,7 +306,7 @@ uint16_t lv_disp_get_inv_buf_size(lv_disp_t * disp);
|
||||
* Pop (delete) the last 'num' invalidated areas from the buffer
|
||||
* @param num number of areas to delete
|
||||
*/
|
||||
void lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num);
|
||||
void _lv_disp_pop_from_inv_buf(lv_disp_t * disp, uint16_t num);
|
||||
|
||||
/**
|
||||
* Check the driver configuration if it's double buffered (both `buf1` and `buf2` are set)
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
*/
|
||||
void lv_indev_drv_init(lv_indev_drv_t * driver)
|
||||
{
|
||||
lv_memset_00(driver, sizeof(lv_indev_drv_t));
|
||||
_lv_memset_00(driver, sizeof(lv_indev_drv_t));
|
||||
|
||||
driver->type = LV_INDEV_TYPE_NONE;
|
||||
driver->drag_limit = LV_INDEV_DEF_DRAG_LIMIT;
|
||||
@@ -78,21 +78,21 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_indev_t * indev = lv_ll_ins_head(&LV_GC_ROOT(_lv_indev_ll));
|
||||
lv_indev_t * indev = _lv_ll_ins_head(&LV_GC_ROOT(_lv_indev_ll));
|
||||
if(!indev) {
|
||||
LV_ASSERT_MEM(indev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_memset_00(indev, sizeof(lv_indev_t));
|
||||
lv_memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
|
||||
_lv_memset_00(indev, sizeof(lv_indev_t));
|
||||
_lv_memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
|
||||
|
||||
indev->proc.reset_query = 1;
|
||||
indev->cursor = NULL;
|
||||
indev->group = NULL;
|
||||
indev->btn_points = NULL;
|
||||
|
||||
indev->driver.read_task = lv_task_create(lv_indev_read_task, LV_INDEV_DEF_READ_PERIOD, LV_TASK_PRIO_HIGH, indev);
|
||||
indev->driver.read_task = lv_task_create(_lv_indev_read_task, LV_INDEV_DEF_READ_PERIOD, LV_TASK_PRIO_HIGH, indev);
|
||||
|
||||
return indev;
|
||||
}
|
||||
@@ -116,9 +116,9 @@ void lv_indev_drv_update(lv_indev_t * indev, lv_indev_drv_t * new_drv)
|
||||
lv_indev_t * lv_indev_get_next(lv_indev_t * indev)
|
||||
{
|
||||
if(indev == NULL)
|
||||
return lv_ll_get_head(&LV_GC_ROOT(_lv_indev_ll));
|
||||
return _lv_ll_get_head(&LV_GC_ROOT(_lv_indev_ll));
|
||||
else
|
||||
return lv_ll_get_next(&LV_GC_ROOT(_lv_indev_ll), indev);
|
||||
return _lv_ll_get_next(&LV_GC_ROOT(_lv_indev_ll), indev);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,11 +127,11 @@ lv_indev_t * lv_indev_get_next(lv_indev_t * indev)
|
||||
* @param data input device will write its data here
|
||||
* @return false: no more data; true: there more data to read (buffered)
|
||||
*/
|
||||
bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
|
||||
{
|
||||
bool cont = false;
|
||||
|
||||
lv_memset_00(data, sizeof(lv_indev_data_t));
|
||||
_lv_memset_00(data, sizeof(lv_indev_data_t));
|
||||
|
||||
/* For touchpad sometimes users don't the last pressed coordinate on release.
|
||||
* So be sure a coordinates are initialized to the last point */
|
||||
|
||||
@@ -220,7 +220,7 @@ lv_indev_t * lv_indev_get_next(lv_indev_t * indev);
|
||||
* @param data input device will write its data here
|
||||
* @return false: no more data; true: there more data to read (buffered)
|
||||
*/
|
||||
bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data);
|
||||
bool _lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -58,9 +58,9 @@ const lv_anim_path_t lv_anim_path_def = {.cb = lv_anim_path_linear};
|
||||
/**
|
||||
* Init. the animation module
|
||||
*/
|
||||
void lv_anim_core_init(void)
|
||||
void _lv_anim_core_init(void)
|
||||
{
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t));
|
||||
last_task_run = lv_tick_get();
|
||||
_lv_anim_task = lv_task_create(anim_task, LV_DISP_DEF_REFR_PERIOD, LV_ANIM_TASK_PRIO, NULL);
|
||||
anim_mark_list_change(); /*Turn off the animation task*/
|
||||
@@ -78,11 +78,11 @@ void lv_anim_core_init(void)
|
||||
*/
|
||||
void lv_anim_init(lv_anim_t * a)
|
||||
{
|
||||
lv_memset_00(a, sizeof(lv_anim_t));
|
||||
_lv_memset_00(a, sizeof(lv_anim_t));
|
||||
a->time = 500;
|
||||
a->start = 0;
|
||||
a->end = 100;
|
||||
lv_memcpy_small(&a->path, &lv_anim_path_def, sizeof(lv_anim_path_cb_t));
|
||||
_lv_memcpy_small(&a->path, &lv_anim_path_def, sizeof(lv_anim_path_cb_t));
|
||||
a->repeat_cnt = 1;
|
||||
a->early_apply = 1;
|
||||
}
|
||||
@@ -97,22 +97,22 @@ void lv_anim_start(lv_anim_t * a)
|
||||
if(a->exec_cb != NULL) lv_anim_del(a->var, a->exec_cb); /*fp == NULL would delete all animations of var*/
|
||||
|
||||
/*If the list is empty the anim task was suspended and it's last run measure is invalid*/
|
||||
if(lv_ll_is_empty(&LV_GC_ROOT(_lv_anim_ll))) {
|
||||
if(_lv_ll_is_empty(&LV_GC_ROOT(_lv_anim_ll))) {
|
||||
last_task_run = lv_tick_get() - 1;
|
||||
}
|
||||
|
||||
/*Add the new animation to the animation linked list*/
|
||||
lv_anim_t * new_anim = lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
lv_anim_t * new_anim = _lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
LV_ASSERT_MEM(new_anim);
|
||||
if(new_anim == NULL) return;
|
||||
|
||||
/*Initialize the animation descriptor*/
|
||||
a->time_orig = a->time;
|
||||
lv_memcpy(new_anim, a, sizeof(lv_anim_t));
|
||||
_lv_memcpy(new_anim, a, sizeof(lv_anim_t));
|
||||
|
||||
/*Set the start value*/
|
||||
if(new_anim->early_apply) {
|
||||
if(new_anim->exec_cb) new_anim->exec_cb(new_anim->var, new_anim->start);
|
||||
if(new_anim->exec_cb && new_anim->var) new_anim->exec_cb(new_anim->var, new_anim->start);
|
||||
}
|
||||
|
||||
/* Creating an animation changed the linked list.
|
||||
@@ -134,13 +134,13 @@ bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb)
|
||||
lv_anim_t * a;
|
||||
lv_anim_t * a_next;
|
||||
bool del = false;
|
||||
a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
a = _lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
while(a != NULL) {
|
||||
/*'a' might be deleted, so get the next object while 'a' is valid*/
|
||||
a_next = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
a_next = _lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
|
||||
if(a->var == var && (a->exec_cb == exec_cb || exec_cb == NULL)) {
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
lv_mem_free(a);
|
||||
anim_mark_list_change(); /*Read by `anim_task`. It need to know if a delete occurred in
|
||||
the linked list*/
|
||||
@@ -163,7 +163,7 @@ bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb)
|
||||
lv_anim_t * lv_anim_get(void * var, lv_anim_exec_xcb_t exec_cb)
|
||||
{
|
||||
lv_anim_t * a;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) {
|
||||
if(a->var == var && a->exec_cb == exec_cb) {
|
||||
return a;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ uint16_t lv_anim_count_running(void)
|
||||
{
|
||||
uint16_t cnt = 0;
|
||||
lv_anim_t * a;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) cnt++;
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) cnt++;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_
|
||||
else
|
||||
t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
|
||||
|
||||
int32_t step = lv_bezier3(t, 0, 1, 1, 1024);
|
||||
int32_t step = _lv_bezier3(t, 0, 1, 1, 1024);
|
||||
|
||||
int32_t new_value;
|
||||
new_value = (int32_t)step * (a->end - a->start);
|
||||
@@ -282,7 +282,7 @@ lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim
|
||||
else
|
||||
t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
|
||||
|
||||
int32_t step = lv_bezier3(t, 0, 1023, 1023, 1024);
|
||||
int32_t step = _lv_bezier3(t, 0, 1023, 1023, 1024);
|
||||
|
||||
int32_t new_value;
|
||||
new_value = (int32_t)step * (a->end - a->start);
|
||||
@@ -307,7 +307,7 @@ lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_a
|
||||
else
|
||||
t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
|
||||
|
||||
int32_t step = lv_bezier3(t, 0, 100, 924, 1024);
|
||||
int32_t step = _lv_bezier3(t, 0, 100, 924, 1024);
|
||||
|
||||
int32_t new_value;
|
||||
new_value = (int32_t)step * (a->end - a->start);
|
||||
@@ -332,7 +332,7 @@ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_ani
|
||||
else
|
||||
t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
|
||||
|
||||
int32_t step = lv_bezier3(t, 0, 1000, 2000, 1024);
|
||||
int32_t step = _lv_bezier3(t, 0, 1000, 2000, 1024);
|
||||
|
||||
int32_t new_value;
|
||||
new_value = (int32_t)step * (a->end - a->start);
|
||||
@@ -394,7 +394,7 @@ lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t
|
||||
|
||||
if(t > 1024) t = 1024;
|
||||
|
||||
int32_t step = lv_bezier3(t, 1024, 1024, 800, 0);
|
||||
int32_t step = _lv_bezier3(t, 1024, 1024, 800, 0);
|
||||
|
||||
int32_t new_value;
|
||||
new_value = (int32_t)step * diff;
|
||||
@@ -431,13 +431,13 @@ static void anim_task(lv_task_t * param)
|
||||
(void)param;
|
||||
|
||||
lv_anim_t * a;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) {
|
||||
a->has_run = 0;
|
||||
}
|
||||
|
||||
uint32_t elaps = lv_tick_elaps(last_task_run);
|
||||
|
||||
a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
a = _lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
|
||||
while(a != NULL) {
|
||||
/*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete
|
||||
@@ -475,9 +475,9 @@ static void anim_task(lv_task_t * param)
|
||||
/* If the linked list changed due to anim. delete then it's not safe to continue
|
||||
* the reading of the list from here -> start from the head*/
|
||||
if(anim_list_changed)
|
||||
a = lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
a = _lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll));
|
||||
else
|
||||
a = lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
a = _lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
}
|
||||
|
||||
last_task_run = lv_tick_get();
|
||||
@@ -504,8 +504,8 @@ static bool anim_ready_handler(lv_anim_t * a)
|
||||
/*Create copy from the animation and delete the animation from the list.
|
||||
* This way the `ready_cb` will see the animations like it's animation is ready deleted*/
|
||||
lv_anim_t a_tmp;
|
||||
lv_memcpy(&a_tmp, a, sizeof(lv_anim_t));
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
_lv_memcpy(&a_tmp, a, sizeof(lv_anim_t));
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a);
|
||||
lv_mem_free(a);
|
||||
/*Flag that the list has changed */
|
||||
anim_mark_list_change();
|
||||
@@ -538,7 +538,7 @@ static bool anim_ready_handler(lv_anim_t * a)
|
||||
static void anim_mark_list_change(void)
|
||||
{
|
||||
anim_list_changed = true;
|
||||
if(lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)) == NULL)
|
||||
if(_lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)) == NULL)
|
||||
lv_task_set_prio(_lv_anim_task, LV_TASK_PRIO_OFF);
|
||||
else
|
||||
lv_task_set_prio(_lv_anim_task, LV_ANIM_TASK_PRIO);
|
||||
|
||||
@@ -49,10 +49,10 @@ struct _lv_anim_path_t;
|
||||
/** Get the current value during an animation*/
|
||||
typedef lv_anim_value_t (*lv_anim_path_cb_t)(const struct _lv_anim_path_t *, const struct _lv_anim_t *);
|
||||
|
||||
typedef struct _lv_anim_path_t{
|
||||
typedef struct _lv_anim_path_t {
|
||||
lv_anim_path_cb_t cb;
|
||||
void * user_data;
|
||||
}lv_anim_path_t;
|
||||
} lv_anim_path_t;
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ typedef struct _lv_anim_t {
|
||||
/**
|
||||
* Init. the animation module
|
||||
*/
|
||||
void lv_anim_core_init(void);
|
||||
void _lv_anim_core_init(void);
|
||||
|
||||
/**
|
||||
* Initialize an animation variable.
|
||||
@@ -178,7 +178,7 @@ static inline void lv_anim_set_values(lv_anim_t * a, lv_anim_value_t start, lv_a
|
||||
/**
|
||||
* Similar to `lv_anim_set_exec_cb` but `lv_anim_custom_exec_cb_t` receives
|
||||
* `lv_anim_t * ` as its first parameter instead of `void *`.
|
||||
* This function might be used when LittlevGL is binded to other languages because
|
||||
* This function might be used when LVGL is binded to other languages because
|
||||
* it's more consistent to have `lv_anim_t *` as first parameter.
|
||||
* The variable to animate can be stored in the animation's `user_sata`
|
||||
* @param a pointer to an initialized `lv_anim_t` variable
|
||||
@@ -198,7 +198,7 @@ static inline void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec
|
||||
*/
|
||||
static inline void lv_anim_set_path(lv_anim_t * a, const lv_anim_path_t * path)
|
||||
{
|
||||
lv_memcpy_small(&a->path, path, sizeof(lv_anim_path_t));
|
||||
_lv_memcpy_small(&a->path, path, sizeof(lv_anim_path_t));
|
||||
}
|
||||
|
||||
|
||||
@@ -274,7 +274,7 @@ void lv_anim_start(lv_anim_t * a);
|
||||
*/
|
||||
static inline void lv_anim_path_init(lv_anim_path_t * path)
|
||||
{
|
||||
lv_memset_00(path, sizeof(lv_anim_path_t));
|
||||
_lv_memset_00(path, sizeof(lv_anim_path_t));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h)
|
||||
* @param x the new x coordinate of the area
|
||||
* @param y the new y coordinate of the area
|
||||
*/
|
||||
void lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y)
|
||||
void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y)
|
||||
{
|
||||
lv_coord_t w = lv_area_get_width(area_p);
|
||||
lv_coord_t h = lv_area_get_height(area_p);
|
||||
@@ -110,7 +110,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p)
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
{
|
||||
/* Get the smaller area from 'a1_p' and 'a2_p' */
|
||||
res_p->x1 = LV_MATH_MAX(a1_p->x1, a2_p->x1);
|
||||
@@ -132,7 +132,7 @@ bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
*/
|
||||
void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
{
|
||||
a_res_p->x1 = LV_MATH_MIN(a1_p->x1, a2_p->x1);
|
||||
a_res_p->y1 = LV_MATH_MIN(a1_p->y1, a2_p->y1);
|
||||
@@ -147,7 +147,7 @@ void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t *
|
||||
* @param radius radius of area (e.g. for rounded rectangle)
|
||||
* @return false:the point is out of the area
|
||||
*/
|
||||
bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius)
|
||||
bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius)
|
||||
{
|
||||
/*First check the basic area*/
|
||||
bool is_on_rect = false;
|
||||
@@ -174,7 +174,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord
|
||||
corner_area.x2 = a_p->x1 + radius;
|
||||
corner_area.y1 = a_p->y1;
|
||||
corner_area.y2 = a_p->y1 + radius;
|
||||
if(lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
if(_lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
corner_area.x2 += radius;
|
||||
corner_area.y2 += radius;
|
||||
return lv_point_within_circle(&corner_area, p_p);
|
||||
@@ -182,7 +182,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord
|
||||
/*Bottom left*/
|
||||
corner_area.y1 = a_p->y2 - radius;
|
||||
corner_area.y2 = a_p->y2;
|
||||
if(lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
if(_lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
corner_area.x2 += radius;
|
||||
corner_area.y1 -= radius;
|
||||
return lv_point_within_circle(&corner_area, p_p);
|
||||
@@ -190,7 +190,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord
|
||||
/*Bottom right*/
|
||||
corner_area.x1 = a_p->x2 - radius;
|
||||
corner_area.x2 = a_p->x2;
|
||||
if(lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
if(_lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
corner_area.x1 -= radius;
|
||||
corner_area.y1 -= radius;
|
||||
return lv_point_within_circle(&corner_area, p_p);
|
||||
@@ -198,7 +198,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord
|
||||
/*Top right*/
|
||||
corner_area.y1 = a_p->y1;
|
||||
corner_area.y2 = a_p->y1 + radius;
|
||||
if(lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
if(_lv_area_is_point_on(&corner_area, p_p, 0)) {
|
||||
corner_area.x1 -= radius;
|
||||
corner_area.y2 += radius;
|
||||
return lv_point_within_circle(&corner_area, p_p);
|
||||
@@ -213,7 +213,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord
|
||||
* @param a2_p pointer to an other area
|
||||
* @return false: a1_p and a2_p has no common parts
|
||||
*/
|
||||
bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
{
|
||||
if((a1_p->x1 <= a2_p->x2) && (a1_p->x2 >= a2_p->x1) && (a1_p->y1 <= a2_p->y2) && (a1_p->y2 >= a2_p->y1)) {
|
||||
return true;
|
||||
@@ -230,7 +230,7 @@ bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
* @param radius radius of `aholder_p` (e.g. for rounded rectangle)
|
||||
* @return true: `ain_p` is fully inside `aholder_p`
|
||||
*/
|
||||
bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius)
|
||||
bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius)
|
||||
{
|
||||
bool is_in = false;
|
||||
|
||||
@@ -246,36 +246,23 @@ bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coor
|
||||
|
||||
p.x = ain_p->x1;
|
||||
p.y = ain_p->y1;
|
||||
if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
|
||||
p.x = ain_p->x2;
|
||||
p.y = ain_p->y1;
|
||||
if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
|
||||
p.x = ain_p->x1;
|
||||
p.y = ain_p->y2;
|
||||
if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
|
||||
p.x = ain_p->x2;
|
||||
p.y = ain_p->y2;
|
||||
if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment or decrement an area's size by a single amount
|
||||
* @param a_p pointer to an area to grow
|
||||
* @param amount amount to increment the area, or negative to decrement
|
||||
*/
|
||||
void lv_area_increment(lv_area_t * a_p, const lv_coord_t amount)
|
||||
{
|
||||
a_p->x1 -= amount;
|
||||
a_p->y1 -= amount;
|
||||
a_p->x2 += amount;
|
||||
a_p->y2 += amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Align an area to an other
|
||||
* @param base an are where the other will be aligned
|
||||
@@ -283,7 +270,7 @@ void lv_area_increment(lv_area_t * a_p, const lv_coord_t amount)
|
||||
* @param align `LV_ALIGN_...`
|
||||
* @param res x/y coordinates where `to_align` align area should be placed
|
||||
*/
|
||||
void lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align_t align, lv_point_t * res)
|
||||
void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align_t align, lv_point_t * res)
|
||||
{
|
||||
|
||||
switch(align) {
|
||||
|
||||
@@ -99,7 +99,7 @@ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2
|
||||
*/
|
||||
inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src)
|
||||
{
|
||||
lv_memcpy_small(dest, src, sizeof(lv_area_t));
|
||||
_lv_memcpy_small(dest, src, sizeof(lv_area_t));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,7 +142,7 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h);
|
||||
* @param x the new x coordinate of the area
|
||||
* @param y the new y coordinate of the area
|
||||
*/
|
||||
void lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y);
|
||||
void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y);
|
||||
|
||||
/**
|
||||
* Return with area of an area (x * y)
|
||||
@@ -158,7 +158,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p);
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Join two areas into a third which involves the other two
|
||||
@@ -166,7 +166,7 @@ bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
*/
|
||||
void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Check if a point is on an area
|
||||
@@ -175,7 +175,7 @@ void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t *
|
||||
* @param radius radius of area (e.g. for rounded rectangle)
|
||||
* @return false:the point is out of the area
|
||||
*/
|
||||
bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius);
|
||||
bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius);
|
||||
|
||||
/**
|
||||
* Check if two area has common parts
|
||||
@@ -183,7 +183,7 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord
|
||||
* @param a2_p pointer to an other area
|
||||
* @return false: a1_p and a2_p has no common parts
|
||||
*/
|
||||
bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Check if an area is fully on an other
|
||||
@@ -192,14 +192,8 @@ bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
* @param radius radius of `aholder_p` (e.g. for rounded rectangle)
|
||||
* @return true: `ain_p` is fully inside `aholder_p`
|
||||
*/
|
||||
bool lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius);
|
||||
bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius);
|
||||
|
||||
/**
|
||||
* Increment or decrement an area's size by a single amount
|
||||
* @param a_p pointer to an area to grow
|
||||
* @param amount amount to increment the area, or negative to decrement
|
||||
*/
|
||||
void lv_area_increment(lv_area_t * a_p, const lv_coord_t amount);
|
||||
|
||||
/**
|
||||
* Align an area to an other
|
||||
@@ -208,7 +202,8 @@ void lv_area_increment(lv_area_t * a_p, const lv_coord_t amount);
|
||||
* @param align `LV_ALIGN_...`
|
||||
* @param res x/y coordinates where `to_align` align area should be placed
|
||||
*/
|
||||
void lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align_t align, lv_point_t * res);
|
||||
void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align_t align, lv_point_t * res);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -34,6 +34,13 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static uint32_t lv_bidi_get_next_paragraph(const char * txt);
|
||||
static lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter);
|
||||
static bool lv_bidi_letter_is_weak(uint32_t letter);
|
||||
static bool lv_bidi_letter_is_rtl(uint32_t letter);
|
||||
static bool lv_bidi_letter_is_neutral(uint32_t letter);
|
||||
|
||||
static lv_bidi_dir_t get_next_run(const char * txt, lv_bidi_dir_t base_dir, uint32_t max_len, uint32_t * len,
|
||||
uint16_t * pos_conv_len);
|
||||
static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t * pos_conv_out, uint16_t pos_conv_rd_base,
|
||||
@@ -67,9 +74,9 @@ static uint8_t br_stack_p;
|
||||
* @param str_out store the result here. Has the be `strlen(str_in)` length
|
||||
* @param base_dir `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL`
|
||||
*/
|
||||
void lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir)
|
||||
void _lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir)
|
||||
{
|
||||
if(base_dir == LV_BIDI_DIR_AUTO) base_dir = lv_bidi_detect_base_dir(str_in);
|
||||
if(base_dir == LV_BIDI_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(str_in);
|
||||
|
||||
uint32_t par_start = 0;
|
||||
uint32_t par_len;
|
||||
@@ -81,7 +88,7 @@ void lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir
|
||||
|
||||
while(str_in[par_start] != '\0') {
|
||||
par_len = lv_bidi_get_next_paragraph(&str_in[par_start]);
|
||||
lv_bidi_process_paragraph(&str_in[par_start], &str_out[par_start], par_len, base_dir, NULL, 0);
|
||||
_lv_bidi_process_paragraph(&str_in[par_start], &str_out[par_start], par_len, base_dir, NULL, 0);
|
||||
par_start += par_len;
|
||||
|
||||
while(str_in[par_start] == '\n' || str_in[par_start] == '\r') {
|
||||
@@ -98,12 +105,12 @@ void lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir
|
||||
* @param txt the text to process
|
||||
* @return `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL`
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_detect_base_dir(const char * txt)
|
||||
lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
uint32_t letter;
|
||||
while(txt[i] != '\0') {
|
||||
letter = lv_txt_encoded_next(txt, &i);
|
||||
letter = _lv_txt_encoded_next(txt, &i);
|
||||
|
||||
lv_bidi_dir_t dir;
|
||||
dir = lv_bidi_get_letter_dir(letter);
|
||||
@@ -114,71 +121,6 @@ lv_bidi_dir_t lv_bidi_detect_base_dir(const char * txt)
|
||||
if(LV_BIDI_BASE_DIR_DEF == LV_BIDI_DIR_AUTO) return LV_BIDI_DIR_LTR;
|
||||
else return LV_BIDI_BASE_DIR_DEF;
|
||||
}
|
||||
/**
|
||||
* Get the direction of a character
|
||||
* @param letter an Unicode character
|
||||
* @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL`
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter)
|
||||
{
|
||||
if(lv_bidi_letter_is_rtl(letter)) return LV_BIDI_DIR_RTL;
|
||||
if(lv_bidi_letter_is_neutral(letter)) return LV_BIDI_DIR_NEUTRAL;
|
||||
if(lv_bidi_letter_is_weak(letter)) return LV_BIDI_DIR_WEAK;
|
||||
|
||||
return LV_BIDI_DIR_LTR;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is weak or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_weak(uint32_t letter)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
static const char weaks[] = "0123456789";
|
||||
|
||||
do {
|
||||
uint32_t x = lv_txt_encoded_next(weaks, &i);
|
||||
if(letter == x) {
|
||||
return true;
|
||||
}
|
||||
} while(weaks[i] != '\0');
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is RTL or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_rtl(uint32_t letter)
|
||||
{
|
||||
if(letter >= 0x5d0 && letter <= 0x5ea) return true;
|
||||
if(letter == 0x202E) return true; /*Unicode of LV_BIDI_RLO*/
|
||||
|
||||
/* Check for Persian and Arabic characters [https://en.wikipedia.org/wiki/Arabic_script_in_Unicode]*/
|
||||
if(letter >= 0x600 && letter <= 0x6FF) return true;
|
||||
if(letter >= 0xFB50 && letter <= 0xFDFF) return true;
|
||||
if(letter >= 0xFE70 && letter <= 0xFEFF) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether a character is neutral or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_neutral(uint32_t letter)
|
||||
{
|
||||
uint16_t i;
|
||||
static const char neutrals[] = " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|";
|
||||
for(i = 0; neutrals[i] != '\0'; i++) {
|
||||
if(letter == (uint32_t)neutrals[i]) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the logical position of a character in a line
|
||||
@@ -192,28 +134,28 @@ bool lv_bidi_letter_is_neutral(uint32_t letter)
|
||||
* @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context
|
||||
* @return the logical character position
|
||||
*/
|
||||
uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t visual_pos, bool * is_rtl)
|
||||
uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t visual_pos, bool * is_rtl)
|
||||
{
|
||||
uint32_t pos_conv_len = get_txt_len(str_in, len);
|
||||
char * buf = lv_mem_buf_get(len + 1);
|
||||
char * buf = _lv_mem_buf_get(len + 1);
|
||||
if(buf == NULL) return (uint16_t) -1;
|
||||
|
||||
uint16_t * pos_conv_buf = lv_mem_buf_get(pos_conv_len * sizeof(uint16_t));
|
||||
uint16_t * pos_conv_buf = _lv_mem_buf_get(pos_conv_len * sizeof(uint16_t));
|
||||
if(pos_conv_buf == NULL) {
|
||||
lv_mem_buf_release(buf);
|
||||
_lv_mem_buf_release(buf);
|
||||
return (uint16_t) -1;
|
||||
}
|
||||
|
||||
if(bidi_txt) *bidi_txt = buf;
|
||||
|
||||
lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len);
|
||||
_lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len);
|
||||
|
||||
if(is_rtl) *is_rtl = IS_RTL_POS(pos_conv_buf[visual_pos]);
|
||||
|
||||
if(bidi_txt == NULL) lv_mem_buf_release(buf);
|
||||
if(bidi_txt == NULL) _lv_mem_buf_release(buf);
|
||||
uint16_t res = GET_POS(pos_conv_buf[visual_pos]);
|
||||
lv_mem_buf_release(pos_conv_buf);
|
||||
_lv_mem_buf_release(pos_conv_buf);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -229,35 +171,35 @@ uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t
|
||||
* @param is_rtl tell the the char at `logical_pos` is RTL or LTR context
|
||||
* @return the visual character position
|
||||
*/
|
||||
uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t logical_pos, bool * is_rtl)
|
||||
uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t logical_pos, bool * is_rtl)
|
||||
{
|
||||
uint32_t pos_conv_len = get_txt_len(str_in, len);
|
||||
char * buf = lv_mem_buf_get(len + 1);
|
||||
char * buf = _lv_mem_buf_get(len + 1);
|
||||
if(buf == NULL) return (uint16_t) -1;
|
||||
|
||||
uint16_t * pos_conv_buf = lv_mem_buf_get(pos_conv_len * sizeof(uint16_t));
|
||||
uint16_t * pos_conv_buf = _lv_mem_buf_get(pos_conv_len * sizeof(uint16_t));
|
||||
if(pos_conv_buf == NULL) {
|
||||
lv_mem_buf_release(buf);
|
||||
_lv_mem_buf_release(buf);
|
||||
return (uint16_t) -1;
|
||||
}
|
||||
|
||||
if(bidi_txt) *bidi_txt = buf;
|
||||
|
||||
lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len);
|
||||
_lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len);
|
||||
|
||||
for(uint16_t i = 0; i < pos_conv_len; i++) {
|
||||
if(GET_POS(pos_conv_buf[i]) == logical_pos) {
|
||||
|
||||
if(is_rtl) *is_rtl = IS_RTL_POS(pos_conv_buf[i]);
|
||||
lv_mem_buf_release(pos_conv_buf);
|
||||
_lv_mem_buf_release(pos_conv_buf);
|
||||
|
||||
if(bidi_txt == NULL) lv_mem_buf_release(buf);
|
||||
if(bidi_txt == NULL) _lv_mem_buf_release(buf);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(pos_conv_buf);
|
||||
if(bidi_txt == NULL) lv_mem_buf_release(buf);
|
||||
_lv_mem_buf_release(pos_conv_buf);
|
||||
if(bidi_txt == NULL) _lv_mem_buf_release(buf);
|
||||
return (uint16_t) -1;
|
||||
}
|
||||
|
||||
@@ -271,8 +213,8 @@ uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
|
||||
* Can be `NULL` is unused
|
||||
* @param pos_conv_len length of `pos_conv_out` in element count
|
||||
*/
|
||||
void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint16_t * pos_conv_out, uint16_t pos_conv_len)
|
||||
void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint16_t * pos_conv_out, uint16_t pos_conv_len)
|
||||
{
|
||||
uint32_t run_len = 0;
|
||||
lv_bidi_dir_t run_dir;
|
||||
@@ -282,7 +224,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
uint16_t pos_conv_rd = 0;
|
||||
uint16_t pos_conv_wr;
|
||||
|
||||
if(base_dir == LV_BIDI_DIR_AUTO) base_dir = lv_bidi_detect_base_dir(str_in);
|
||||
if(base_dir == LV_BIDI_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(str_in);
|
||||
if(base_dir == LV_BIDI_DIR_RTL) {
|
||||
wr = len;
|
||||
pos_conv_wr = pos_conv_len;
|
||||
@@ -301,7 +243,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
|
||||
/*Process neutral chars in the beginning*/
|
||||
while(rd < len) {
|
||||
uint32_t letter = lv_txt_encoded_next(str_in, &rd);
|
||||
uint32_t letter = _lv_txt_encoded_next(str_in, &rd);
|
||||
pos_conv_rd++;
|
||||
dir = lv_bidi_get_letter_dir(letter);
|
||||
if(dir == LV_BIDI_DIR_NEUTRAL) dir = bracket_process(str_in, rd, len, letter, base_dir);
|
||||
@@ -309,14 +251,14 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
}
|
||||
|
||||
if(rd && str_in[rd] != '\0') {
|
||||
lv_txt_encoded_prev(str_in, &rd);
|
||||
_lv_txt_encoded_prev(str_in, &rd);
|
||||
pos_conv_rd--;
|
||||
}
|
||||
|
||||
if(rd) {
|
||||
if(base_dir == LV_BIDI_DIR_LTR) {
|
||||
if(str_out) {
|
||||
lv_memcpy(&str_out[wr], str_in, rd);
|
||||
_lv_memcpy(&str_out[wr], str_in, rd);
|
||||
wr += rd;
|
||||
}
|
||||
if(pos_conv_out) {
|
||||
@@ -339,7 +281,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
|
||||
if(base_dir == LV_BIDI_DIR_LTR) {
|
||||
if(run_dir == LV_BIDI_DIR_LTR) {
|
||||
if(str_out) lv_memcpy(&str_out[wr], &str_in[rd], run_len);
|
||||
if(str_out) _lv_memcpy(&str_out[wr], &str_in[rd], run_len);
|
||||
if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_run_len, pos_conv_rd);
|
||||
}
|
||||
else rtl_reverse(str_out ? &str_out[wr] : NULL, &str_in[rd], run_len, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL,
|
||||
@@ -351,7 +293,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
wr -= run_len;
|
||||
pos_conv_wr -= pos_conv_run_len;
|
||||
if(run_dir == LV_BIDI_DIR_LTR) {
|
||||
if(str_out) lv_memcpy(&str_out[wr], &str_in[rd], run_len);
|
||||
if(str_out) _lv_memcpy(&str_out[wr], &str_in[rd], run_len);
|
||||
if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_run_len, pos_conv_rd);
|
||||
}
|
||||
else rtl_reverse(str_out ? &str_out[wr] : NULL, &str_in[rd], run_len, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL,
|
||||
@@ -363,27 +305,93 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the next paragraph from a text
|
||||
* @param txt the text to process
|
||||
* @return the length of the current paragraph in byte count
|
||||
*/
|
||||
uint32_t lv_bidi_get_next_paragraph(const char * txt)
|
||||
static uint32_t lv_bidi_get_next_paragraph(const char * txt)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
_lv_txt_encoded_next(txt, &i);
|
||||
|
||||
while(txt[i] != '\0' && txt[i] != '\n' && txt[i] != '\r') {
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
_lv_txt_encoded_next(txt, &i);
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
/**
|
||||
* Get the direction of a character
|
||||
* @param letter an Unicode character
|
||||
* @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL`
|
||||
*/
|
||||
static lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter)
|
||||
{
|
||||
if(lv_bidi_letter_is_rtl(letter)) return LV_BIDI_DIR_RTL;
|
||||
if(lv_bidi_letter_is_neutral(letter)) return LV_BIDI_DIR_NEUTRAL;
|
||||
if(lv_bidi_letter_is_weak(letter)) return LV_BIDI_DIR_WEAK;
|
||||
|
||||
return LV_BIDI_DIR_LTR;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is weak or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
static bool lv_bidi_letter_is_weak(uint32_t letter)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
static const char weaks[] = "0123456789";
|
||||
|
||||
do {
|
||||
uint32_t x = _lv_txt_encoded_next(weaks, &i);
|
||||
if(letter == x) {
|
||||
return true;
|
||||
}
|
||||
} while(weaks[i] != '\0');
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Tell whether a character is RTL or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
static bool lv_bidi_letter_is_rtl(uint32_t letter)
|
||||
{
|
||||
if(letter >= 0x5d0 && letter <= 0x5ea) return true;
|
||||
if(letter == 0x202E) return true; /*Unicode of LV_BIDI_RLO*/
|
||||
|
||||
/* Check for Persian and Arabic characters [https://en.wikipedia.org/wiki/Arabic_script_in_Unicode]*/
|
||||
if(letter >= 0x600 && letter <= 0x6FF) return true;
|
||||
if(letter >= 0xFB50 && letter <= 0xFDFF) return true;
|
||||
if(letter >= 0xFE70 && letter <= 0xFEFF) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether a character is neutral or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
static bool lv_bidi_letter_is_neutral(uint32_t letter)
|
||||
{
|
||||
uint16_t i;
|
||||
static const char neutrals[] = " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|";
|
||||
for(i = 0; neutrals[i] != '\0'; i++) {
|
||||
if(letter == (uint32_t)neutrals[i]) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint32_t get_txt_len(const char * txt, uint32_t max_len)
|
||||
{
|
||||
@@ -391,7 +399,7 @@ static uint32_t get_txt_len(const char * txt, uint32_t max_len)
|
||||
uint32_t i = 0;
|
||||
|
||||
while(i < max_len && txt[i] != '\0') {
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
_lv_txt_encoded_next(txt, &i);
|
||||
len++;
|
||||
}
|
||||
|
||||
@@ -415,13 +423,13 @@ static lv_bidi_dir_t get_next_run(const char * txt, lv_bidi_dir_t base_dir, uint
|
||||
|
||||
uint16_t pos_conv_i = 0;
|
||||
|
||||
letter = lv_txt_encoded_next(txt, NULL);
|
||||
letter = _lv_txt_encoded_next(txt, NULL);
|
||||
lv_bidi_dir_t dir = lv_bidi_get_letter_dir(letter);
|
||||
if(dir == LV_BIDI_DIR_NEUTRAL) dir = bracket_process(txt, 0, max_len, letter, base_dir);
|
||||
|
||||
/*Find the first strong char. Skip the neutrals*/
|
||||
while(dir == LV_BIDI_DIR_NEUTRAL || dir == LV_BIDI_DIR_WEAK) {
|
||||
letter = lv_txt_encoded_next(txt, &i);
|
||||
letter = _lv_txt_encoded_next(txt, &i);
|
||||
pos_conv_i++;
|
||||
dir = lv_bidi_get_letter_dir(letter);
|
||||
if(dir == LV_BIDI_DIR_NEUTRAL) dir = bracket_process(txt, i, max_len, letter, base_dir);
|
||||
@@ -443,7 +451,7 @@ static lv_bidi_dir_t get_next_run(const char * txt, lv_bidi_dir_t base_dir, uint
|
||||
/*Find the next char which has different direction*/
|
||||
lv_bidi_dir_t next_dir = base_dir;
|
||||
while(i_prev < max_len && txt[i] != '\0' && txt[i] != '\n' && txt[i] != '\r') {
|
||||
letter = lv_txt_encoded_next(txt, &i);
|
||||
letter = _lv_txt_encoded_next(txt, &i);
|
||||
pos_conv_i++;
|
||||
next_dir = lv_bidi_get_letter_dir(letter);
|
||||
if(next_dir == LV_BIDI_DIR_NEUTRAL) next_dir = bracket_process(txt, i, max_len, letter, base_dir);
|
||||
@@ -498,7 +506,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
|
||||
uint16_t pos_conv_wr = 0;
|
||||
|
||||
while(i) {
|
||||
uint32_t letter = lv_txt_encoded_prev(src, &i);
|
||||
uint32_t letter = _lv_txt_encoded_prev(src, &i);
|
||||
uint16_t pos_conv_letter = --pos_conv_i;
|
||||
|
||||
/*Keep weak letters (numbers) as LTR*/
|
||||
@@ -508,7 +516,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
|
||||
uint16_t pos_conv_last_weak = pos_conv_i;
|
||||
uint16_t pos_conv_first_weak = pos_conv_i;
|
||||
while(i) {
|
||||
letter = lv_txt_encoded_prev(src, &i);
|
||||
letter = _lv_txt_encoded_prev(src, &i);
|
||||
pos_conv_letter = --pos_conv_i;
|
||||
|
||||
/*No need to call `char_change_to_pair` because there not such chars here*/
|
||||
@@ -516,7 +524,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
|
||||
/*Finish on non-weak char */
|
||||
/*but treat number and currency related chars as weak*/
|
||||
if(lv_bidi_letter_is_weak(letter) == false && letter != '.' && letter != ',' && letter != '$' && letter != '%') {
|
||||
lv_txt_encoded_next(src, &i); /*Rewind one letter*/
|
||||
_lv_txt_encoded_next(src, &i); /*Rewind one letter*/
|
||||
pos_conv_i++;
|
||||
first_weak = i;
|
||||
pos_conv_first_weak = pos_conv_i;
|
||||
@@ -528,7 +536,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
|
||||
pos_conv_first_weak = 0;
|
||||
}
|
||||
|
||||
if(dest) lv_memcpy(&dest[wr], &src[first_weak], last_weak - first_weak + 1);
|
||||
if(dest) _lv_memcpy(&dest[wr], &src[first_weak], last_weak - first_weak + 1);
|
||||
if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_last_weak - pos_conv_first_weak + 1,
|
||||
pos_conv_rd_base + pos_conv_first_weak);
|
||||
wr += last_weak - first_weak + 1;
|
||||
@@ -537,7 +545,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
|
||||
|
||||
/*Simply store in reversed order*/
|
||||
else {
|
||||
uint32_t letter_size = lv_txt_encoded_size((const char *)&src[i]);
|
||||
uint32_t letter_size = _lv_txt_encoded_size((const char *)&src[i]);
|
||||
/*Swap arithmetical symbols*/
|
||||
if(letter_size == 1) {
|
||||
uint32_t new_letter = letter = char_change_to_pair(letter);
|
||||
@@ -548,7 +556,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
|
||||
}
|
||||
/*Just store the letter*/
|
||||
else {
|
||||
if(dest) lv_memcpy(&dest[wr], &src[i], letter_size);
|
||||
if(dest) _lv_memcpy(&dest[wr], &src[i], letter_size);
|
||||
if(pos_conv_out) pos_conv_out[pos_conv_wr] = SET_RTL_POS(pos_conv_rd_base + pos_conv_i, true);
|
||||
wr += letter_size;
|
||||
pos_conv_wr++;
|
||||
@@ -585,7 +593,7 @@ static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32
|
||||
* If a char with base dir. direction is found then the brackets will have `base_dir` direction*/
|
||||
uint32_t txt_i = next_pos;
|
||||
while(txt_i < len) {
|
||||
uint32_t letter_next = lv_txt_encoded_next(txt, &txt_i);
|
||||
uint32_t letter_next = _lv_txt_encoded_next(txt, &txt_i);
|
||||
if(letter_next == bracket_right[i]) {
|
||||
/*Closing bracket found*/
|
||||
break;
|
||||
@@ -607,9 +615,9 @@ static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32
|
||||
|
||||
/*If there were no matching strong chars in the brackets then check the previous chars*/
|
||||
txt_i = next_pos;
|
||||
if(txt_i) lv_txt_encoded_prev(txt, &txt_i);
|
||||
if(txt_i) _lv_txt_encoded_prev(txt, &txt_i);
|
||||
while(txt_i > 0) {
|
||||
uint32_t letter_next = lv_txt_encoded_prev(txt, &txt_i);
|
||||
uint32_t letter_next = _lv_txt_encoded_prev(txt, &txt_i);
|
||||
lv_bidi_dir_t letter_dir = lv_bidi_get_letter_dir(letter_next);
|
||||
if(letter_dir == LV_BIDI_DIR_LTR || letter_dir == LV_BIDI_DIR_RTL) {
|
||||
bracket_dir = letter_dir;
|
||||
|
||||
@@ -54,42 +54,14 @@ typedef uint8_t lv_bidi_dir_t;
|
||||
* @param str_out store the result here. Has the be `strlen(str_in)` length
|
||||
* @param base_dir `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL`
|
||||
*/
|
||||
void lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir);
|
||||
void _lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir);
|
||||
|
||||
/**
|
||||
* Auto-detect the direction of a text based on the first strong character
|
||||
* @param txt the text to process
|
||||
* @return `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL`
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_detect_base_dir(const char * txt);
|
||||
|
||||
/**
|
||||
* Get the direction of a character
|
||||
* @param letter an Unicode character
|
||||
* @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL`
|
||||
*/
|
||||
lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Tell whether a character is weak or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_weak(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Tell whether a character is RTL or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_rtl(uint32_t letter);
|
||||
|
||||
/**
|
||||
* Tell whether a character is neutral or not
|
||||
* @param letter an Unicode character
|
||||
* @return true/false
|
||||
*/
|
||||
bool lv_bidi_letter_is_neutral(uint32_t letter);
|
||||
lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt);
|
||||
|
||||
/**
|
||||
* Get the logical position of a character in a line
|
||||
@@ -103,8 +75,8 @@ bool lv_bidi_letter_is_neutral(uint32_t letter);
|
||||
* @param is_rtl tell the the char at `viasual_pos` is RTL or LTR context
|
||||
* @return the logical character position
|
||||
*/
|
||||
uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t visual_pos, bool * is_rtl);
|
||||
uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t visual_pos, bool * is_rtl);
|
||||
|
||||
/**
|
||||
* Get the visual position of a character in a line
|
||||
@@ -118,8 +90,8 @@ uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t
|
||||
* @param is_rtl tell the the char at `logical_pos` is RTL or LTR context
|
||||
* @return the visual character position
|
||||
*/
|
||||
uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t logical_pos, bool * is_rtl);
|
||||
uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir,
|
||||
uint32_t logical_pos, bool * is_rtl);
|
||||
|
||||
/**
|
||||
* Bidi process a paragraph of text
|
||||
@@ -131,15 +103,8 @@ uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t
|
||||
* Can be `NULL` is unused
|
||||
* @param pos_conv_len length of `pos_conv_out` in element count
|
||||
*/
|
||||
void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint16_t * pos_conv_out, uint16_t pos_conv_len);
|
||||
|
||||
/**
|
||||
* Get the next paragraph from a text
|
||||
* @param txt the text to process
|
||||
* @return the length of the current paragraph in byte count
|
||||
*/
|
||||
uint32_t lv_bidi_get_next_paragraph(const char * txt);
|
||||
void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir,
|
||||
uint16_t * pos_conv_out, uint16_t pos_conv_len);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* @file lv_circ.c
|
||||
* Circle drawing algorithm (with Bresenham)
|
||||
* Only a 1/8 circle is calculated. Use CIRC_OCT1_X, CIRC_OCT1_Y macros to get
|
||||
* the other octets.
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_circ.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the circle drawing
|
||||
* @param c pointer to a point. The coordinates will be calculated here
|
||||
* @param tmp point to a variable. It will store temporary data
|
||||
* @param radius radius of the circle
|
||||
*/
|
||||
void lv_circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius)
|
||||
{
|
||||
c->x = radius;
|
||||
c->y = 0;
|
||||
*tmp = 1 - radius;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the circle drawing is ready or not
|
||||
* @param c same as in circ_init
|
||||
* @return true if the circle is not ready yet
|
||||
*/
|
||||
bool lv_circ_cont(lv_point_t * c)
|
||||
{
|
||||
return c->y <= c->x ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next point from the circle
|
||||
* @param c same as in circ_init. The next point stored here.
|
||||
* @param tmp same as in circ_init.
|
||||
*/
|
||||
void lv_circ_next(lv_point_t * c, lv_coord_t * tmp)
|
||||
{
|
||||
c->y++;
|
||||
|
||||
if(*tmp <= 0) {
|
||||
(*tmp) += 2 * c->y + 1; /*Change in decision criterion for y -> y+1*/
|
||||
}
|
||||
else {
|
||||
c->x--;
|
||||
(*tmp) += 2 * (c->y - c->x) + 1; /*Change for y -> y+1, x -> x-1*/
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -1,77 +0,0 @@
|
||||
/**
|
||||
* @file lv_circ.h
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LV_CIRC_H
|
||||
#define LV_CIRC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include "lv_area.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_CIRC_OCT1_X(p) (p.x)
|
||||
#define LV_CIRC_OCT1_Y(p) (p.y)
|
||||
#define LV_CIRC_OCT2_X(p) (p.y)
|
||||
#define LV_CIRC_OCT2_Y(p) (p.x)
|
||||
#define LV_CIRC_OCT3_X(p) (-p.y)
|
||||
#define LV_CIRC_OCT3_Y(p) (p.x)
|
||||
#define LV_CIRC_OCT4_X(p) (-p.x)
|
||||
#define LV_CIRC_OCT4_Y(p) (p.y)
|
||||
#define LV_CIRC_OCT5_X(p) (-p.x)
|
||||
#define LV_CIRC_OCT5_Y(p) (-p.y)
|
||||
#define LV_CIRC_OCT6_X(p) (-p.y)
|
||||
#define LV_CIRC_OCT6_Y(p) (-p.x)
|
||||
#define LV_CIRC_OCT7_X(p) (p.y)
|
||||
#define LV_CIRC_OCT7_Y(p) (-p.x)
|
||||
#define LV_CIRC_OCT8_X(p) (p.x)
|
||||
#define LV_CIRC_OCT8_Y(p) (-p.y)
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Initialize the circle drawing
|
||||
* @param c pointer to a point. The coordinates will be calculated here
|
||||
* @param tmp point to a variable. It will store temporary data
|
||||
* @param radius radius of the circle
|
||||
*/
|
||||
void lv_circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius);
|
||||
|
||||
/**
|
||||
* Test the circle drawing is ready or not
|
||||
* @param c same as in circ_init
|
||||
* @return true if the circle is not ready yet
|
||||
*/
|
||||
bool lv_circ_cont(lv_point_t * c);
|
||||
|
||||
/**
|
||||
* Get the next point from the circle
|
||||
* @param c same as in circ_init. The next point stored here.
|
||||
* @param tmp same as in circ_init.
|
||||
*/
|
||||
void lv_circ_next(lv_point_t * c, lv_coord_t * tmp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -39,33 +39,92 @@
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uint32_t px_num)
|
||||
{
|
||||
#if LV_COLOR_DEPTH == 16
|
||||
uintptr_t buf_int = (uintptr_t) buf;
|
||||
if(buf_int & 0x3) {
|
||||
*buf = color;
|
||||
buf++;
|
||||
px_num--;
|
||||
}
|
||||
|
||||
uint32_t c32 = color.full + (color.full << 16);
|
||||
uint32_t * buf32 = (uint32_t *)buf;
|
||||
|
||||
while(px_num > 16) {
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf = color; buf++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
*buf32 = c32;
|
||||
buf32++;
|
||||
|
||||
px_num -= 16;
|
||||
}
|
||||
while(px_num ) {
|
||||
*buf = color; buf++;
|
||||
|
||||
buf = (lv_color_t *)buf32;
|
||||
|
||||
while(px_num) {
|
||||
*buf = color;
|
||||
buf++;
|
||||
px_num --;
|
||||
}
|
||||
#else
|
||||
while(px_num > 16) {
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
*buf = color;
|
||||
buf++;
|
||||
|
||||
px_num -= 16;
|
||||
}
|
||||
while(px_num) {
|
||||
*buf = color;
|
||||
buf++;
|
||||
px_num --;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ enum {
|
||||
**********************/
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
union {
|
||||
uint8_t blue : 1;
|
||||
uint8_t green : 1;
|
||||
uint8_t red : 1;
|
||||
@@ -426,6 +426,8 @@ static inline uint32_t lv_color_to32(lv_color_t color)
|
||||
}
|
||||
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Mix two colors with a given ratio.
|
||||
* @param c1 the first color to mix (usually the foreground)
|
||||
@@ -465,6 +467,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_premult(lv_color_t c, uint8_t
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mix two colors with a given ratio. It runs faster then `lv_color_mix` but requires some pre computation.
|
||||
* @param c1 The first color. Should be preprocessed with `lv_color_premult(c1)`
|
||||
@@ -506,8 +509,9 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix_premult(uint16_t * p
|
||||
* @param res_color the result color
|
||||
* @param res_opa the result opacity
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa,
|
||||
lv_color_t * res_color, lv_opa_t * res_opa)
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_color, lv_opa_t bg_opa,
|
||||
lv_color_t fg_color, lv_opa_t fg_opa,
|
||||
lv_color_t * res_color, lv_opa_t * res_opa)
|
||||
{
|
||||
/* Pick the foreground if it's fully opaque or the Background is fully transparent*/
|
||||
if(fg_opa >= LV_OPA_MAX || bg_opa <= LV_OPA_MIN) {
|
||||
@@ -557,6 +561,8 @@ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_c
|
||||
}
|
||||
}
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Get the brightness of a color
|
||||
* @param color a color
|
||||
@@ -601,8 +607,12 @@ static inline lv_color_t lv_color_hex3(uint32_t c)
|
||||
(uint8_t)((c & 0xF) | ((c & 0xF) << 4)));
|
||||
}
|
||||
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
//!
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uint32_t px_num);
|
||||
|
||||
//! @endcond
|
||||
lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl);
|
||||
|
||||
lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl);
|
||||
|
||||
@@ -54,9 +54,9 @@ static const char * lv_fs_get_real_path(const char * path);
|
||||
/**
|
||||
* Initialize the File system interface
|
||||
*/
|
||||
void lv_fs_init(void)
|
||||
void _lv_fs_init(void)
|
||||
{
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_drv_ll), sizeof(lv_fs_drv_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_drv_ll), sizeof(lv_fs_drv_t));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -475,7 +475,7 @@ lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p)
|
||||
*/
|
||||
void lv_fs_drv_init(lv_fs_drv_t * drv)
|
||||
{
|
||||
lv_memset_00(drv, sizeof(lv_fs_drv_t));
|
||||
_lv_memset_00(drv, sizeof(lv_fs_drv_t));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,11 +487,11 @@ void lv_fs_drv_register(lv_fs_drv_t * drv_p)
|
||||
{
|
||||
/*Save the new driver*/
|
||||
lv_fs_drv_t * new_drv;
|
||||
new_drv = lv_ll_ins_head(&LV_GC_ROOT(_lv_drv_ll));
|
||||
new_drv = _lv_ll_ins_head(&LV_GC_ROOT(_lv_drv_ll));
|
||||
LV_ASSERT_MEM(new_drv);
|
||||
if(new_drv == NULL) return;
|
||||
|
||||
lv_memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t));
|
||||
_lv_memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -503,7 +503,7 @@ lv_fs_drv_t * lv_fs_get_drv(char letter)
|
||||
{
|
||||
lv_fs_drv_t * drv;
|
||||
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) {
|
||||
if(drv->letter == letter) {
|
||||
return drv;
|
||||
}
|
||||
@@ -521,7 +521,7 @@ char * lv_fs_get_letters(char * buf)
|
||||
lv_fs_drv_t * drv;
|
||||
uint8_t i = 0;
|
||||
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) {
|
||||
buf[i] = drv->letter;
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ typedef struct {
|
||||
/**
|
||||
* Initialize the File system interface
|
||||
*/
|
||||
void lv_fs_init(void);
|
||||
void _lv_fs_init(void);
|
||||
|
||||
/**
|
||||
* Initialize a file system driver with default values.
|
||||
|
||||
@@ -42,9 +42,9 @@
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
void lv_gc_clear_roots(void)
|
||||
void _lv_gc_clear_roots(void)
|
||||
{
|
||||
#define LV_CLEAR_ROOT(root_type, root_name) lv_memset_00(&LV_GC_ROOT(root_name), sizeof(LV_GC_ROOT(root_name)));
|
||||
#define LV_CLEAR_ROOT(root_type, root_name) _lv_memset_00(&LV_GC_ROOT(root_name), sizeof(LV_GC_ROOT(root_name)));
|
||||
LV_ITERATE_ROOTS(LV_CLEAR_ROOT)
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ LV_ITERATE_ROOTS(LV_EXTERN_ROOT)
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
void lv_gc_clear_roots(void);
|
||||
void _lv_gc_clear_roots(void);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -47,7 +47,7 @@ static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * nex
|
||||
* @param ll_dsc pointer to ll_dsc variable
|
||||
* @param node_size the size of 1 node in bytes
|
||||
*/
|
||||
void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size)
|
||||
void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size)
|
||||
{
|
||||
ll_p->head = NULL;
|
||||
ll_p->tail = NULL;
|
||||
@@ -73,7 +73,7 @@ void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size)
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the new head
|
||||
*/
|
||||
void * lv_ll_ins_head(lv_ll_t * ll_p)
|
||||
void * _lv_ll_ins_head(lv_ll_t * ll_p)
|
||||
{
|
||||
lv_ll_node_t * n_new;
|
||||
|
||||
@@ -102,14 +102,14 @@ void * lv_ll_ins_head(lv_ll_t * ll_p)
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the new head
|
||||
*/
|
||||
void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
|
||||
void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
|
||||
{
|
||||
lv_ll_node_t * n_new;
|
||||
|
||||
if(NULL == ll_p || NULL == n_act) return NULL;
|
||||
|
||||
if(lv_ll_get_head(ll_p) == n_act) {
|
||||
n_new = lv_ll_ins_head(ll_p);
|
||||
if(_lv_ll_get_head(ll_p) == n_act) {
|
||||
n_new = _lv_ll_ins_head(ll_p);
|
||||
if(n_new == NULL) return NULL;
|
||||
}
|
||||
else {
|
||||
@@ -117,7 +117,7 @@ void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
|
||||
if(n_new == NULL) return NULL;
|
||||
|
||||
lv_ll_node_t * n_prev;
|
||||
n_prev = lv_ll_get_prev(ll_p, n_act);
|
||||
n_prev = _lv_ll_get_prev(ll_p, n_act);
|
||||
node_set_next(ll_p, n_prev, n_new);
|
||||
node_set_prev(ll_p, n_new, n_prev);
|
||||
node_set_prev(ll_p, n_act, n_new);
|
||||
@@ -132,7 +132,7 @@ void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act)
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the new tail
|
||||
*/
|
||||
void * lv_ll_ins_tail(lv_ll_t * ll_p)
|
||||
void * _lv_ll_ins_tail(lv_ll_t * ll_p)
|
||||
{
|
||||
lv_ll_node_t * n_new;
|
||||
|
||||
@@ -160,11 +160,11 @@ void * lv_ll_ins_tail(lv_ll_t * ll_p)
|
||||
* @param ll_p pointer to the linked list of 'node_p'
|
||||
* @param node_p pointer to node in 'll_p' linked list
|
||||
*/
|
||||
void lv_ll_remove(lv_ll_t * ll_p, void * node_p)
|
||||
void _lv_ll_remove(lv_ll_t * ll_p, void * node_p)
|
||||
{
|
||||
if(lv_ll_get_head(ll_p) == node_p) {
|
||||
if(_lv_ll_get_head(ll_p) == node_p) {
|
||||
/*The new head will be the node after 'n_act'*/
|
||||
ll_p->head = lv_ll_get_next(ll_p, node_p);
|
||||
ll_p->head = _lv_ll_get_next(ll_p, node_p);
|
||||
if(ll_p->head == NULL) {
|
||||
ll_p->tail = NULL;
|
||||
}
|
||||
@@ -172,9 +172,9 @@ void lv_ll_remove(lv_ll_t * ll_p, void * node_p)
|
||||
node_set_prev(ll_p, ll_p->head, NULL);
|
||||
}
|
||||
}
|
||||
else if(lv_ll_get_tail(ll_p) == node_p) {
|
||||
else if(_lv_ll_get_tail(ll_p) == node_p) {
|
||||
/*The new tail will be the node before 'n_act'*/
|
||||
ll_p->tail = lv_ll_get_prev(ll_p, node_p);
|
||||
ll_p->tail = _lv_ll_get_prev(ll_p, node_p);
|
||||
if(ll_p->tail == NULL) {
|
||||
ll_p->head = NULL;
|
||||
}
|
||||
@@ -183,8 +183,8 @@ void lv_ll_remove(lv_ll_t * ll_p, void * node_p)
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_ll_node_t * n_prev = lv_ll_get_prev(ll_p, node_p);
|
||||
lv_ll_node_t * n_next = lv_ll_get_next(ll_p, node_p);
|
||||
lv_ll_node_t * n_prev = _lv_ll_get_prev(ll_p, node_p);
|
||||
lv_ll_node_t * n_next = _lv_ll_get_next(ll_p, node_p);
|
||||
|
||||
node_set_next(ll_p, n_prev, n_next);
|
||||
node_set_prev(ll_p, n_next, n_prev);
|
||||
@@ -195,18 +195,18 @@ void lv_ll_remove(lv_ll_t * ll_p, void * node_p)
|
||||
* Remove and free all elements from a linked list. The list remain valid but become empty.
|
||||
* @param ll_p pointer to linked list
|
||||
*/
|
||||
void lv_ll_clear(lv_ll_t * ll_p)
|
||||
void _lv_ll_clear(lv_ll_t * ll_p)
|
||||
{
|
||||
void * i;
|
||||
void * i_next;
|
||||
|
||||
i = lv_ll_get_head(ll_p);
|
||||
i = _lv_ll_get_head(ll_p);
|
||||
i_next = NULL;
|
||||
|
||||
while(i != NULL) {
|
||||
i_next = lv_ll_get_next(ll_p, i);
|
||||
i_next = _lv_ll_get_next(ll_p, i);
|
||||
|
||||
lv_ll_remove(ll_p, i);
|
||||
_lv_ll_remove(ll_p, i);
|
||||
lv_mem_free(i);
|
||||
|
||||
i = i_next;
|
||||
@@ -221,9 +221,9 @@ void lv_ll_clear(lv_ll_t * ll_p)
|
||||
* @param head true: be the head in the new list
|
||||
* false be the head in the new list
|
||||
*/
|
||||
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head)
|
||||
void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head)
|
||||
{
|
||||
lv_ll_remove(ll_ori_p, node);
|
||||
_lv_ll_remove(ll_ori_p, node);
|
||||
|
||||
if(head) {
|
||||
/*Set node as head*/
|
||||
@@ -260,7 +260,7 @@ void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool he
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the head of 'll_p'
|
||||
*/
|
||||
void * lv_ll_get_head(const lv_ll_t * ll_p)
|
||||
void * _lv_ll_get_head(const lv_ll_t * ll_p)
|
||||
{
|
||||
void * head = NULL;
|
||||
|
||||
@@ -276,7 +276,7 @@ void * lv_ll_get_head(const lv_ll_t * ll_p)
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the head of 'll_p'
|
||||
*/
|
||||
void * lv_ll_get_tail(const lv_ll_t * ll_p)
|
||||
void * _lv_ll_get_tail(const lv_ll_t * ll_p)
|
||||
{
|
||||
void * tail = NULL;
|
||||
|
||||
@@ -293,13 +293,13 @@ void * lv_ll_get_tail(const lv_ll_t * ll_p)
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the next node
|
||||
*/
|
||||
void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
||||
void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
||||
{
|
||||
void * next = NULL;
|
||||
|
||||
if(ll_p != NULL) {
|
||||
const lv_ll_node_t * n_act_d = n_act;
|
||||
lv_memcpy_small(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
|
||||
_lv_memcpy_small(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
|
||||
}
|
||||
|
||||
return next;
|
||||
@@ -311,13 +311,13 @@ void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the previous node
|
||||
*/
|
||||
void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
|
||||
void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
|
||||
{
|
||||
void * prev = NULL;
|
||||
|
||||
if(ll_p != NULL) {
|
||||
const lv_ll_node_t * n_act_d = n_act;
|
||||
lv_memcpy_small(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
|
||||
_lv_memcpy_small(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
|
||||
}
|
||||
|
||||
return prev;
|
||||
@@ -328,12 +328,12 @@ void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
|
||||
* @param ll_p pointer to linked list
|
||||
* @return length of the linked list
|
||||
*/
|
||||
uint32_t lv_ll_get_len(const lv_ll_t * ll_p)
|
||||
uint32_t _lv_ll_get_len(const lv_ll_t * ll_p)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
void * node;
|
||||
|
||||
for(node = lv_ll_get_head(ll_p); node != NULL; node = lv_ll_get_next(ll_p, node)) {
|
||||
for(node = _lv_ll_get_head(ll_p); node != NULL; node = _lv_ll_get_next(ll_p, node)) {
|
||||
len++;
|
||||
}
|
||||
|
||||
@@ -346,20 +346,20 @@ uint32_t lv_ll_get_len(const lv_ll_t * ll_p)
|
||||
* @param n_act pointer to node to move
|
||||
* @param n_after pointer to a node which should be after `n_act`
|
||||
*/
|
||||
void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
|
||||
void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
|
||||
{
|
||||
if(n_act == n_after) return; /*Can't move before itself*/
|
||||
|
||||
void * n_before;
|
||||
if(n_after != NULL)
|
||||
n_before = lv_ll_get_prev(ll_p, n_after);
|
||||
n_before = _lv_ll_get_prev(ll_p, n_after);
|
||||
else
|
||||
n_before = lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/
|
||||
n_before = _lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/
|
||||
|
||||
if(n_act == n_before) return; /*Already before `n_after`*/
|
||||
|
||||
/*It's much easier to remove from the list and add again*/
|
||||
lv_ll_remove(ll_p, n_act);
|
||||
_lv_ll_remove(ll_p, n_act);
|
||||
|
||||
/*Add again by setting the prev. and next nodes*/
|
||||
node_set_next(ll_p, n_before, n_act);
|
||||
@@ -379,7 +379,7 @@ void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after)
|
||||
* @param ll_p pointer to a linked list
|
||||
* @return true: the linked list is empty; false: not empty
|
||||
*/
|
||||
bool lv_ll_is_empty(lv_ll_t * ll_p)
|
||||
bool _lv_ll_is_empty(lv_ll_t * ll_p)
|
||||
{
|
||||
if(ll_p == NULL) return true;
|
||||
|
||||
@@ -404,9 +404,9 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
|
||||
|
||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
||||
if(prev)
|
||||
lv_memcpy_small(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
|
||||
_lv_memcpy_small(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
|
||||
else
|
||||
lv_memset_00(act + LL_PREV_P_OFFSET(ll_p), node_p_size);
|
||||
_lv_memset_00(act + LL_PREV_P_OFFSET(ll_p), node_p_size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,7 +421,7 @@ static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * nex
|
||||
|
||||
uint32_t node_p_size = sizeof(lv_ll_node_t *);
|
||||
if(next)
|
||||
lv_memcpy_small(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
|
||||
_lv_memcpy_small(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
|
||||
else
|
||||
lv_memset_00(act + LL_NEXT_P_OFFSET(ll_p), node_p_size);
|
||||
_lv_memset_00(act + LL_NEXT_P_OFFSET(ll_p), node_p_size);
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ typedef struct {
|
||||
* @param ll_dsc pointer to ll_dsc variable
|
||||
* @param node_size the size of 1 node in bytes
|
||||
*/
|
||||
void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size);
|
||||
void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size);
|
||||
|
||||
/**
|
||||
* Add a new head to a linked list
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the new head
|
||||
*/
|
||||
void * lv_ll_ins_head(lv_ll_t * ll_p);
|
||||
void * _lv_ll_ins_head(lv_ll_t * ll_p);
|
||||
|
||||
/**
|
||||
* Insert a new node in front of the n_act node
|
||||
@@ -60,14 +60,14 @@ void * lv_ll_ins_head(lv_ll_t * ll_p);
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the new head
|
||||
*/
|
||||
void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act);
|
||||
void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act);
|
||||
|
||||
/**
|
||||
* Add a new tail to a linked list
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the new tail
|
||||
*/
|
||||
void * lv_ll_ins_tail(lv_ll_t * ll_p);
|
||||
void * _lv_ll_ins_tail(lv_ll_t * ll_p);
|
||||
|
||||
/**
|
||||
* Remove the node 'node_p' from 'll_p' linked list.
|
||||
@@ -75,13 +75,13 @@ void * lv_ll_ins_tail(lv_ll_t * ll_p);
|
||||
* @param ll_p pointer to the linked list of 'node_p'
|
||||
* @param node_p pointer to node in 'll_p' linked list
|
||||
*/
|
||||
void lv_ll_remove(lv_ll_t * ll_p, void * node_p);
|
||||
void _lv_ll_remove(lv_ll_t * ll_p, void * node_p);
|
||||
|
||||
/**
|
||||
* Remove and free all elements from a linked list. The list remain valid but become empty.
|
||||
* @param ll_p pointer to linked list
|
||||
*/
|
||||
void lv_ll_clear(lv_ll_t * ll_p);
|
||||
void _lv_ll_clear(lv_ll_t * ll_p);
|
||||
|
||||
/**
|
||||
* Move a node to a new linked list
|
||||
@@ -91,21 +91,21 @@ void lv_ll_clear(lv_ll_t * ll_p);
|
||||
* @param head true: be the head in the new list
|
||||
* false be the head in the new list
|
||||
*/
|
||||
void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head);
|
||||
void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head);
|
||||
|
||||
/**
|
||||
* Return with head node of the linked list
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the head of 'll_p'
|
||||
*/
|
||||
void * lv_ll_get_head(const lv_ll_t * ll_p);
|
||||
void * _lv_ll_get_head(const lv_ll_t * ll_p);
|
||||
|
||||
/**
|
||||
* Return with tail node of the linked list
|
||||
* @param ll_p pointer to linked list
|
||||
* @return pointer to the head of 'll_p'
|
||||
*/
|
||||
void * lv_ll_get_tail(const lv_ll_t * ll_p);
|
||||
void * _lv_ll_get_tail(const lv_ll_t * ll_p);
|
||||
|
||||
/**
|
||||
* Return with the pointer of the next node after 'n_act'
|
||||
@@ -113,7 +113,7 @@ void * lv_ll_get_tail(const lv_ll_t * ll_p);
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the next node
|
||||
*/
|
||||
void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act);
|
||||
void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act);
|
||||
|
||||
/**
|
||||
* Return with the pointer of the previous node after 'n_act'
|
||||
@@ -121,14 +121,14 @@ void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act);
|
||||
* @param n_act pointer a node
|
||||
* @return pointer to the previous node
|
||||
*/
|
||||
void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act);
|
||||
void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act);
|
||||
|
||||
/**
|
||||
* Return the length of the linked list.
|
||||
* @param ll_p pointer to linked list
|
||||
* @return length of the linked list
|
||||
*/
|
||||
uint32_t lv_ll_get_len(const lv_ll_t * ll_p);
|
||||
uint32_t _lv_ll_get_len(const lv_ll_t * ll_p);
|
||||
|
||||
/**
|
||||
* TODO
|
||||
@@ -144,21 +144,22 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p);
|
||||
* @param n_act pointer to node to move
|
||||
* @param n_after pointer to a node which should be after `n_act`
|
||||
*/
|
||||
void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after);
|
||||
void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after);
|
||||
|
||||
/**
|
||||
* Check if a linked list is empty
|
||||
* @param ll_p pointer to a linked list
|
||||
* @return true: the linked list is empty; false: not empty
|
||||
*/
|
||||
bool lv_ll_is_empty(lv_ll_t * ll_p);
|
||||
bool _lv_ll_is_empty(lv_ll_t * ll_p);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#define LV_LL_READ(list, i) for(i = lv_ll_get_head(&list); i != NULL; i = lv_ll_get_next(&list, i))
|
||||
#define _LV_LL_READ(list, i) for(i = _lv_ll_get_head(&list); i != NULL; i = _lv_ll_get_next(&list, i))
|
||||
|
||||
#define LV_LL_READ_BACK(list, i) for(i = lv_ll_get_tail(&list); i != NULL; i = lv_ll_get_prev(&list, i))
|
||||
#define _LV_LL_READ_BACK(list, i) for(i = _lv_ll_get_tail(&list); i != NULL; i = _lv_ll_get_prev(&list, i))
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -63,7 +63,7 @@ void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb)
|
||||
* @param format printf-like format string
|
||||
* @param ... parameters for `format`
|
||||
*/
|
||||
void lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...)
|
||||
void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...)
|
||||
{
|
||||
if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/
|
||||
|
||||
|
||||
@@ -70,14 +70,14 @@ void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb);
|
||||
* @param format printf-like format string
|
||||
* @param ... parameters for `format`
|
||||
*/
|
||||
void lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...);
|
||||
void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE
|
||||
#define LV_LOG_TRACE(...) lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#define LV_LOG_TRACE(...) _lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#else
|
||||
#define LV_LOG_TRACE(...) \
|
||||
{ \
|
||||
@@ -86,7 +86,7 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
#endif
|
||||
|
||||
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO
|
||||
#define LV_LOG_INFO(...) lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#define LV_LOG_INFO(...) _lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#else
|
||||
#define LV_LOG_INFO(...) \
|
||||
{ \
|
||||
@@ -95,7 +95,7 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
#endif
|
||||
|
||||
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN
|
||||
#define LV_LOG_WARN(...) lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#define LV_LOG_WARN(...) _lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#else
|
||||
#define LV_LOG_WARN(...) \
|
||||
{ \
|
||||
@@ -104,7 +104,7 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
#endif
|
||||
|
||||
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR
|
||||
#define LV_LOG_ERROR(...) lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#define LV_LOG_ERROR(...) _lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#else
|
||||
#define LV_LOG_ERROR(...) \
|
||||
{ \
|
||||
@@ -113,7 +113,7 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
#endif
|
||||
|
||||
#if LV_LOG_LEVEL <= LV_LOG_LEVEL_USER
|
||||
#define LV_LOG_USER(...) lv_log_add(LV_LOG_LEVEL_USER, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#define LV_LOG_USER(...) _lv_log_add(LV_LOG_LEVEL_USER, __FILE__, __LINE__, __func__, __VA_ARGS__);
|
||||
#else
|
||||
#define LV_LOG_USER(...) \
|
||||
{ \
|
||||
@@ -124,7 +124,7 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
#else /*LV_USE_LOG*/
|
||||
|
||||
/*Do nothing if `LV_USE_LOG 0`*/
|
||||
#define lv_log_add(level, file, line, ...) \
|
||||
#define _lv_log_add(level, file, line, ...) \
|
||||
{ \
|
||||
; \
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ static const int16_t sin0_90_table[] = {
|
||||
* @param angle
|
||||
* @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_sin(int16_t angle)
|
||||
LV_ATTRIBUTE_FAST_MEM int16_t _lv_trigo_sin(int16_t angle)
|
||||
{
|
||||
int16_t ret = 0;
|
||||
angle = angle % 360;
|
||||
@@ -85,7 +85,7 @@ LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_sin(int16_t angle)
|
||||
* @param u3 end values in range of [0..LV_BEZIER_VAL_MAX]
|
||||
* @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX]
|
||||
*/
|
||||
int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3)
|
||||
int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3)
|
||||
{
|
||||
uint32_t t_rem = 1024 - t;
|
||||
uint32_t t_rem2 = (t_rem * t_rem) >> 10;
|
||||
@@ -111,7 +111,7 @@ int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3)
|
||||
* If root < 256: mask = 0x800
|
||||
* Else: mask = 0x8000
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask)
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask)
|
||||
{
|
||||
x = x << 8; /*To get 4 bit precision. (sqrt(256) = 16 = 4 bit)*/
|
||||
|
||||
@@ -120,12 +120,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask)
|
||||
// http://ww1.microchip.com/...en/AppNotes/91040a.pdf
|
||||
do {
|
||||
trial = root + mask;
|
||||
if ((uint32_t)trial * trial <= x) root = trial;
|
||||
if((uint32_t)trial * trial <= x) root = trial;
|
||||
mask = mask >> 1;
|
||||
} while(mask);
|
||||
|
||||
q->i = (uint32_t) root >> 4;
|
||||
q->f = (uint32_t) (root & 0xf) << 4;
|
||||
q->f = (uint32_t)(root & 0xf) << 4;
|
||||
}
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask)
|
||||
* @param y
|
||||
* @return the angle in degree calculated from the given parameters in range of [0..360]
|
||||
*/
|
||||
uint16_t lv_atan2(int x, int y)
|
||||
uint16_t _lv_atan2(int x, int y)
|
||||
{
|
||||
// Fast XY vector to integer degree algorithm - Jan 2011 www.RomanBlack.com
|
||||
// Converts any XY values including 0 to a degree value that should be
|
||||
@@ -213,6 +213,25 @@ uint16_t lv_atan2(int x, int y)
|
||||
return degree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the integer exponents.
|
||||
* @param base
|
||||
* @param power
|
||||
* @return base raised to the power exponent
|
||||
*/
|
||||
int64_t _lv_pow(int64_t base, int8_t exp)
|
||||
{
|
||||
int64_t result = 1;
|
||||
while(exp) {
|
||||
if(exp & 1)
|
||||
result *= base;
|
||||
exp >>= 1;
|
||||
base *= base;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -58,12 +58,15 @@ typedef struct {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
/**
|
||||
* Return with sinus of an angle
|
||||
* @param angle
|
||||
* @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_sin(int16_t angle);
|
||||
LV_ATTRIBUTE_FAST_MEM int16_t _lv_trigo_sin(int16_t angle);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Calculate a value of a Cubic Bezier function.
|
||||
@@ -74,15 +77,18 @@ LV_ATTRIBUTE_FAST_MEM int16_t lv_trigo_sin(int16_t angle);
|
||||
* @param u3 end values in range of [0..LV_BEZIER_VAL_MAX]
|
||||
* @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX]
|
||||
*/
|
||||
int32_t lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3);
|
||||
int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3);
|
||||
|
||||
/*
|
||||
/**
|
||||
* Calculate the atan2 of a vector.
|
||||
* @param x
|
||||
* @param y
|
||||
* @return the angle in degree calculated from the given parameters in range of [0..360]
|
||||
*/
|
||||
uint16_t lv_atan2(int x, int y);
|
||||
uint16_t _lv_atan2(int x, int y);
|
||||
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Get the square root of a number
|
||||
@@ -94,7 +100,17 @@ uint16_t lv_atan2(int x, int y);
|
||||
* If root < 256: mask = 0x800
|
||||
* Else: mask = 0x8000
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask);
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* Calculate the integer exponents.
|
||||
* @param base
|
||||
* @param power
|
||||
* @return base raised to the power exponent
|
||||
*/
|
||||
int64_t _lv_pow(int64_t base, int8_t exp);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -66,6 +66,8 @@ typedef struct {
|
||||
#define ALIGN_MASK 0x3
|
||||
#endif
|
||||
|
||||
#define MEM_BUF_SMALL_SIZE 16
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
@@ -84,6 +86,14 @@ typedef struct {
|
||||
|
||||
static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/
|
||||
|
||||
|
||||
static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE];
|
||||
static uint8_t mem_buf2_32[MEM_BUF_SMALL_SIZE];
|
||||
|
||||
static lv_mem_buf_t mem_buf_small[] = {{.p = mem_buf1_32, .size = MEM_BUF_SMALL_SIZE, .used = 0},
|
||||
{.p = mem_buf2_32, .size = MEM_BUF_SMALL_SIZE, .used = 0}
|
||||
};
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -100,7 +110,7 @@ static uint32_t zero_mem; /*Give the address of this variable if 0 byte should b
|
||||
/**
|
||||
* Initiaiize the dyn_mem module (work memory and other variables)
|
||||
*/
|
||||
void lv_mem_init(void)
|
||||
void _lv_mem_init(void)
|
||||
{
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
|
||||
@@ -123,10 +133,10 @@ void lv_mem_init(void)
|
||||
* Clean up the memory buffer which frees all the allocated memories.
|
||||
* @note It work only if `LV_MEM_CUSTOM == 0`
|
||||
*/
|
||||
void lv_mem_deinit(void)
|
||||
void _lv_mem_deinit(void)
|
||||
{
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
lv_memset_00(work_mem, (LV_MEM_SIZE / sizeof(MEM_UNIT)) * sizeof(MEM_UNIT));
|
||||
_lv_memset_00(work_mem, (LV_MEM_SIZE / sizeof(MEM_UNIT)) * sizeof(MEM_UNIT));
|
||||
lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem;
|
||||
full->header.s.used = 0;
|
||||
/*The total mem size id reduced by the first header and the close patterns */
|
||||
@@ -193,7 +203,7 @@ void * lv_mem_alloc(size_t size)
|
||||
#endif /* LV_MEM_CUSTOM */
|
||||
|
||||
#if LV_MEM_ADD_JUNK
|
||||
if(alloc != NULL) lv_memset(alloc, 0xaa, size);
|
||||
if(alloc != NULL) _lv_memset(alloc, 0xaa, size);
|
||||
#endif
|
||||
|
||||
if(alloc == NULL) LV_LOG_WARN("Couldn't allocate memory");
|
||||
@@ -211,7 +221,7 @@ void lv_mem_free(const void * data)
|
||||
if(data == NULL) return;
|
||||
|
||||
#if LV_MEM_ADD_JUNK
|
||||
lv_memset((void *)data, 0xbb, lv_mem_get_size(data));
|
||||
_lv_memset((void *)data, 0xbb, _lv_mem_get_size(data));
|
||||
#endif
|
||||
|
||||
#if LV_ENABLE_GC == 0
|
||||
@@ -238,7 +248,8 @@ void lv_mem_free(const void * data)
|
||||
}
|
||||
e_next = ent_get_next(e_next);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
full_defrag_cnt = 0;
|
||||
lv_mem_defrag();
|
||||
|
||||
@@ -290,7 +301,7 @@ void * lv_mem_realloc(void * data_p, size_t new_size)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t old_size = lv_mem_get_size(data_p);
|
||||
uint32_t old_size = _lv_mem_get_size(data_p);
|
||||
if(old_size == new_size) return data_p; /*Also avoid reallocating the same memory*/
|
||||
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
@@ -312,7 +323,7 @@ void * lv_mem_realloc(void * data_p, size_t new_size)
|
||||
if(data_p != NULL) {
|
||||
/*Copy the old data to the new. Use the smaller size*/
|
||||
if(old_size != 0) {
|
||||
lv_memcpy(new_p, data_p, LV_MATH_MIN(new_size, old_size));
|
||||
_lv_memcpy(new_p, data_p, LV_MATH_MIN(new_size, old_size));
|
||||
lv_mem_free(data_p);
|
||||
}
|
||||
}
|
||||
@@ -385,7 +396,7 @@ lv_res_t lv_mem_test(void)
|
||||
if(e->header.s.d_size > LV_MEM_SIZE) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
uint8_t * e8 = (uint8_t*) e;
|
||||
uint8_t * e8 = (uint8_t *) e;
|
||||
if(e8 + e->header.s.d_size > work_mem + LV_MEM_SIZE) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@@ -403,7 +414,7 @@ lv_res_t lv_mem_test(void)
|
||||
void lv_mem_monitor(lv_mem_monitor_t * mon_p)
|
||||
{
|
||||
/*Init the data*/
|
||||
lv_memset(mon_p, 0, sizeof(lv_mem_monitor_t));
|
||||
_lv_memset(mon_p, 0, sizeof(lv_mem_monitor_t));
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
lv_mem_ent_t * e;
|
||||
e = NULL;
|
||||
@@ -429,7 +440,8 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p)
|
||||
if(mon_p->free_size > 0) {
|
||||
mon_p->frag_pct = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size;
|
||||
mon_p->frag_pct = 100 - mon_p->frag_pct;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mon_p->frag_pct = 0; /*no fragmentation if all the RAM is used*/
|
||||
}
|
||||
#endif
|
||||
@@ -443,7 +455,7 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p)
|
||||
|
||||
#if LV_ENABLE_GC == 0
|
||||
|
||||
uint32_t lv_mem_get_size(const void * data)
|
||||
uint32_t _lv_mem_get_size(const void * data)
|
||||
{
|
||||
if(data == NULL) return 0;
|
||||
if(data == &zero_mem) return 0;
|
||||
@@ -455,7 +467,7 @@ uint32_t lv_mem_get_size(const void * data)
|
||||
|
||||
#else /* LV_ENABLE_GC */
|
||||
|
||||
uint32_t lv_mem_get_size(const void * data)
|
||||
uint32_t _lv_mem_get_size(const void * data)
|
||||
{
|
||||
return LV_MEM_CUSTOM_GET_SIZE(data);
|
||||
}
|
||||
@@ -466,19 +478,45 @@ uint32_t lv_mem_get_size(const void * data)
|
||||
* Get a temporal buffer with the given size.
|
||||
* @param size the required size
|
||||
*/
|
||||
void * lv_mem_buf_get(uint32_t size)
|
||||
void * _lv_mem_buf_get(uint32_t size)
|
||||
{
|
||||
if(size == 0) return NULL;
|
||||
|
||||
/*Try to find a free buffer with suitable size */
|
||||
/*Try small static buffers first*/
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0 && LV_GC_ROOT(_lv_mem_buf[i]).size >= size) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).used = 1;
|
||||
return LV_GC_ROOT(_lv_mem_buf[i]).p;
|
||||
if(size <= MEM_BUF_SMALL_SIZE) {
|
||||
for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) {
|
||||
if(mem_buf_small[i].used == 0) {
|
||||
mem_buf_small[i].used = 1;
|
||||
return mem_buf_small[i].p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Try to find a free buffer with suitable size */
|
||||
int8_t i_guess = -1;
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0 && LV_GC_ROOT(_lv_mem_buf[i]).size >= size) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).size == size) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).used = 1;
|
||||
return LV_GC_ROOT(_lv_mem_buf[i]).p;
|
||||
}
|
||||
else if(i_guess < 0) {
|
||||
i_guess = i;
|
||||
}
|
||||
/*If size of `i` is closer to `size` prefer it*/
|
||||
else if(LV_GC_ROOT(_lv_mem_buf[i]).size < LV_GC_ROOT(_lv_mem_buf[i_guess]).size) {
|
||||
i_guess = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(i_guess >= 0) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i_guess]).used = 1;
|
||||
return LV_GC_ROOT(_lv_mem_buf[i_guess]).p;
|
||||
}
|
||||
|
||||
|
||||
/*Reallocate a free buffer*/
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0) {
|
||||
@@ -502,9 +540,18 @@ void * lv_mem_buf_get(uint32_t size)
|
||||
* Release a memory buffer
|
||||
* @param p buffer to release
|
||||
*/
|
||||
void lv_mem_buf_release(void * p)
|
||||
void _lv_mem_buf_release(void * p)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
/*Try small static buffers first*/
|
||||
for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) {
|
||||
if(mem_buf_small[i].p == p) {
|
||||
mem_buf_small[i].used = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).p == p) {
|
||||
LV_GC_ROOT(_lv_mem_buf[i]).used = 0;
|
||||
@@ -518,9 +565,13 @@ void lv_mem_buf_release(void * p)
|
||||
/**
|
||||
* Free all memory buffers
|
||||
*/
|
||||
void lv_mem_buf_free_all(void)
|
||||
void _lv_mem_buf_free_all(void)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) {
|
||||
mem_buf_small[i].used = 0;
|
||||
}
|
||||
|
||||
for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) {
|
||||
if(LV_GC_ROOT(_lv_mem_buf[i]).p) {
|
||||
lv_mem_free(LV_GC_ROOT(_lv_mem_buf[i]).p);
|
||||
@@ -537,7 +588,7 @@ void lv_mem_buf_free_all(void)
|
||||
* @param src pointer to the source buffer
|
||||
* @param len number of byte to copy
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void * lv_memcpy(void * dst, const void * src, size_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM void * _lv_memcpy(void * dst, const void * src, size_t len)
|
||||
{
|
||||
uint8_t * d8 = dst;
|
||||
const uint8_t * s8 = src;
|
||||
@@ -602,7 +653,7 @@ LV_ATTRIBUTE_FAST_MEM void * lv_memcpy(void * dst, const void * src, size_t len)
|
||||
* @param v value to set [0..255]
|
||||
* @param len number of byte to set
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_memset(void * dst, uint8_t v, size_t len)
|
||||
{
|
||||
|
||||
uint8_t * d8 = (uint8_t *) dst;
|
||||
@@ -656,7 +707,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len)
|
||||
* @param dst pointer to the destination buffer
|
||||
* @param len number of byte to set
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_memset_00(void * dst, size_t len)
|
||||
{
|
||||
uint8_t * d8 = (uint8_t *) dst;
|
||||
uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK;
|
||||
@@ -706,7 +757,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len)
|
||||
* @param dst pointer to the destination buffer
|
||||
* @param len number of byte to set
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_memset_ff(void * dst, size_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len)
|
||||
{
|
||||
uint8_t * d8 = (uint8_t *) dst;
|
||||
uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK;
|
||||
|
||||
@@ -61,13 +61,13 @@ extern lv_mem_buf_arr_t _lv_mem_buf;
|
||||
/**
|
||||
* Initiaize the dyn_mem module (work memory and other variables)
|
||||
*/
|
||||
void lv_mem_init(void);
|
||||
void _lv_mem_init(void);
|
||||
|
||||
/**
|
||||
* Clean up the memory buffer which frees all the allocated memories.
|
||||
* @note It work only if `LV_MEM_CUSTOM == 0`
|
||||
*/
|
||||
void lv_mem_deinit(void);
|
||||
void _lv_mem_deinit(void);
|
||||
|
||||
/**
|
||||
* Allocate a memory dynamically
|
||||
@@ -114,24 +114,27 @@ void lv_mem_monitor(lv_mem_monitor_t * mon_p);
|
||||
* @param data pointer to an allocated memory
|
||||
* @return the size of data memory in bytes
|
||||
*/
|
||||
uint32_t lv_mem_get_size(const void * data);
|
||||
uint32_t _lv_mem_get_size(const void * data);
|
||||
|
||||
/**
|
||||
* Get a temporal buffer with the given size.
|
||||
* @param size the required size
|
||||
*/
|
||||
void * lv_mem_buf_get(uint32_t size);
|
||||
void * _lv_mem_buf_get(uint32_t size);
|
||||
|
||||
/**
|
||||
* Release a memory buffer
|
||||
* @param p buffer to release
|
||||
*/
|
||||
void lv_mem_buf_release(void * p);
|
||||
void _lv_mem_buf_release(void * p);
|
||||
|
||||
/**
|
||||
* Free all memory buffers
|
||||
*/
|
||||
void lv_mem_buf_free_all(void);
|
||||
void _lv_mem_buf_free_all(void);
|
||||
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
/**
|
||||
* Same as `memcpy` but optimized for 4 byte operation.
|
||||
@@ -139,7 +142,7 @@ void lv_mem_buf_free_all(void);
|
||||
* @param src pointer to the source buffer
|
||||
* @param len number of byte to copy
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void * lv_memcpy(void * dst, const void * src, size_t len);
|
||||
LV_ATTRIBUTE_FAST_MEM void * _lv_memcpy(void * dst, const void * src, size_t len);
|
||||
|
||||
/**
|
||||
* Same as `memcpy` but optimized to copy only a few bytes.
|
||||
@@ -147,13 +150,15 @@ LV_ATTRIBUTE_FAST_MEM void * lv_memcpy(void * dst, const void * src, size_t len)
|
||||
* @param src pointer to the source buffer
|
||||
* @param len number of byte to copy
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void * lv_memcpy_small(void * dst, const void * src, size_t len)
|
||||
LV_ATTRIBUTE_FAST_MEM static inline void * _lv_memcpy_small(void * dst, const void * src, size_t len)
|
||||
{
|
||||
uint8_t * d8 = (uint8_t *)dst;
|
||||
const uint8_t * s8 = (const uint8_t *)src;
|
||||
|
||||
while(len) {
|
||||
*d8 = *s8; d8++; s8++;
|
||||
*d8 = *s8;
|
||||
d8++;
|
||||
s8++;
|
||||
len--;
|
||||
}
|
||||
|
||||
@@ -167,7 +172,7 @@ LV_ATTRIBUTE_FAST_MEM static inline void * lv_memcpy_small(void * dst, const voi
|
||||
* @param v value to set [0..255]
|
||||
* @param len number of byte to set
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len);
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_memset(void * dst, uint8_t v, size_t len);
|
||||
|
||||
/**
|
||||
* Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation.
|
||||
@@ -175,7 +180,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset(void * dst, uint8_t v, size_t len);
|
||||
* @param dst pointer to the destination buffer
|
||||
* @param len number of byte to set
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len);
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_memset_00(void * dst, size_t len);
|
||||
|
||||
/**
|
||||
* Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation.
|
||||
@@ -183,7 +188,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_memset_00(void * dst, size_t len);
|
||||
* @param dst pointer to the destination buffer
|
||||
* @param len number of byte to set
|
||||
*/
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_memset_ff(void * dst, size_t len);
|
||||
LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len);
|
||||
|
||||
//! @endcond
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
CSRCS += lv_circ.c
|
||||
CSRCS += lv_area.c
|
||||
CSRCS += lv_task.c
|
||||
CSRCS += lv_fs.c
|
||||
|
||||
@@ -54,9 +54,9 @@ static bool task_created;
|
||||
/**
|
||||
* Init the lv_task module
|
||||
*/
|
||||
void lv_task_core_init(void)
|
||||
void _lv_task_core_init(void)
|
||||
{
|
||||
lv_ll_init(&LV_GC_ROOT(_lv_task_ll), sizeof(lv_task_t));
|
||||
_lv_ll_init(&LV_GC_ROOT(_lv_task_ll), sizeof(lv_task_t));
|
||||
|
||||
task_list_changed = false;
|
||||
/*Initially enable the lv_task handling*/
|
||||
@@ -100,11 +100,11 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void)
|
||||
end_flag = true;
|
||||
task_deleted = false;
|
||||
task_created = false;
|
||||
LV_GC_ROOT(_lv_task_act) = lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
LV_GC_ROOT(_lv_task_act) = _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
while(LV_GC_ROOT(_lv_task_act)) {
|
||||
/* The task might be deleted if it runs only once ('once = 1')
|
||||
* So get next element until the current is surely valid*/
|
||||
next = lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), LV_GC_ROOT(_lv_task_act));
|
||||
next = _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), LV_GC_ROOT(_lv_task_act));
|
||||
|
||||
/*We reach priority of the turned off task. There is nothing more to do.*/
|
||||
if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio == LV_TASK_PRIO_OFF) {
|
||||
@@ -176,7 +176,7 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void)
|
||||
}
|
||||
|
||||
time_till_next = LV_NO_TASK_READY;
|
||||
next = lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
next = _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
while(next) {
|
||||
if(next->prio != LV_TASK_PRIO_OFF) {
|
||||
uint32_t delay = lv_task_time_remaining(next);
|
||||
@@ -184,7 +184,7 @@ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void)
|
||||
time_till_next = delay;
|
||||
}
|
||||
|
||||
next = lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), next); /*Find the next task*/
|
||||
next = _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), next); /*Find the next task*/
|
||||
}
|
||||
|
||||
already_running = false; /*Release the mutex*/
|
||||
@@ -203,11 +203,11 @@ lv_task_t * lv_task_create_basic(void)
|
||||
lv_task_t * tmp;
|
||||
|
||||
/*Create task lists in order of priority from high to low*/
|
||||
tmp = lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
tmp = _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
|
||||
/*It's the first task*/
|
||||
if(NULL == tmp) {
|
||||
new_task = lv_ll_ins_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
new_task = _lv_ll_ins_head(&LV_GC_ROOT(_lv_task_ll));
|
||||
LV_ASSERT_MEM(new_task);
|
||||
if(new_task == NULL) return NULL;
|
||||
}
|
||||
@@ -215,17 +215,17 @@ lv_task_t * lv_task_create_basic(void)
|
||||
else {
|
||||
do {
|
||||
if(tmp->prio <= DEF_PRIO) {
|
||||
new_task = lv_ll_ins_prev(&LV_GC_ROOT(_lv_task_ll), tmp);
|
||||
new_task = _lv_ll_ins_prev(&LV_GC_ROOT(_lv_task_ll), tmp);
|
||||
LV_ASSERT_MEM(new_task);
|
||||
if(new_task == NULL) return NULL;
|
||||
break;
|
||||
}
|
||||
tmp = lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), tmp);
|
||||
tmp = _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), tmp);
|
||||
} while(tmp != NULL);
|
||||
|
||||
/*Only too high priority tasks were found. Add the task to the end*/
|
||||
if(tmp == NULL) {
|
||||
new_task = lv_ll_ins_tail(&LV_GC_ROOT(_lv_task_ll));
|
||||
new_task = _lv_ll_ins_tail(&LV_GC_ROOT(_lv_task_ll));
|
||||
LV_ASSERT_MEM(new_task);
|
||||
if(new_task == NULL) return NULL;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb)
|
||||
*/
|
||||
void lv_task_del(lv_task_t * task)
|
||||
{
|
||||
lv_ll_remove(&LV_GC_ROOT(_lv_task_ll), task);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_task_ll), task);
|
||||
task_list_changed = true;
|
||||
|
||||
lv_mem_free(task);
|
||||
@@ -305,16 +305,16 @@ void lv_task_set_prio(lv_task_t * task, lv_task_prio_t prio)
|
||||
|
||||
/*Find the tasks with new priority*/
|
||||
lv_task_t * i;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_task_ll), i) {
|
||||
_LV_LL_READ(LV_GC_ROOT(_lv_task_ll), i) {
|
||||
if(i->prio <= prio) {
|
||||
if(i != task) lv_ll_move_before(&LV_GC_ROOT(_lv_task_ll), task, i);
|
||||
if(i != task) _lv_ll_move_before(&LV_GC_ROOT(_lv_task_ll), task, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*There was no such a low priority so far then add the node to the tail*/
|
||||
if(i == NULL) {
|
||||
lv_ll_move_before(&LV_GC_ROOT(_lv_task_ll), task, NULL);
|
||||
_lv_ll_move_before(&LV_GC_ROOT(_lv_task_ll), task, NULL);
|
||||
}
|
||||
task_list_changed = true;
|
||||
|
||||
@@ -341,7 +341,7 @@ void lv_task_ready(lv_task_t * task)
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of times a task will repeat.
|
||||
* Set the number of times a task will repeat.
|
||||
* @param task pointer to a lv_task.
|
||||
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
|
||||
*/
|
||||
@@ -404,7 +404,7 @@ static bool lv_task_exec(lv_task_t * task)
|
||||
}
|
||||
if(task->repeat_count == 0) {
|
||||
lv_task_del(task);
|
||||
}
|
||||
}
|
||||
}
|
||||
exec = true;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ typedef struct _lv_task_t {
|
||||
/**
|
||||
* Init the lv_task module
|
||||
*/
|
||||
void lv_task_core_init(void);
|
||||
void _lv_task_core_init(void);
|
||||
|
||||
//! @cond Doxygen_Suppress
|
||||
|
||||
@@ -140,7 +140,7 @@ void lv_task_set_period(lv_task_t * task, uint32_t period);
|
||||
void lv_task_ready(lv_task_t * task);
|
||||
|
||||
/**
|
||||
* Set the number of times a task will repeat.
|
||||
* Set the number of times a task will repeat.
|
||||
* @param task pointer to a lv_task.
|
||||
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
/* This typedef exists purely to keep -Wpedantic happy when the file is empty. */
|
||||
/* It can be removed. */
|
||||
typedef int keep_pedantic_happy;
|
||||
typedef int _keep_pedantic_happy;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
|
||||
@@ -51,23 +51,23 @@ static inline bool is_break_char(uint32_t letter);
|
||||
* GLOBAL VARIABLES
|
||||
**********************/
|
||||
#if LV_TXT_ENC == LV_TXT_ENC_UTF8
|
||||
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_utf8_size;
|
||||
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_utf8;
|
||||
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_utf8_conv_wc;
|
||||
uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_utf8_next;
|
||||
uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_utf8_prev;
|
||||
uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_utf8_get_byte_id;
|
||||
uint32_t (*lv_txt_encoded_get_char_id)(const char *, uint32_t) = lv_txt_utf8_get_char_id;
|
||||
uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_utf8_get_length;
|
||||
uint8_t (*_lv_txt_encoded_size)(const char *) = lv_txt_utf8_size;
|
||||
uint32_t (*_lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_utf8;
|
||||
uint32_t (*_lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_utf8_conv_wc;
|
||||
uint32_t (*_lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_utf8_next;
|
||||
uint32_t (*_lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_utf8_prev;
|
||||
uint32_t (*_lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_utf8_get_byte_id;
|
||||
uint32_t (*_lv_txt_encoded_get_char_id)(const char *, uint32_t) = lv_txt_utf8_get_char_id;
|
||||
uint32_t (*_lv_txt_get_encoded_length)(const char *) = lv_txt_utf8_get_length;
|
||||
#elif LV_TXT_ENC == LV_TXT_ENC_ASCII
|
||||
uint8_t (*lv_txt_encoded_size)(const char *) = lv_txt_iso8859_1_size;
|
||||
uint32_t (*lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_iso8859_1;
|
||||
uint32_t (*lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_iso8859_1_conv_wc;
|
||||
uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_iso8859_1_next;
|
||||
uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_iso8859_1_prev;
|
||||
uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_byte_id;
|
||||
uint32_t (*lv_txt_encoded_get_char_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_char_id;
|
||||
uint32_t (*lv_txt_get_encoded_length)(const char *) = lv_txt_iso8859_1_get_length;
|
||||
uint8_t (*_lv_txt_encoded_size)(const char *) = lv_txt_iso8859_1_size;
|
||||
uint32_t (*_lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_iso8859_1;
|
||||
uint32_t (*_lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_iso8859_1_conv_wc;
|
||||
uint32_t (*_lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_iso8859_1_next;
|
||||
uint32_t (*_lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_iso8859_1_prev;
|
||||
uint32_t (*_lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_byte_id;
|
||||
uint32_t (*_lv_txt_encoded_get_char_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_char_id;
|
||||
uint32_t (*_lv_txt_get_encoded_length)(const char *) = lv_txt_iso8859_1_get_length;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -83,15 +83,15 @@ static inline bool is_break_char(uint32_t letter);
|
||||
* Get size of a text
|
||||
* @param size_res pointer to a 'point_t' variable to store the result
|
||||
* @param text pointer to a text
|
||||
* @param font pinter to font of the text
|
||||
* @param font pointer to font of the text
|
||||
* @param letter_space letter space of the text
|
||||
* @param txt.line_space line space of the text
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @param max_width max with of the text (break the lines to fit this size) Set CORD_MAX to avoid
|
||||
* line breaks
|
||||
*/
|
||||
void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||
void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||
{
|
||||
size_res->x = 0;
|
||||
size_res->y = 0;
|
||||
@@ -107,7 +107,7 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
|
||||
|
||||
/*Calc. the height and longest line*/
|
||||
while(text[line_start] != '\0') {
|
||||
new_line_start += lv_txt_get_next_line(&text[line_start], font, letter_space, max_width, flag);
|
||||
new_line_start += _lv_txt_get_next_line(&text[line_start], font, letter_space, max_width, flag);
|
||||
|
||||
if((unsigned long)size_res->y + (unsigned long)letter_height + (unsigned long)line_space > LV_MAX_OF(lv_coord_t)) {
|
||||
LV_LOG_WARN("lv_txt_get_size: integer overflow while calculating text height");
|
||||
@@ -119,7 +119,8 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
|
||||
}
|
||||
|
||||
/*Calculate the the longest line*/
|
||||
lv_coord_t act_line_length = lv_txt_get_width(&text[line_start], new_line_start - line_start, font, letter_space, flag);
|
||||
lv_coord_t act_line_length = _lv_txt_get_width(&text[line_start], new_line_start - line_start, font, letter_space,
|
||||
flag);
|
||||
|
||||
size_res->x = LV_MATH_MAX(act_line_length, size_res->x);
|
||||
line_start = new_line_start;
|
||||
@@ -186,17 +187,17 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||
uint32_t break_index = NO_BREAK_FOUND; /* only used for "long" words */
|
||||
uint32_t break_letter_count = 0; /* Number of characters up to the long word break point */
|
||||
|
||||
letter = lv_txt_encoded_next(txt, &i_next);
|
||||
letter = _lv_txt_encoded_next(txt, &i_next);
|
||||
i_next_next = i_next;
|
||||
|
||||
/* Obtain the full word, regardless if it fits or not in max_width */
|
||||
while(txt[i] != '\0') {
|
||||
letter_next = lv_txt_encoded_next(txt, &i_next_next);
|
||||
letter_next = _lv_txt_encoded_next(txt, &i_next_next);
|
||||
word_len++;
|
||||
|
||||
/*Handle the recolor command*/
|
||||
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
|
||||
if(lv_txt_is_cmd(cmd_state, letter) != false) {
|
||||
if(_lv_txt_is_cmd(cmd_state, letter) != false) {
|
||||
i = i_next;
|
||||
i_next = i_next_next;
|
||||
letter = letter_next;
|
||||
@@ -263,7 +264,7 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||
int32_t n_move = LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN - (word_len - break_letter_count);
|
||||
/* Move pointer "i" backwards */
|
||||
for(; n_move > 0; n_move--) {
|
||||
lv_txt_encoded_prev(txt, &i);
|
||||
_lv_txt_encoded_prev(txt, &i);
|
||||
// TODO: it would be appropriate to update the returned word width here
|
||||
// However, in current usage, this doesn't impact anything.
|
||||
}
|
||||
@@ -289,8 +290,8 @@ static uint16_t lv_txt_get_next_word(const char * txt, const lv_font_t * font,
|
||||
* @param flags settings for the text from 'txt_flag_type' enum
|
||||
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different)
|
||||
*/
|
||||
uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||
uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
if(font == NULL) return 0;
|
||||
@@ -316,7 +317,7 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
max_width -= word_w;
|
||||
|
||||
if(advance == 0) {
|
||||
if(i == 0) lv_txt_encoded_next(txt, &i); // prevent inf loops
|
||||
if(i == 0) _lv_txt_encoded_next(txt, &i); // prevent inf loops
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -333,7 +334,7 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
|
||||
/* Always step at least one to avoid infinite loops */
|
||||
if(i == 0) {
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
_lv_txt_encoded_next(txt, &i);
|
||||
}
|
||||
|
||||
return i;
|
||||
@@ -349,8 +350,8 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_txt_flag_t flag)
|
||||
lv_coord_t _lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_txt_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
if(font == NULL) return 0;
|
||||
@@ -361,10 +362,10 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t *
|
||||
|
||||
if(length != 0) {
|
||||
while(i < length) {
|
||||
uint32_t letter = lv_txt_encoded_next(txt, &i);
|
||||
uint32_t letter_next = lv_txt_encoded_next(&txt[i], NULL);
|
||||
uint32_t letter = _lv_txt_encoded_next(txt, &i);
|
||||
uint32_t letter_next = _lv_txt_encoded_next(&txt[i], NULL);
|
||||
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
|
||||
if(lv_txt_is_cmd(&cmd_state, letter) != false) {
|
||||
if(_lv_txt_is_cmd(&cmd_state, letter) != false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -393,7 +394,7 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t *
|
||||
* @return true: the character is part of a command and should not be written,
|
||||
* false: the character should be written
|
||||
*/
|
||||
bool lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c)
|
||||
bool _lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
@@ -431,12 +432,12 @@ bool lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c)
|
||||
* UTF-8) 0: before the original text, 1: after the first char etc.
|
||||
* @param ins_txt text to insert
|
||||
*/
|
||||
void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
||||
void _lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
||||
{
|
||||
size_t old_len = strlen(txt_buf);
|
||||
size_t ins_len = strlen(ins_txt);
|
||||
size_t new_len = ins_len + old_len;
|
||||
pos = lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/
|
||||
pos = _lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/
|
||||
|
||||
/*Copy the second part into the end to make place to text to insert*/
|
||||
size_t i;
|
||||
@@ -445,7 +446,7 @@ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
||||
}
|
||||
|
||||
/* Copy the text into the new space*/
|
||||
lv_memcpy_small(txt_buf + pos, ins_txt, ins_len);
|
||||
_lv_memcpy_small(txt_buf + pos, ins_txt, ins_len);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,13 +456,13 @@ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
|
||||
* char etc.)
|
||||
* @param len number of characters to delete
|
||||
*/
|
||||
void lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
|
||||
void _lv_txt_cut(char * txt, uint32_t pos, uint32_t len)
|
||||
{
|
||||
|
||||
size_t old_len = strlen(txt);
|
||||
|
||||
pos = lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/
|
||||
len = lv_txt_encoded_get_byte_id(&txt[pos], len);
|
||||
pos = _lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/
|
||||
len = _lv_txt_encoded_get_byte_id(&txt[pos], len);
|
||||
|
||||
/*Copy the second part into the end to make place to text to insert*/
|
||||
uint32_t i;
|
||||
@@ -537,7 +538,7 @@ static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
|
||||
if((c & 0x80) != 0) {
|
||||
uint32_t swapped;
|
||||
uint8_t c8[4];
|
||||
lv_memcpy_small(c8, &c, 4);
|
||||
_lv_memcpy_small(c8, &c, 4);
|
||||
swapped = (c8[0] << 24) + (c8[1] << 16) + (c8[2] << 8) + (c8[3]);
|
||||
uint8_t i;
|
||||
for(i = 0; i < 4; i++) {
|
||||
@@ -642,7 +643,7 @@ static uint32_t lv_txt_utf8_prev(const char * txt, uint32_t * i)
|
||||
do {
|
||||
if(cnt >= 4) return 0; /*No UTF-8 char found before the initial*/
|
||||
|
||||
c_size = lv_txt_encoded_size(&txt[*i]);
|
||||
c_size = _lv_txt_encoded_size(&txt[*i]);
|
||||
if(c_size == 0) {
|
||||
if(*i != 0)
|
||||
(*i)--;
|
||||
@@ -653,7 +654,7 @@ static uint32_t lv_txt_utf8_prev(const char * txt, uint32_t * i)
|
||||
} while(c_size == 0);
|
||||
|
||||
uint32_t i_tmp = *i;
|
||||
uint32_t letter = lv_txt_encoded_next(txt, &i_tmp); /*Character found, get it*/
|
||||
uint32_t letter = _lv_txt_encoded_next(txt, &i_tmp); /*Character found, get it*/
|
||||
|
||||
return letter;
|
||||
}
|
||||
@@ -670,7 +671,7 @@ static uint32_t lv_txt_utf8_get_byte_id(const char * txt, uint32_t utf8_id)
|
||||
uint32_t i;
|
||||
uint32_t byte_cnt = 0;
|
||||
for(i = 0; i < utf8_id; i++) {
|
||||
uint8_t c_size = lv_txt_encoded_size(&txt[byte_cnt]);
|
||||
uint8_t c_size = _lv_txt_encoded_size(&txt[byte_cnt]);
|
||||
byte_cnt += c_size > 0 ? c_size : 1;
|
||||
}
|
||||
|
||||
@@ -690,7 +691,7 @@ static uint32_t lv_txt_utf8_get_char_id(const char * txt, uint32_t byte_id)
|
||||
uint32_t char_cnt = 0;
|
||||
|
||||
while(i < byte_id) {
|
||||
lv_txt_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/
|
||||
_lv_txt_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/
|
||||
char_cnt++;
|
||||
}
|
||||
|
||||
@@ -709,7 +710,7 @@ static uint32_t lv_txt_utf8_get_length(const char * txt)
|
||||
uint32_t i = 0;
|
||||
|
||||
while(txt[i] != '\0') {
|
||||
lv_txt_encoded_next(txt, &i);
|
||||
_lv_txt_encoded_next(txt, &i);
|
||||
len++;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,15 +63,15 @@ typedef uint8_t lv_txt_cmd_state_t;
|
||||
* Get size of a text
|
||||
* @param size_res pointer to a 'point_t' variable to store the result
|
||||
* @param text pointer to a text
|
||||
* @param font pinter to font of the text
|
||||
* @param font pointer to font of the text
|
||||
* @param letter_space letter space of the text
|
||||
* @param line_space line space of the text
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @param max_width max with of the text (break the lines to fit this size) Set CORD_MAX to avoid
|
||||
* line breaks
|
||||
*/
|
||||
void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_txt_flag_t flag);
|
||||
void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Get the next line of text. Check line length and break chars too.
|
||||
@@ -84,8 +84,8 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
|
||||
* @return the index of the first char of the new line (in byte index not letter index. With UTF-8
|
||||
* they are different)
|
||||
*/
|
||||
uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
|
||||
lv_txt_flag_t flag);
|
||||
uint16_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width,
|
||||
lv_txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Give the length of a text with a given font
|
||||
@@ -97,8 +97,8 @@ uint16_t lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord
|
||||
* @param flags settings for the text from 'txt_flag_t' enum
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_txt_flag_t flag);
|
||||
lv_coord_t _lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_txt_flag_t flag);
|
||||
|
||||
/**
|
||||
* Check next character in a string and decide if te character is part of the command or not
|
||||
@@ -108,7 +108,7 @@ lv_coord_t lv_txt_get_width(const char * txt, uint16_t length, const lv_font_t *
|
||||
* @return true: the character is part of a command and should not be written,
|
||||
* false: the character should be written
|
||||
*/
|
||||
bool lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c);
|
||||
bool _lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c);
|
||||
|
||||
/**
|
||||
* Insert a string into an other
|
||||
@@ -116,7 +116,7 @@ bool lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c);
|
||||
* @param pos position to insert (0: before the original text, 1: after the first char etc.)
|
||||
* @param ins_txt text to insert
|
||||
*/
|
||||
void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt);
|
||||
void _lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt);
|
||||
|
||||
/**
|
||||
* Delete a part of a string
|
||||
@@ -125,7 +125,7 @@ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt);
|
||||
* char etc.)
|
||||
* @param len number of characters to delete
|
||||
*/
|
||||
void lv_txt_cut(char * txt, uint32_t pos, uint32_t len);
|
||||
void _lv_txt_cut(char * txt, uint32_t pos, uint32_t len);
|
||||
|
||||
/***************************************************************
|
||||
* GLOBAL FUNCTION POINTERS FOR CAHRACTER ENCODING INTERFACE
|
||||
@@ -136,21 +136,21 @@ void lv_txt_cut(char * txt, uint32_t pos, uint32_t len);
|
||||
* @param str pointer to a character in a string
|
||||
* @return length of the encoded character (1,2,3 ...). O in invalid
|
||||
*/
|
||||
extern uint8_t (*lv_txt_encoded_size)(const char *);
|
||||
extern uint8_t (*_lv_txt_encoded_size)(const char *);
|
||||
|
||||
/**
|
||||
* Convert an Unicode letter to encoded
|
||||
* @param letter_uni an Unicode letter
|
||||
* @return Encoded character in Little Endian to be compatible with C chars (e.g. 'Á', 'Ü')
|
||||
*/
|
||||
extern uint32_t (*lv_txt_unicode_to_encoded)(uint32_t);
|
||||
extern uint32_t (*_lv_txt_unicode_to_encoded)(uint32_t);
|
||||
|
||||
/**
|
||||
* Convert a wide character, e.g. 'Á' little endian to be compatible with the encoded format.
|
||||
* @param c a wide character
|
||||
* @return `c` in the encoded format
|
||||
*/
|
||||
extern uint32_t (*lv_txt_encoded_conv_wc)(uint32_t c);
|
||||
extern uint32_t (*_lv_txt_encoded_conv_wc)(uint32_t c);
|
||||
|
||||
/**
|
||||
* Decode the next encoded character from a string.
|
||||
@@ -160,7 +160,7 @@ extern uint32_t (*lv_txt_encoded_conv_wc)(uint32_t c);
|
||||
* NULL to use txt[0] as index
|
||||
* @return the decoded Unicode character or 0 on invalid data code
|
||||
*/
|
||||
extern uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *);
|
||||
extern uint32_t (*_lv_txt_encoded_next)(const char *, uint32_t *);
|
||||
|
||||
/**
|
||||
* Get the previous encoded character form a string.
|
||||
@@ -169,7 +169,7 @@ extern uint32_t (*lv_txt_encoded_next)(const char *, uint32_t *);
|
||||
* encoded char in 'txt'.
|
||||
* @return the decoded Unicode character or 0 on invalid data
|
||||
*/
|
||||
extern uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *);
|
||||
extern uint32_t (*_lv_txt_encoded_prev)(const char *, uint32_t *);
|
||||
|
||||
/**
|
||||
* Convert a letter index (in an the encoded text) to byte index.
|
||||
@@ -178,7 +178,7 @@ extern uint32_t (*lv_txt_encoded_prev)(const char *, uint32_t *);
|
||||
* @param enc_id letter index
|
||||
* @return byte index of the 'enc_id'th letter
|
||||
*/
|
||||
extern uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t);
|
||||
extern uint32_t (*_lv_txt_encoded_get_byte_id)(const char *, uint32_t);
|
||||
|
||||
/**
|
||||
* Convert a byte index (in an encoded text) to character index.
|
||||
@@ -187,7 +187,7 @@ extern uint32_t (*lv_txt_encoded_get_byte_id)(const char *, uint32_t);
|
||||
* @param byte_id byte index
|
||||
* @return character index of the letter at 'byte_id'th position
|
||||
*/
|
||||
extern uint32_t (*lv_txt_encoded_get_char_id)(const char *, uint32_t);
|
||||
extern uint32_t (*_lv_txt_encoded_get_char_id)(const char *, uint32_t);
|
||||
|
||||
/**
|
||||
* Get the number of characters (and NOT bytes) in a string.
|
||||
@@ -195,7 +195,7 @@ extern uint32_t (*lv_txt_encoded_get_char_id)(const char *, uint32_t);
|
||||
* @param txt a '\0' terminated char string
|
||||
* @return number of characters
|
||||
*/
|
||||
extern uint32_t (*lv_txt_get_encoded_length)(const char *);
|
||||
extern uint32_t (*_lv_txt_get_encoded_length)(const char *);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -24,66 +24,66 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
const ap_chars_map_t ap_chars_map[]={
|
||||
/* {Key Offset, End, Beginning, Middle, Isolated, {conjunction}} */
|
||||
{1 , 0xFE84, -1, 0, -1, {1, 0}}, // أ
|
||||
{2 , 0xFE86, -1, 0, -1, {1, 0}}, // ؤ
|
||||
{3 , 0xFE88, -1, 0, -1, {1, 0}}, // ﺇ
|
||||
{4 , 0xFE8A, 1, 2, -1, {1, 0}}, // ئ
|
||||
{5 , 0xFE8E, -1, 0, -1, {1, 0}}, // آ
|
||||
{6 , 0xFE90, 1, 2, -1, {1, 1}}, // ب
|
||||
{92 , 0xFB57, 1, 2, -1, {1, 1}}, // پ
|
||||
{8 , 0xFE96, 1, 2, -1, {1, 1}}, // ت
|
||||
{9 , 0xFE9A, 1, 2, -1, {1, 1}}, // ث
|
||||
{10 , 0xFE9E, 1, 2, -1, {1, 1}}, // ج
|
||||
{100, 0xFB7B, 1, 2, -1, {1, 1}}, // چ
|
||||
{11 , 0xFEA2, 1, 2, -1, {1, 1}}, // ح
|
||||
{12 , 0xFEA6, 1, 2, -1, {1, 1}}, // خ
|
||||
{13 , 0xFEAA, -1, 0, -1, {1, 0}}, // د
|
||||
{14 , 0xFEAC, -1, 0, -1, {1, 0}}, // ذ
|
||||
{15 , 0xFEAE, -1, 0, -1, {1, 0}}, // ر
|
||||
{16 , 0xFEB0, -1, 0, -1, {1, 0}}, // ز
|
||||
{118, 0xFB8B, -1, 0, -1, {1, 0}}, // ژ
|
||||
{17 , 0xFEB2, 1, 2, -1, {1, 1}}, // س
|
||||
{18 , 0xFEB6, 1, 2, -1, {1, 1}}, // ش
|
||||
{19 , 0xFEBA, 1, 2, -1, {1, 1}}, // ص
|
||||
{20 , 0xFEBE, 1, 2, -1, {1, 1}}, // ض
|
||||
{21 , 0xFEC2, 1, 2, -1, {1, 1}}, // ط
|
||||
{22 , 0xFEC6, 1, 2, -1, {1, 1}}, // ظ
|
||||
{23 , 0xFECA, 1, 2, -1, {1, 1}}, // ع
|
||||
{24 , 0xFECE, 1, 2, -1, {1, 1}}, // غ
|
||||
{31 , 0xFED2, 1, 2, -1, {1, 1}}, // ف
|
||||
{32 , 0xFED6, 1, 2, -1, {1, 1}}, // ق
|
||||
{135, 0xFB8F, 1, 2, -1, {1, 1}}, // ک
|
||||
{33, 0xFEDA, 1, 2, -1, {1, 1}}, // ﻙ
|
||||
{141, 0xFB93, 1, 2, -1, {1, 1}}, // گ
|
||||
{34 , 0xFEDE, 1, 2, -1, {1, 1}}, // ل
|
||||
{35 , 0xFEE2, 1, 2, -1, {1, 1}}, // م
|
||||
{36 , 0xFEE6, 1, 2, -1, {1, 1}}, // ن
|
||||
{38 , 0xFEEE, -1, 0, -1, {1, 0}}, // و
|
||||
{37 , 0xFEEA, 1, 2, -1, {1, 1}}, // ه
|
||||
{39 , 0xFBFD, 1, 2, -1, {1, 1}}, // ي
|
||||
{40 , 0xFEF2, 1, 2, -1, {1, 1}}, // ي
|
||||
{170 , 0xFBFD, 1, 2, -1, {1, 1}}, // ی
|
||||
{7 , 0xFE94, 1, 2, -1, {1, 0}}, // ة
|
||||
{206, 0x06F0, 1, 2, -1, {0, 0}}, // ۰
|
||||
{207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱
|
||||
{208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲
|
||||
{209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳
|
||||
{210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴
|
||||
{211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵
|
||||
{212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶
|
||||
{213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷
|
||||
{214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸
|
||||
{215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹
|
||||
LV_AP_END_CHARS_LIST
|
||||
const ap_chars_map_t ap_chars_map[] = {
|
||||
/* {Key Offset, End, Beginning, Middle, Isolated, {conjunction}} */
|
||||
{1, 0xFE84, -1, 0, -1, {1, 0}}, // أ
|
||||
{2, 0xFE86, -1, 0, -1, {1, 0}}, // ؤ
|
||||
{3, 0xFE88, -1, 0, -1, {1, 0}}, // ﺇ
|
||||
{4, 0xFE8A, 1, 2, -1, {1, 0}}, // ئ
|
||||
{5, 0xFE8E, -1, 0, -1, {1, 0}}, // آ
|
||||
{6, 0xFE90, 1, 2, -1, {1, 1}}, // ب
|
||||
{92, 0xFB57, 1, 2, -1, {1, 1}}, // پ
|
||||
{8, 0xFE96, 1, 2, -1, {1, 1}}, // ت
|
||||
{9, 0xFE9A, 1, 2, -1, {1, 1}}, // ث
|
||||
{10, 0xFE9E, 1, 2, -1, {1, 1}}, // ج
|
||||
{100, 0xFB7B, 1, 2, -1, {1, 1}}, // چ
|
||||
{11, 0xFEA2, 1, 2, -1, {1, 1}}, // ح
|
||||
{12, 0xFEA6, 1, 2, -1, {1, 1}}, // خ
|
||||
{13, 0xFEAA, -1, 0, -1, {1, 0}}, // د
|
||||
{14, 0xFEAC, -1, 0, -1, {1, 0}}, // ذ
|
||||
{15, 0xFEAE, -1, 0, -1, {1, 0}}, // ر
|
||||
{16, 0xFEB0, -1, 0, -1, {1, 0}}, // ز
|
||||
{118, 0xFB8B, -1, 0, -1, {1, 0}}, // ژ
|
||||
{17, 0xFEB2, 1, 2, -1, {1, 1}}, // س
|
||||
{18, 0xFEB6, 1, 2, -1, {1, 1}}, // ش
|
||||
{19, 0xFEBA, 1, 2, -1, {1, 1}}, // ص
|
||||
{20, 0xFEBE, 1, 2, -1, {1, 1}}, // ض
|
||||
{21, 0xFEC2, 1, 2, -1, {1, 1}}, // ط
|
||||
{22, 0xFEC6, 1, 2, -1, {1, 1}}, // ظ
|
||||
{23, 0xFECA, 1, 2, -1, {1, 1}}, // ع
|
||||
{24, 0xFECE, 1, 2, -1, {1, 1}}, // غ
|
||||
{31, 0xFED2, 1, 2, -1, {1, 1}}, // ف
|
||||
{32, 0xFED6, 1, 2, -1, {1, 1}}, // ق
|
||||
{135, 0xFB8F, 1, 2, -1, {1, 1}}, // ک
|
||||
{33, 0xFEDA, 1, 2, -1, {1, 1}}, // ﻙ
|
||||
{141, 0xFB93, 1, 2, -1, {1, 1}}, // گ
|
||||
{34, 0xFEDE, 1, 2, -1, {1, 1}}, // ل
|
||||
{35, 0xFEE2, 1, 2, -1, {1, 1}}, // م
|
||||
{36, 0xFEE6, 1, 2, -1, {1, 1}}, // ن
|
||||
{38, 0xFEEE, -1, 0, -1, {1, 0}}, // و
|
||||
{37, 0xFEEA, 1, 2, -1, {1, 1}}, // ه
|
||||
{39, 0xFBFD, 1, 2, -1, {1, 1}}, // ي
|
||||
{40, 0xFEF2, 1, 2, -1, {1, 1}}, // ي
|
||||
{170, 0xFBFD, 1, 2, -1, {1, 1}}, // ی
|
||||
{7, 0xFE94, 1, 2, -1, {1, 0}}, // ة
|
||||
{206, 0x06F0, 1, 2, -1, {0, 0}}, // ۰
|
||||
{207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱
|
||||
{208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲
|
||||
{209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳
|
||||
{210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴
|
||||
{211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵
|
||||
{212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶
|
||||
{213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷
|
||||
{214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸
|
||||
{215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹
|
||||
LV_AP_END_CHARS_LIST
|
||||
};
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -92,111 +92,116 @@ const ap_chars_map_t ap_chars_map[]={
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt){
|
||||
uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt)
|
||||
{
|
||||
uint32_t txt_length = 0;
|
||||
uint32_t chars_cnt = 0;
|
||||
uint32_t current_ap_idx = 0;
|
||||
uint32_t i, j;
|
||||
uint32_t ch_enc;
|
||||
|
||||
txt_length = lv_txt_get_encoded_length(txt);
|
||||
txt_length = _lv_txt_get_encoded_length(txt);
|
||||
|
||||
i=0;
|
||||
j=0;
|
||||
while(i<txt_length){
|
||||
ch_enc = lv_txt_encoded_next(txt, &j);
|
||||
current_ap_idx = lv_ap_get_char_index(ch_enc);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while(i < txt_length) {
|
||||
ch_enc = _lv_txt_encoded_next(txt, &j);
|
||||
current_ap_idx = lv_ap_get_char_index(ch_enc);
|
||||
|
||||
if(current_ap_idx != LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
ch_enc = ap_chars_map[current_ap_idx].char_end_form;
|
||||
|
||||
if(ch_enc <=0x7F)
|
||||
chars_cnt++;
|
||||
else if(ch_enc <=0x7FFF)
|
||||
chars_cnt+=2;
|
||||
else
|
||||
chars_cnt+=3;
|
||||
if(ch_enc <= 0x7F)
|
||||
chars_cnt++;
|
||||
else if(ch_enc <= 0x7FFF)
|
||||
chars_cnt += 2;
|
||||
else
|
||||
chars_cnt += 3;
|
||||
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
|
||||
return chars_cnt + 1;
|
||||
}
|
||||
|
||||
|
||||
void lv_txt_ap_proc(const char * txt,char * txt_out)
|
||||
void _lv_txt_ap_proc(const char * txt, char * txt_out)
|
||||
{
|
||||
uint32_t txt_length=0;
|
||||
uint32_t index_current,idx_next,idx_previous,i,j;
|
||||
uint32_t txt_length = 0;
|
||||
uint32_t index_current, idx_next, idx_previous, i, j;
|
||||
uint32_t * ch_enc;
|
||||
char * txt_out_temp;
|
||||
|
||||
txt_length = lv_txt_get_encoded_length(txt);
|
||||
txt_length = _lv_txt_get_encoded_length(txt);
|
||||
|
||||
ch_enc = (uint32_t *)lv_mem_alloc(sizeof(uint32_t) * (txt_length + 1));
|
||||
|
||||
i=0;
|
||||
j=0;
|
||||
while(j<txt_length)
|
||||
ch_enc[j++] = lv_txt_encoded_next(txt, &i);
|
||||
i = 0;
|
||||
j = 0;
|
||||
while(j < txt_length)
|
||||
ch_enc[j++] = _lv_txt_encoded_next(txt, &i);
|
||||
|
||||
ch_enc[j] = 0;
|
||||
|
||||
i=0;
|
||||
i = 0;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
while(i<txt_length){
|
||||
while(i < txt_length) {
|
||||
index_current = lv_ap_get_char_index(ch_enc[i]);
|
||||
idx_next = lv_ap_get_char_index(ch_enc[i+1]);
|
||||
idx_next = lv_ap_get_char_index(ch_enc[i + 1]);
|
||||
|
||||
if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS)
|
||||
{
|
||||
i++;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
continue;
|
||||
if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS) {
|
||||
i++;
|
||||
idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t conjunction_to_previuse = (i==0 || idx_previous == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_previous].ap_chars_conjunction.conj_to_next;
|
||||
uint8_t conjunction_to_next = ((i==txt_length-1) || idx_next == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_next].ap_chars_conjunction.conj_to_previous;
|
||||
uint8_t conjunction_to_previuse = (i == 0 ||
|
||||
idx_previous == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_previous].ap_chars_conjunction.conj_to_next;
|
||||
uint8_t conjunction_to_next = ((i == txt_length - 1) ||
|
||||
idx_next == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_next].ap_chars_conjunction.conj_to_previous;
|
||||
|
||||
if(conjunction_to_previuse && conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_middle_form_offset;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_middle_form_offset;
|
||||
else if(!conjunction_to_previuse && conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_begining_form_offset;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_begining_form_offset;
|
||||
else if(conjunction_to_previuse && !conjunction_to_next)
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form;
|
||||
else
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form+ap_chars_map[index_current].char_isolated_form_offset;
|
||||
ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_isolated_form_offset;
|
||||
idx_previous = index_current;
|
||||
i++;
|
||||
}
|
||||
|
||||
txt_out_temp = txt_out;
|
||||
i=0;
|
||||
i = 0;
|
||||
|
||||
while(i<txt_length){
|
||||
if((ch_enc[i]) <=0x7F){
|
||||
*(txt_out_temp++) = ch_enc[i];
|
||||
}else if(ch_enc[i] <=0x7FFF){
|
||||
*(txt_out_temp++) = 0xC0 | ((ch_enc[i]>>6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}else {
|
||||
*(txt_out_temp++) = 0xE0 | ((ch_enc[i]>>12) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | ((ch_enc[i]>>6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
*(txt_out_temp) = '\0';
|
||||
lv_mem_free(ch_enc);
|
||||
while(i < txt_length) {
|
||||
if((ch_enc[i]) <= 0x7F) {
|
||||
*(txt_out_temp++) = ch_enc[i];
|
||||
}
|
||||
else if(ch_enc[i] <= 0x7FFF) {
|
||||
*(txt_out_temp++) = 0xC0 | ((ch_enc[i] >> 6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
else {
|
||||
*(txt_out_temp++) = 0xE0 | ((ch_enc[i] >> 12) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | ((ch_enc[i] >> 6) & 0x3F);
|
||||
*(txt_out_temp++) = 0x80 | (ch_enc[i] & 0x3F);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
*(txt_out_temp) = '\0';
|
||||
lv_mem_free(ch_enc);
|
||||
}
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c){
|
||||
for(uint8_t i=0;ap_chars_map[i].char_end_form;i++){
|
||||
static uint32_t lv_ap_get_char_index(uint16_t c)
|
||||
{
|
||||
for(uint8_t i = 0; ap_chars_map[i].char_end_form; i++) {
|
||||
if(c == (ap_chars_map[i].char_offset + LV_AP_ALPHABET_BASE_CODE))
|
||||
return i;
|
||||
return i;
|
||||
}
|
||||
return LV_UNDEF_ARABIC_PERSIAN_CHARS;
|
||||
}
|
||||
|
||||
@@ -14,44 +14,45 @@ extern "C" {
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stddef.h>
|
||||
#include "lv_bidi.h"
|
||||
#include "lv_txt.h"
|
||||
#include "../lv_draw/lv_draw.h"
|
||||
|
||||
#if LV_USE_ARABIC_PERSIAN_CHARS == 1
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_UNDEF_ARABIC_PERSIAN_CHARS (UINT32_MAX)
|
||||
#define LV_AP_ALPHABET_BASE_CODE 0x0622
|
||||
#define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}}
|
||||
#define LV_AP_END_CHARS_LIST {0,0,0,0,0,{0,0}}
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
uint8_t char_offset;
|
||||
uint16_t char_end_form;
|
||||
int8_t char_begining_form_offset;
|
||||
int8_t char_middle_form_offset;
|
||||
int8_t char_isolated_form_offset;
|
||||
struct
|
||||
{
|
||||
uint8_t conj_to_previous;
|
||||
uint8_t conj_to_next;
|
||||
struct {
|
||||
uint8_t conj_to_previous;
|
||||
uint8_t conj_to_next;
|
||||
} ap_chars_conjunction;
|
||||
} ap_chars_map_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
uint32_t lv_txt_ap_calc_bytes_cnt(const char * txt);
|
||||
void lv_txt_ap_proc(const char * txt,char * txt_out);
|
||||
uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt);
|
||||
void _lv_txt_ap_proc(const char * txt, char * txt_out);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif // LV_USE_ARABIC_PERSIAN_CHARS
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@ extern "C" {
|
||||
*********************/
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L // If c99 or newer, use stdint.h to determine arch size
|
||||
#include <stdint.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -36,13 +36,13 @@ extern "C" {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* LittlevGL error codes.
|
||||
* LVGL error codes.
|
||||
*/
|
||||
enum {
|
||||
LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action
|
||||
@@ -53,8 +53,8 @@ typedef uint8_t lv_res_t;
|
||||
|
||||
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
// If c99 or newer, use the definition of uintptr_t directly from <stdint.h>
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
// If c99 or newer, use the definition of uintptr_t directly from <stdint.h>
|
||||
typedef uintptr_t lv_uintptr_t;
|
||||
|
||||
#else
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static char decimal_separator[2] = ".";
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -44,7 +43,7 @@ static char decimal_separator[2] = ".";
|
||||
* @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)
|
||||
* @return same as `buf` (just for convenience)
|
||||
*/
|
||||
char * lv_utils_num_to_str(int32_t num, char * buf)
|
||||
char * _lv_utils_num_to_str(int32_t num, char * buf)
|
||||
{
|
||||
if(num == 0) {
|
||||
buf[0] = '0';
|
||||
@@ -75,31 +74,6 @@ char * lv_utils_num_to_str(int32_t num, char * buf)
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a fixed point number to string
|
||||
* @param num a number
|
||||
* @param decimals number of digits after decimal point
|
||||
* @param buf pointer to a `char` buffer
|
||||
* @param bufsize length of buffer
|
||||
* @return same as `buf` (just for convenience)
|
||||
*/
|
||||
char * lv_utils_num_to_str_fixed(int32_t num, int32_t decimals, char * buf, size_t bufsize)
|
||||
{
|
||||
lv_snprintf(buf, bufsize, "%0*d", decimals+1, num);
|
||||
if(decimals > 0)
|
||||
lv_txt_ins(buf, strlen(buf) - decimals, decimal_separator);
|
||||
return buf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the decimal separator character used by lv_utils_num_to_str_fixed
|
||||
* @param separator the decimal separator char
|
||||
*/
|
||||
void lv_utils_set_decimal_separator(char separator)
|
||||
{
|
||||
decimal_separator[0] = separator;
|
||||
}
|
||||
|
||||
/** Searches base[0] to base[n - 1] for an item that matches *key.
|
||||
*
|
||||
* @note The function cmp must return negative if its first
|
||||
@@ -117,8 +91,8 @@ void lv_utils_set_decimal_separator(char separator)
|
||||
*
|
||||
* @return a pointer to a matching item, or NULL if none exists.
|
||||
*/
|
||||
void * lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size,
|
||||
int32_t (*cmp)(const void * pRef, const void * pElement))
|
||||
void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size,
|
||||
int32_t (*cmp)(const void * pRef, const void * pElement))
|
||||
{
|
||||
const char * middle;
|
||||
int32_t c;
|
||||
|
||||
@@ -33,23 +33,7 @@ extern "C" {
|
||||
* @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements)
|
||||
* @return same as `buf` (just for convenience)
|
||||
*/
|
||||
char * lv_utils_num_to_str(int32_t num, char * buf);
|
||||
|
||||
/**
|
||||
* Convert a fixed point number to string
|
||||
* @param num a number
|
||||
* @param decimals number of digits after decimal point
|
||||
* @param buf pointer to a `char` buffer
|
||||
* @param bufsize length of buffer
|
||||
* @return same as `buf` (just for convenience)
|
||||
*/
|
||||
char * lv_utils_num_to_str_fixed(int32_t num, int32_t decimals, char * buf, size_t bufsize);
|
||||
|
||||
/**
|
||||
* Set the decimal separator character used by lv_utils_num_to_str_fixed
|
||||
* @param separator the decimal separator char
|
||||
*/
|
||||
void lv_utils_set_decimal_separator(char separator);
|
||||
char * _lv_utils_num_to_str(int32_t num, char * buf);
|
||||
|
||||
/** Searches base[0] to base[n - 1] for an item that matches *key.
|
||||
*
|
||||
@@ -68,8 +52,8 @@ void lv_utils_set_decimal_separator(char separator);
|
||||
*
|
||||
* @return a pointer to a matching item, or NULL if none exists.
|
||||
*/
|
||||
void * lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size,
|
||||
int32_t (*cmp)(const void * pRef, const void * pElement));
|
||||
void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size,
|
||||
int32_t (*cmp)(const void * pRef, const void * pElement));
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -14,10 +14,8 @@ extern "C" {
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#include "../lv_core/lv_style.h"
|
||||
|
||||
#include "../../lvgl.h"
|
||||
#include "../lv_core/lv_obj.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -28,7 +26,7 @@ extern "C" {
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* A theme in LittlevGL consists of many styles bound together.
|
||||
* A theme in LVGL consists of many styles bound together.
|
||||
*
|
||||
* There is a style for each object type, as well as a generic style for
|
||||
* backgrounds and panels.
|
||||
@@ -141,6 +139,11 @@ typedef enum {
|
||||
LV_THEME_WIN,
|
||||
LV_THEME_WIN_BTN, /*The buttons are initialized separately*/
|
||||
#endif
|
||||
|
||||
_LV_THEME_BUILTIN_LAST,
|
||||
_LV_THEME_CUSTOM_START = _LV_THEME_BUILTIN_LAST,
|
||||
_LV_THEME_CUSTOM_LAST = 0xFFFF,
|
||||
|
||||
} lv_theme_style_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -7,9 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include "lv_theme.h"
|
||||
#include "../lv_widgets/lv_img.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../../lvgl.h" /*To see all the widgets*/
|
||||
|
||||
#if LV_USE_THEME_EMPTY
|
||||
|
||||
@@ -24,7 +22,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_theme_empty_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
|
||||
|
||||
/**********************
|
||||
@@ -57,17 +55,18 @@ static lv_style_t opa_cover;
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
lv_style_init(&opa_cover);
|
||||
lv_style_set_bg_opa(&opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
|
||||
theme.apply_xcb = lv_theme_empty_apply;
|
||||
theme.apply_xcb = theme_apply;
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void lv_theme_empty_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
if(name == LV_THEME_SCR) {
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -6,11 +6,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include "lv_theme.h"
|
||||
#include "lv_theme_material.h"
|
||||
#include "../lv_widgets/lv_img.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../../lvgl.h" /*To see all the widgets*/
|
||||
|
||||
#if LV_USE_THEME_MATERIAL
|
||||
|
||||
@@ -66,6 +62,8 @@
|
||||
#define BORDER_WIDTH LV_DPX(2)
|
||||
#define IS_LIGHT (theme.flags & LV_THEME_MATERIAL_FLAG_LIGHT)
|
||||
|
||||
#define PAD_DEF (lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_MEDIUM ? LV_DPX(15) : (LV_DPX(30)))
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
@@ -73,7 +71,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void style_init_reset(lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
@@ -146,9 +144,9 @@ static lv_style_t pad_small;
|
||||
|
||||
#if LV_USE_PAGE
|
||||
static lv_style_t sb;
|
||||
#if LV_USE_ANIMATION
|
||||
static lv_style_t edge_flash;
|
||||
#endif
|
||||
#if LV_USE_ANIMATION
|
||||
static lv_style_t edge_flash;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
@@ -213,11 +211,11 @@ static void basic_init(void)
|
||||
lv_style_set_image_recolor(&bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
lv_style_set_line_color(&bg, LV_STATE_DEFAULT, COLOR_BG_TEXT);
|
||||
lv_style_set_line_width(&bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_pad_left(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_right(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_top(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_bottom(&bg, LV_STATE_DEFAULT, LV_DPX(20) + BORDER_WIDTH);
|
||||
lv_style_set_pad_inner(&bg, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&bg, LV_STATE_DEFAULT, PAD_DEF + BORDER_WIDTH);
|
||||
lv_style_set_pad_right(&bg, LV_STATE_DEFAULT, PAD_DEF + BORDER_WIDTH);
|
||||
lv_style_set_pad_top(&bg, LV_STATE_DEFAULT, PAD_DEF + BORDER_WIDTH);
|
||||
lv_style_set_pad_bottom(&bg, LV_STATE_DEFAULT, PAD_DEF + BORDER_WIDTH);
|
||||
lv_style_set_pad_inner(&bg, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_transition_time(&bg, LV_STATE_DEFAULT, TRANSITION_TIME);
|
||||
lv_style_set_transition_prop_6(&bg, LV_STATE_DEFAULT, LV_STYLE_BORDER_COLOR);
|
||||
|
||||
@@ -236,7 +234,8 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_PR_CHK);
|
||||
lv_style_set_bg_color(&bg_click, LV_STATE_DISABLED, COLOR_BG_DIS);
|
||||
lv_style_set_border_width(&bg_click, LV_STATE_CHECKED, 0);
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, LV_OPA_20));
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||
LV_OPA_20));
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR);
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK);
|
||||
lv_style_set_border_color(&bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR);
|
||||
@@ -302,14 +301,17 @@ static void basic_init(void)
|
||||
lv_style_set_transition_delay(&btn, LV_STATE_PRESSED, 0);
|
||||
|
||||
style_init_reset(&pad_inner);
|
||||
lv_style_set_pad_inner(&pad_inner, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
|
||||
lv_style_set_pad_inner(&pad_inner, LV_STATE_DEFAULT,
|
||||
lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(20) : LV_DPX(40));
|
||||
|
||||
style_init_reset(&pad_small);
|
||||
lv_style_set_pad_left(&pad_small, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_right(&pad_small, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_top(&pad_small, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_bottom(&pad_small, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_inner(&pad_small, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_int_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(10) : LV_DPX(20);
|
||||
lv_style_set_pad_left(&pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
lv_style_set_pad_right(&pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
lv_style_set_pad_top(&pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
lv_style_set_pad_bottom(&pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
lv_style_set_pad_inner(&pad_small, LV_STATE_DEFAULT, pad_small_value);
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
@@ -382,9 +384,9 @@ static void led_init(void)
|
||||
lv_style_set_border_opa(&led, LV_STATE_DEFAULT, LV_OPA_50);
|
||||
lv_style_set_border_color(&led, LV_STATE_DEFAULT, lv_color_lighten(theme.color_primary, LV_OPA_30));
|
||||
lv_style_set_radius(&led, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_shadow_width(&led, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_shadow_width(&led, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_shadow_color(&led, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_shadow_spread(&led, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_shadow_spread(&led, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -396,14 +398,14 @@ static void slider_init(void)
|
||||
lv_style_set_bg_color(&slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? theme.color_primary : LV_COLOR_WHITE);
|
||||
lv_style_set_value_color(&slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
|
||||
lv_style_set_radius(&slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_pad_left(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_right(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_top(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_bottom(&slider_knob, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_left(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_right(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_top(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_bottom(&slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
|
||||
style_init_reset(&slider_bg);
|
||||
lv_style_set_margin_left(&slider_bg, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_margin_right(&slider_bg, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_margin_left(&slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_margin_right(&slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_margin_top(&slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_margin_bottom(&slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
|
||||
@@ -417,10 +419,10 @@ static void switch_init(void)
|
||||
lv_style_set_bg_opa(&sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&sw_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
lv_style_set_radius(&sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_pad_top(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_bottom(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_left(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_right(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(8));
|
||||
lv_style_set_pad_top(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
lv_style_set_pad_bottom(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
lv_style_set_pad_left(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
lv_style_set_pad_right(&sw_knob, LV_STATE_DEFAULT, - LV_DPX(4));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -457,7 +459,7 @@ static void gauge_init(void)
|
||||
lv_style_set_pad_right(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_inner(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_scale_width(&gauge_main, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_scale_width(&gauge_main, LV_STATE_DEFAULT, LV_DPX(15));
|
||||
lv_style_set_radius(&gauge_main, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
style_init_reset(&gauge_strong);
|
||||
@@ -466,7 +468,7 @@ static void gauge_init(void)
|
||||
lv_style_set_scale_end_color(&gauge_strong, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_line_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(8));
|
||||
lv_style_set_scale_end_line_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(8));
|
||||
lv_style_set_scale_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(30));
|
||||
lv_style_set_scale_width(&gauge_strong, LV_STATE_DEFAULT, LV_DPX(25));
|
||||
|
||||
style_init_reset(&gauge_needle);
|
||||
lv_style_set_line_color(&gauge_needle, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE);
|
||||
@@ -513,8 +515,8 @@ static void chart_init(void)
|
||||
lv_style_set_line_color(&chart_series_bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
|
||||
style_init_reset(&chart_series);
|
||||
lv_style_set_line_width(&chart_series, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
lv_style_set_size(&chart_series, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_line_width(&chart_series, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_size(&chart_series, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
lv_style_set_pad_inner(&chart_series, LV_STATE_DEFAULT, LV_DPX(2)); /*Space between columns*/
|
||||
lv_style_set_radius(&chart_series, LV_STATE_DEFAULT, LV_DPX(1));
|
||||
|
||||
@@ -526,17 +528,17 @@ static void calendar_init(void)
|
||||
#if LV_USE_CALENDAR
|
||||
|
||||
style_init_reset(&calendar_header);
|
||||
lv_style_set_pad_top(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&calendar_header, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&calendar_header, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_left(&calendar_header, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&calendar_header, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&calendar_header, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_text_color(&calendar_header, LV_STATE_PRESSED, IS_LIGHT ? lv_color_hex(0x888888) : LV_COLOR_WHITE);
|
||||
|
||||
style_init_reset(&calendar_daynames);
|
||||
lv_style_set_text_color(&calendar_daynames, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : lv_color_hex3(0xeee));
|
||||
lv_style_set_pad_left(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&calendar_daynames, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&calendar_daynames, LV_STATE_DEFAULT, PAD_DEF);
|
||||
|
||||
style_init_reset(&calendar_date_nums);
|
||||
lv_style_set_radius(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(4));
|
||||
@@ -553,9 +555,9 @@ static void calendar_init(void)
|
||||
lv_style_set_border_side(&calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT);
|
||||
lv_style_set_border_color(&calendar_date_nums, LV_STATE_CHECKED, theme.color_primary);
|
||||
lv_style_set_pad_inner(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_pad_left(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&calendar_date_nums, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&calendar_date_nums, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&calendar_date_nums, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&calendar_date_nums, LV_STATE_DEFAULT, PAD_DEF);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -577,7 +579,7 @@ static void cpicker_init(void)
|
||||
lv_style_set_border_color(&cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||
lv_style_set_border_color(&cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_color(&cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_pad_left(&cpicker_indic, LV_STATE_DEFAULT,LV_DPX(13));
|
||||
lv_style_set_pad_left(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_right(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_top(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
lv_style_set_pad_bottom(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
|
||||
@@ -604,6 +606,10 @@ static void checkbox_init(void)
|
||||
lv_style_set_pattern_image(&cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK);
|
||||
lv_style_set_pattern_recolor(&cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
|
||||
lv_style_set_text_font(&cb_bullet, LV_STATE_CHECKED, theme.font_small);
|
||||
lv_style_set_pad_left(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_pad_right(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_pad_top(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
lv_style_set_pad_bottom(&cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -620,11 +626,11 @@ static void keyboard_init(void)
|
||||
lv_style_set_border_side(&kb_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP);
|
||||
lv_style_set_border_color(&kb_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK);
|
||||
lv_style_set_border_color(&kb_bg, LV_STATE_EDITED, theme.color_secondary);
|
||||
lv_style_set_pad_left(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_right(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_top(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_bottom(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
|
||||
lv_style_set_pad_inner(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_left(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_right(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_top(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_bottom(&kb_bg, LV_STATE_DEFAULT, LV_DPX(5));
|
||||
lv_style_set_pad_inner(&kb_bg, LV_STATE_DEFAULT, LV_DPX(3));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -643,7 +649,7 @@ static void page_init(void)
|
||||
#if LV_USE_PAGE
|
||||
style_init_reset(&sb);
|
||||
lv_style_set_bg_opa(&sb, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&sb, LV_STATE_DEFAULT, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85)));
|
||||
lv_style_set_bg_color(&sb, LV_STATE_DEFAULT, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85)));
|
||||
lv_style_set_radius(&sb, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_size(&sb, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
lv_style_set_pad_right(&sb, LV_STATE_DEFAULT, LV_DPX(7));
|
||||
@@ -679,8 +685,8 @@ static void spinbox_init(void)
|
||||
lv_style_set_bg_opa(&spinbox_cursor, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&spinbox_cursor, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_text_color(&spinbox_cursor, LV_STATE_DEFAULT, LV_COLOR_WHITE);
|
||||
lv_style_set_pad_top(&spinbox_cursor, LV_STATE_DEFAULT, LV_DPI);
|
||||
lv_style_set_pad_bottom(&spinbox_cursor, LV_STATE_DEFAULT, LV_DPI);
|
||||
lv_style_set_pad_top(&spinbox_cursor, LV_STATE_DEFAULT, LV_DPX(100));
|
||||
lv_style_set_pad_bottom(&spinbox_cursor, LV_STATE_DEFAULT, LV_DPX(100));
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -717,13 +723,13 @@ static void list_init(void)
|
||||
lv_style_set_border_color(&list_btn, LV_STATE_FOCUSED, theme.color_primary);
|
||||
lv_style_set_border_width(&list_btn, LV_STATE_DEFAULT, 1);
|
||||
|
||||
lv_style_set_pad_left(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_inner(&list_btn, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_top(&list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_inner(&list_btn, LV_STATE_DEFAULT, PAD_DEF);
|
||||
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_DEFAULT, - LV_DPX(20));
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_DEFAULT, - PAD_DEF);
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_PRESSED, 0);
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_CHECKED, 0);
|
||||
lv_style_set_transform_width(&list_btn, LV_STATE_DISABLED, 0);
|
||||
@@ -740,6 +746,7 @@ static void ddlist_init(void)
|
||||
|
||||
style_init_reset(&ddlist_page);
|
||||
lv_style_set_text_line_space(&ddlist_page, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_clip_corner(&ddlist_page, LV_STATE_DEFAULT, true);
|
||||
|
||||
style_init_reset(&ddlist_sel);
|
||||
lv_style_set_bg_opa(&ddlist_sel, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
@@ -797,11 +804,11 @@ static void tabview_init(void)
|
||||
lv_style_set_radius(&tabview_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
style_init_reset(&tabview_page_scrl);
|
||||
lv_style_set_pad_top(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_inner(&tabview_page_scrl, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_left(&tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_inner(&tabview_page_scrl, LV_STATE_DEFAULT, PAD_DEF);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -818,10 +825,10 @@ static void table_init(void)
|
||||
lv_style_set_border_color(&table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER);
|
||||
lv_style_set_border_width(&table_cell, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_border_side(&table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
||||
lv_style_set_pad_left(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_right(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_top(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_bottom(&table_cell, LV_STATE_DEFAULT, LV_DPX(20));
|
||||
lv_style_set_pad_left(&table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_right(&table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_top(&table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
lv_style_set_pad_bottom(&table_cell, LV_STATE_DEFAULT, PAD_DEF);
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -850,11 +857,12 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary= color_secondary;
|
||||
theme.color_secondary = color_secondary;
|
||||
theme.font_small = font_small;
|
||||
theme.font_normal = font_normal;
|
||||
theme.font_subtitle = font_subtitle;
|
||||
@@ -893,7 +901,7 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = lv_theme_material_apply;
|
||||
theme.apply_xcb = theme_apply;
|
||||
|
||||
inited = true;
|
||||
|
||||
@@ -903,7 +911,7 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
||||
}
|
||||
|
||||
|
||||
void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
lv_style_list_t * list;
|
||||
|
||||
@@ -914,18 +922,18 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SCR:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_list_add_style(list, &scr);
|
||||
_lv_style_list_add_style(list, &scr);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -933,7 +941,7 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &btn);
|
||||
_lv_style_list_add_style(list, &btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -941,13 +949,13 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BTNMATRIX:
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &bg_click);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg_click);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -955,13 +963,13 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_KEYBOARD:
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
lv_style_list_add_style(list, &scr);
|
||||
lv_style_list_add_style(list, &kb_bg);
|
||||
_lv_style_list_add_style(list, &scr);
|
||||
_lv_style_list_add_style(list, &kb_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &bg_click);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg_click);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -969,11 +977,11 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BAR:
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
lv_style_list_add_style(list, &bar_bg);
|
||||
_lv_style_list_add_style(list, &bar_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
lv_style_list_add_style(list, &bar_indic);
|
||||
_lv_style_list_add_style(list, &bar_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -981,15 +989,15 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SWITCH:
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
lv_style_list_add_style(list, &bar_bg);
|
||||
_lv_style_list_add_style(list, &bar_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
lv_style_list_add_style(list, &bar_indic);
|
||||
_lv_style_list_add_style(list, &bar_indic);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
lv_style_list_add_style(list, &sw_knob);
|
||||
_lv_style_list_add_style(list, &sw_knob);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1027,12 +1035,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_ARC:
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &arc_bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &arc_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
lv_style_list_add_style(list, &arc_indic);
|
||||
_lv_style_list_add_style(list, &arc_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1040,11 +1048,11 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SPINNER:
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
lv_style_list_add_style(list, &arc_bg);
|
||||
_lv_style_list_add_style(list, &arc_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &arc_indic);
|
||||
_lv_style_list_add_style(list, &arc_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1052,16 +1060,16 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SLIDER:
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
lv_style_list_add_style(list, &bar_bg);
|
||||
lv_style_list_add_style(list, &slider_bg);
|
||||
_lv_style_list_add_style(list, &bar_bg);
|
||||
_lv_style_list_add_style(list, &slider_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &bar_indic);
|
||||
_lv_style_list_add_style(list, &bar_indic);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
lv_style_list_add_style(list, &slider_knob);
|
||||
_lv_style_list_add_style(list, &slider_knob);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1069,12 +1077,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CHECKBOX:
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &cb_bg);
|
||||
_lv_style_list_add_style(list, &cb_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
lv_style_list_add_style(list, &btn);
|
||||
lv_style_list_add_style(list, &cb_bullet);
|
||||
_lv_style_list_add_style(list, &btn);
|
||||
_lv_style_list_add_style(list, &cb_bullet);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1082,18 +1090,18 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_MSGBOX:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &mbox_bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &mbox_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
lv_style_list_add_style(list, &btn);
|
||||
_lv_style_list_add_style(list, &btn);
|
||||
break;
|
||||
|
||||
#endif
|
||||
@@ -1101,27 +1109,27 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LED:
|
||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
lv_style_list_add_style(list, &led);
|
||||
_lv_style_list_add_style(list, &led);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &pad_inner);
|
||||
_lv_style_list_add_style(list, &pad_inner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
_lv_style_list_add_style(list, &sb);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
|
||||
lv_style_list_add_style(list, &edge_flash);
|
||||
_lv_style_list_add_style(list, &edge_flash);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
@@ -1129,21 +1137,21 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TABVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
lv_style_list_add_style(list, &scr);
|
||||
_lv_style_list_add_style(list, &scr);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
lv_style_list_add_style(list, &tabview_btns_bg);
|
||||
_lv_style_list_add_style(list, &tabview_btns_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
lv_style_list_add_style(list, &tabview_indic);
|
||||
_lv_style_list_add_style(list, &tabview_indic);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
lv_style_list_add_style(list, &tabview_btns);
|
||||
_lv_style_list_add_style(list, &tabview_btns);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
@@ -1151,7 +1159,7 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &tabview_page_scrl);
|
||||
_lv_style_list_add_style(list, &tabview_page_scrl);
|
||||
|
||||
break;
|
||||
#endif
|
||||
@@ -1160,16 +1168,16 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TILEVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
lv_style_list_add_style(list, &scr);
|
||||
_lv_style_list_add_style(list, &scr);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &sb);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
lv_style_list_add_style(list, &edge_flash);
|
||||
_lv_style_list_add_style(list, &edge_flash);
|
||||
#endif
|
||||
break;
|
||||
#endif
|
||||
@@ -1179,12 +1187,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_ROLLER:
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &roller_bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &roller_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
lv_style_list_add_style(list, &roller_sel);
|
||||
_lv_style_list_add_style(list, &roller_sel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1200,20 +1208,20 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LIST:
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &list_bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &list_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &sb);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &list_btn);
|
||||
_lv_style_list_add_style(list, &list_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1221,22 +1229,22 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_DROPDOWN:
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &bg_click);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg_click);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &ddlist_page);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &ddlist_page);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
lv_style_list_add_style(list, &ddlist_sel);
|
||||
_lv_style_list_add_style(list, &ddlist_sel);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1244,41 +1252,41 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CHART:
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &chart_bg);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &chart_bg);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
lv_style_list_add_style(list, &chart_series_bg);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &chart_series_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
lv_style_list_add_style(list, &chart_series);
|
||||
_lv_style_list_add_style(list, &chart_series);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
lv_style_list_add_style(list, &table_cell);
|
||||
_lv_style_list_add_style(list, &table_cell);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
lv_style_list_add_style(list, &table_cell);
|
||||
_lv_style_list_add_style(list, &table_cell);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
lv_style_list_add_style(list, &table_cell);
|
||||
_lv_style_list_add_style(list, &table_cell);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
lv_style_list_add_style(list, &table_cell);
|
||||
_lv_style_list_add_style(list, &table_cell);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1286,25 +1294,25 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_WIN:
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
lv_style_list_add_style(list, &scr);
|
||||
_lv_style_list_add_style(list, &scr);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
_lv_style_list_add_style(list, &sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &tabview_page_scrl);
|
||||
_lv_style_list_add_style(list, &tabview_page_scrl);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
lv_style_list_add_style(list, &tabview_btns_bg);
|
||||
_lv_style_list_add_style(list, &tabview_btns_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &tabview_btns);
|
||||
_lv_style_list_add_style(list, &tabview_btns);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1312,20 +1320,20 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TEXTAREA:
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
lv_style_list_add_style(list, &ta_placeholder);
|
||||
_lv_style_list_add_style(list, &ta_placeholder);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &ta_cursor);
|
||||
_lv_style_list_add_style(list, &ta_cursor);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &sb);
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &sb);
|
||||
break;
|
||||
|
||||
#endif
|
||||
@@ -1335,19 +1343,19 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SPINBOX:
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &pad_small);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &spinbox_cursor);
|
||||
_lv_style_list_add_style(list, &spinbox_cursor);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &bg_click);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg_click);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1355,30 +1363,30 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CALENDAR:
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
lv_style_list_add_style(list, &calendar_date_nums);
|
||||
_lv_style_list_add_style(list, &calendar_date_nums);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
lv_style_list_add_style(list, &calendar_header);
|
||||
_lv_style_list_add_style(list, &calendar_header);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
lv_style_list_add_style(list, &calendar_daynames);
|
||||
_lv_style_list_add_style(list, &calendar_daynames);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
lv_style_list_add_style(list, &cpicker_bg);
|
||||
_lv_style_list_add_style(list, &cpicker_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
lv_style_list_add_style(list, &cpicker_indic);
|
||||
_lv_style_list_add_style(list, &cpicker_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1386,31 +1394,30 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LINEMETER:
|
||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &lmeter);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &lmeter);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
lv_style_list_add_style(list, &bg);
|
||||
lv_style_list_add_style(list, &gauge_main);
|
||||
_lv_style_list_add_style(list, &bg);
|
||||
_lv_style_list_add_style(list, &gauge_main);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
lv_style_list_add_style(list, &gauge_strong);
|
||||
_lv_style_list_add_style(list, &gauge_strong);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
lv_style_list_add_style(list, &gauge_needle);
|
||||
_lv_style_list_add_style(list, &gauge_needle);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ typedef enum {
|
||||
LV_THEME_MATERIAL_FLAG_DARK = 0x01,
|
||||
LV_THEME_MATERIAL_FLAG_LIGHT = 0x02,
|
||||
LV_THEME_MATERIAL_FLAG_NO_TRANSITION = 0x10,
|
||||
}lv_theme_material_flag_t;
|
||||
} lv_theme_material_flag_t;
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -46,7 +46,8 @@ typedef enum {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include "lv_theme.h"
|
||||
#include "../lv_widgets/lv_img.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../../lvgl.h" /*To see all the widgets*/
|
||||
|
||||
#if LV_USE_THEME_MONO
|
||||
|
||||
@@ -24,7 +21,7 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -33,6 +30,7 @@ static lv_theme_t theme;
|
||||
|
||||
static lv_style_t style_scr;
|
||||
static lv_style_t style_bg;
|
||||
static lv_style_t style_clip_corner;
|
||||
static lv_style_t style_btn;
|
||||
static lv_style_t style_round;
|
||||
static lv_style_t style_no_radius;
|
||||
@@ -45,43 +43,43 @@ static lv_style_t style_pad_small;
|
||||
static lv_style_t style_pad_inner;
|
||||
|
||||
#if LV_USE_ARC
|
||||
static lv_style_t style_arc_bg, style_arc_indic;
|
||||
static lv_style_t style_arc_bg, style_arc_indic;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
static lv_style_t style_list_btn;
|
||||
static lv_style_t style_list_btn;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
static lv_style_t style_calendar_date;
|
||||
static lv_style_t style_calendar_date;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART
|
||||
static lv_style_t style_chart_series;
|
||||
static lv_style_t style_chart_series;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
static lv_style_t style_linemeter;
|
||||
static lv_style_t style_linemeter;
|
||||
#endif
|
||||
|
||||
#if LV_USE_GAUGE
|
||||
static lv_style_t style_gauge_needle, style_gauge_major;
|
||||
static lv_style_t style_gauge_needle, style_gauge_major;
|
||||
#endif
|
||||
|
||||
#if LV_USE_PAGE
|
||||
static lv_style_t style_sb;
|
||||
static lv_style_t style_sb;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SPINNER
|
||||
static lv_style_t style_tick_line;
|
||||
static lv_style_t style_tick_line;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
static lv_style_t style_ta_cursor;
|
||||
static lv_style_t style_ta_cursor;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TABVIEW
|
||||
static lv_style_t style_tab_bg;
|
||||
static lv_style_t style_tab_bg;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -113,8 +111,8 @@ static void basic_init(void)
|
||||
lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, BG_COLOR);
|
||||
lv_style_set_border_width(&style_bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100 , 1));
|
||||
lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100 , 1));
|
||||
lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_line_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_scale_grad_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_scale_end_color(&style_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
@@ -126,6 +124,10 @@ static void basic_init(void)
|
||||
lv_style_set_pad_bottom(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
lv_style_set_pad_inner(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
|
||||
lv_style_init(&style_clip_corner);
|
||||
lv_style_set_clip_corner(&style_clip_corner, LV_STATE_DEFAULT, true);
|
||||
|
||||
|
||||
lv_style_init(&style_btn);
|
||||
lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, RADIUS);
|
||||
lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
@@ -165,7 +167,7 @@ static void basic_init(void)
|
||||
lv_style_set_line_color(&style_fg_color, LV_STATE_DEFAULT, FG_COLOR);
|
||||
|
||||
lv_style_init(&style_big_line_space);
|
||||
lv_style_set_text_line_space(&style_big_line_space, LV_STATE_DEFAULT, LV_DPI/10);
|
||||
lv_style_set_text_line_space(&style_big_line_space, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
|
||||
lv_style_init(&style_pad_none);
|
||||
lv_style_set_pad_left(&style_pad_none, LV_STATE_DEFAULT, 0);
|
||||
@@ -236,7 +238,8 @@ static void calendar_init(void)
|
||||
lv_style_set_value_font(&style_calendar_date, LV_STATE_CHECKED, LV_THEME_DEFAULT_FONT_TITLE);
|
||||
lv_style_set_value_align(&style_calendar_date, LV_STATE_CHECKED, LV_ALIGN_IN_TOP_RIGHT);
|
||||
lv_style_set_value_color(&style_calendar_date, LV_STATE_CHECKED, FG_COLOR);
|
||||
lv_style_set_value_ofs_y(&style_calendar_date, LV_STATE_CHECKED, - lv_font_get_line_height(LV_THEME_DEFAULT_FONT_TITLE) / 4);
|
||||
lv_style_set_value_ofs_y(&style_calendar_date, LV_STATE_CHECKED,
|
||||
- lv_font_get_line_height(LV_THEME_DEFAULT_FONT_TITLE) / 4);
|
||||
lv_style_set_bg_color(&style_calendar_date, LV_STATE_CHECKED, BG_COLOR);
|
||||
lv_style_set_text_color(&style_calendar_date, LV_STATE_CHECKED, FG_COLOR);
|
||||
lv_style_set_value_color(&style_calendar_date, LV_STATE_CHECKED | LV_STATE_PRESSED, BG_COLOR);
|
||||
@@ -404,7 +407,7 @@ static void textarea_init(void)
|
||||
#if LV_USE_TEXTAREA
|
||||
lv_style_init(&style_ta_cursor);
|
||||
lv_style_set_bg_opa(&style_ta_cursor, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_style_set_border_width(&style_ta_cursor, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI/100, 1));
|
||||
lv_style_set_border_width(&style_ta_cursor, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
lv_style_set_border_side(&style_ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT);
|
||||
lv_style_set_border_color(&style_ta_cursor, LV_STATE_DEFAULT, FG_COLOR);
|
||||
|
||||
@@ -485,7 +488,8 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary = color_secondary;
|
||||
@@ -527,13 +531,13 @@ lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secon
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = lv_theme_mono_apply;
|
||||
theme.apply_xcb = theme_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
lv_style_list_t * list;
|
||||
|
||||
@@ -544,18 +548,18 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SCR:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_scr);
|
||||
_lv_style_list_add_style(list, &style_scr);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -563,8 +567,8 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -572,12 +576,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BTNMATRIX:
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -585,13 +589,13 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_KEYBOARD:
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_small);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -599,15 +603,15 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BAR:
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -615,20 +619,20 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SWITCH:
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -671,11 +675,11 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_ARC:
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
lv_style_list_add_style(list, &style_arc_bg);
|
||||
_lv_style_list_add_style(list, &style_arc_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_arc_indic);
|
||||
_lv_style_list_add_style(list, &style_arc_indic);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -683,14 +687,14 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SPINNER:
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -698,19 +702,19 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SLIDER:
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_none);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
lv_style_list_add_style(list, &style_pad_small);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_pad_small);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -718,12 +722,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CHECKBOX:
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_pad_small);
|
||||
_lv_style_list_add_style(list, &style_pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -731,18 +735,18 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_MSGBOX:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
lv_style_list_add_style(list, &style_pad_inner);
|
||||
_lv_style_list_add_style(list, &style_pad_inner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
|
||||
#endif
|
||||
@@ -750,45 +754,45 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LED:
|
||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &style_pad_inner);
|
||||
_lv_style_list_add_style(list, &style_pad_inner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
_lv_style_list_add_style(list, &style_sb);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
lv_style_list_add_style(list, &style_scr);
|
||||
_lv_style_list_add_style(list, &style_scr);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
lv_style_list_add_style(list, &style_tab_bg);
|
||||
lv_style_list_add_style(list, &style_pad_small);
|
||||
_lv_style_list_add_style(list, &style_tab_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_small);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
@@ -796,7 +800,7 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &style_pad_normal);
|
||||
_lv_style_list_add_style(list, &style_pad_normal);
|
||||
|
||||
break;
|
||||
#endif
|
||||
@@ -805,15 +809,15 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TILEVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -822,14 +826,14 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_ROLLER:
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_big_line_space);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_big_line_space);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -845,22 +849,23 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LIST:
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_clip_corner);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_sb);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
lv_style_list_add_style(list, &style_list_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_list_btn);
|
||||
|
||||
break;
|
||||
#endif
|
||||
@@ -869,23 +874,23 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_DROPDOWN:
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_big_line_space);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_big_line_space);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -893,43 +898,43 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CHART:
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_border_none);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_border_none);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
lv_style_list_add_style(list, &style_chart_series);
|
||||
_lv_style_list_add_style(list, &style_chart_series);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -937,26 +942,26 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_WIN:
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
_lv_style_list_add_style(list, &style_sb);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -964,17 +969,17 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TEXTAREA:
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &style_ta_cursor);
|
||||
_lv_style_list_add_style(list, &style_ta_cursor);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_sb);
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_sb);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -983,21 +988,21 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SPINBOX:
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_fg_color);
|
||||
lv_style_list_add_style(list, &style_pad_none);
|
||||
lv_style_list_add_style(list, &style_no_radius);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_fg_color);
|
||||
_lv_style_list_add_style(list, &style_pad_none);
|
||||
_lv_style_list_add_style(list, &style_no_radius);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1005,37 +1010,37 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CALENDAR:
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
lv_style_list_add_style(list, &style_pad_small);
|
||||
lv_style_list_add_style(list, &style_border_none);
|
||||
lv_style_list_add_style(list, &style_calendar_date);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_pad_small);
|
||||
_lv_style_list_add_style(list, &style_border_none);
|
||||
_lv_style_list_add_style(list, &style_calendar_date);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
lv_style_list_add_style(list, &style_pad_normal);
|
||||
lv_style_list_add_style(list, &style_border_none);
|
||||
_lv_style_list_add_style(list, &style_pad_normal);
|
||||
_lv_style_list_add_style(list, &style_border_none);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_pad_small);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_pad_small);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -1043,25 +1048,25 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LINEMETER:
|
||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
lv_style_list_add_style(list, &style_linemeter);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_linemeter);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
lv_style_list_add_style(list, &style_gauge_major);
|
||||
_lv_style_list_add_style(list, &style_gauge_major);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
lv_style_list_add_style(list, &style_gauge_needle);
|
||||
_lv_style_list_add_style(list, &style_gauge_needle);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -6,10 +6,7 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include <stdint.h>
|
||||
#include "lv_theme.h"
|
||||
#include "../lv_widgets/lv_img.h"
|
||||
#include "../lv_misc/lv_types.h"
|
||||
#include "../../lvgl.h" /*To see all the widgets*/
|
||||
|
||||
#if LV_USE_THEME_TEMPLATE
|
||||
|
||||
@@ -24,19 +21,13 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
static lv_theme_t theme;
|
||||
static lv_color_t _color_primary;
|
||||
static lv_color_t _color_secondary;
|
||||
static lv_font_t * _font_small;
|
||||
static lv_font_t * _font_normal;
|
||||
static lv_font_t * _font_subtitle;
|
||||
static lv_font_t * _font_title;
|
||||
|
||||
static lv_style_t style_bg;
|
||||
static lv_style_t style_btn;
|
||||
@@ -61,11 +52,11 @@ static void basic_init(void)
|
||||
lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_border_width(&style_bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_border_width(&style_bg, LV_STATE_FOCUSED, 2);
|
||||
lv_style_set_border_color(&style_bg, LV_STATE_FOCUSED, _color_secondary);
|
||||
lv_style_set_border_color(&style_bg, LV_STATE_EDITED, lv_color_darken(_color_secondary, LV_OPA_30));
|
||||
lv_style_set_border_color(&style_bg, LV_STATE_FOCUSED, theme.color_secondary);
|
||||
lv_style_set_border_color(&style_bg, LV_STATE_EDITED, lv_color_darken(theme.color_secondary, LV_OPA_30));
|
||||
lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_scale_end_color(&style_bg, LV_STATE_DEFAULT, _color_primary);
|
||||
lv_style_set_scale_end_color(&style_bg, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_text_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_style_set_pad_left(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
lv_style_set_pad_right(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
@@ -75,8 +66,8 @@ static void basic_init(void)
|
||||
|
||||
lv_style_init(&style_btn);
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, _color_primary);
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(_color_primary, LV_OPA_30));
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, theme.color_primary);
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary, LV_OPA_30));
|
||||
lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
|
||||
lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
lv_style_set_image_recolor(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
@@ -85,8 +76,8 @@ static void basic_init(void)
|
||||
lv_style_set_radius(&style_round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
lv_style_init(&style_color);
|
||||
lv_style_set_bg_color(&style_color, LV_STATE_DEFAULT, _color_primary);
|
||||
lv_style_set_line_color(&style_color, LV_STATE_DEFAULT, _color_primary);
|
||||
lv_style_set_bg_color(&style_color, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_line_color(&style_color, LV_STATE_DEFAULT, theme.color_primary);
|
||||
|
||||
lv_style_init(&style_gray);
|
||||
lv_style_set_bg_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
@@ -96,7 +87,7 @@ static void basic_init(void)
|
||||
lv_style_init(&style_tick_line);
|
||||
lv_style_set_line_width(&style_tick_line, LV_STATE_DEFAULT, 5);
|
||||
lv_style_set_scale_end_line_width(&style_tick_line, LV_STATE_DEFAULT, 5);
|
||||
lv_style_set_scale_end_color(&style_tick_line, LV_STATE_DEFAULT, _color_primary);
|
||||
lv_style_set_scale_end_color(&style_tick_line, LV_STATE_DEFAULT, theme.color_primary);
|
||||
|
||||
lv_style_init(&style_tight);
|
||||
lv_style_set_pad_left(&style_tight, LV_STATE_DEFAULT, 0);
|
||||
@@ -340,15 +331,16 @@ static void win_init(void)
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title)
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
|
||||
_color_primary = color_primary;
|
||||
_color_secondary = color_secondary;
|
||||
_font_small = font_small;
|
||||
_font_normal = font_normal;
|
||||
_font_subtitle = font_subtitle;
|
||||
_font_title = font_title;
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary = color_secondary;
|
||||
theme.font_small = font_small;
|
||||
theme.font_normal = font_normal;
|
||||
theme.font_subtitle = font_subtitle;
|
||||
theme.font_title = font_title;
|
||||
theme.flags = flags;
|
||||
|
||||
basic_init();
|
||||
cont_init();
|
||||
@@ -382,13 +374,13 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = lv_theme_material_apply;
|
||||
theme.apply_xcb = theme_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
lv_style_list_t * list;
|
||||
|
||||
@@ -399,19 +391,19 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SCR:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#if LV_USE_CONT
|
||||
case LV_THEME_CONT:
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -419,8 +411,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -428,12 +420,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BTNMATRIX:
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -441,12 +433,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_KEYBOARD:
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -454,13 +446,13 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_BAR:
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -468,20 +460,20 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SWITCH:
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -524,15 +516,15 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_ARC:
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -540,14 +532,14 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SPINNER:
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -555,17 +547,17 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SLIDER:
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -576,8 +568,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -585,18 +577,18 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_MSGBOX:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_MSGBOX_BTNS:
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
|
||||
#endif
|
||||
@@ -604,62 +596,62 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LED:
|
||||
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_PAGE
|
||||
case LV_THEME_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_gray);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_gray);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABVIEW
|
||||
case LV_THEME_TABVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRL);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
|
||||
case LV_THEME_TABVIEW_PAGE:
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_gray);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_gray);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
break;
|
||||
#endif
|
||||
@@ -668,15 +660,15 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TILEVIEW:
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -685,12 +677,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_ROLLER:
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -706,21 +698,21 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LIST:
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRL);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_LIST_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -728,21 +720,21 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_DROPDOWN:
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_color);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -750,39 +742,39 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CHART:
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
|
||||
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE:
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -790,26 +782,26 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_WIN:
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
|
||||
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_WIN_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -817,20 +809,20 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_TEXTAREA:
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
lv_style_list_add_style(list, &style_gray);
|
||||
_lv_style_list_add_style(list, &style_gray);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -839,18 +831,18 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_SPINBOX:
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
|
||||
case LV_THEME_SPINBOX_BTN:
|
||||
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -858,34 +850,34 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_CALENDAR:
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_btn);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_btn);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_tight);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_tight);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_CPICKER
|
||||
case LV_THEME_CPICKER:
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_INDIC);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_INDIC);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -893,24 +885,24 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
case LV_THEME_LINEMETER:
|
||||
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
lv_style_list_add_style(list, &style_round);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_round);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
lv_style_list_add_style(list, &style_tick_line);
|
||||
_lv_style_list_add_style(list, &style_tick_line);
|
||||
|
||||
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
lv_style_list_add_style(list, &style_bg);
|
||||
_lv_style_list_add_style(list, &style_bg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
||||
@@ -42,7 +42,8 @@ extern "C" {
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, const lv_font_t * font_title);
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
CSRCS += lv_theme.c
|
||||
CSRCS += lv_theme_material.c
|
||||
CSRCS += lv_theme_mono.c
|
||||
CSRCS += lv_theme_empty.c
|
||||
CSRCS += lv_theme_template.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes
|
||||
|
||||
@@ -164,7 +164,7 @@ void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end)
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
|
||||
if(end > (ext->arc_angle_start + 360)) end = ext->arc_angle_start + 360;
|
||||
|
||||
/*Too large move, the whole arc need to be invalidated anyway*/
|
||||
@@ -254,7 +254,7 @@ void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end)
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
|
||||
if(end > (ext->bg_angle_start + 360)) end = ext->bg_angle_start + 360;
|
||||
|
||||
/*Too large move, the whole arc need to be invalidated anyway*/
|
||||
@@ -288,7 +288,7 @@ void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end)
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
|
||||
if(start > 360) start -= 360;
|
||||
if(end > (start + 360)) end = start + 360;
|
||||
|
||||
@@ -420,17 +420,18 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
|
||||
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg,
|
||||
lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
|
||||
lv_draw_line_dsc_t arc_dsc;
|
||||
lv_coord_t x = arc->coords.x1 + r + left_bg;
|
||||
lv_coord_t y = arc->coords.y1 + r + top_bg;
|
||||
|
||||
lv_draw_line_dsc_t arc_dsc;
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_BG, &arc_dsc);
|
||||
if(r > 0) {
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_BG, &arc_dsc);
|
||||
|
||||
lv_draw_arc(x, y, r, ext->bg_angle_start + ext->rotation_angle, ext->bg_angle_end + ext->rotation_angle, clip_area, &arc_dsc);
|
||||
lv_draw_arc(x, y, r, ext->bg_angle_start + ext->rotation_angle, ext->bg_angle_end + ext->rotation_angle, clip_area,
|
||||
&arc_dsc);
|
||||
}
|
||||
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_INDIC, &arc_dsc);
|
||||
|
||||
/*make the indicator arc smaller or larger according to its greatest padding value*/
|
||||
lv_coord_t left_indic = lv_obj_get_style_pad_left(arc, LV_ARC_PART_INDIC);
|
||||
@@ -439,7 +440,13 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_coord_t bottom_indic = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_INDIC);
|
||||
r -= LV_MATH_MAX4(left_indic, right_indic, top_indic, bottom_indic);
|
||||
|
||||
lv_draw_arc(x, y, r, ext->arc_angle_start + ext->rotation_angle, ext->arc_angle_end + ext->rotation_angle, clip_area, &arc_dsc);
|
||||
if(r > 0) {
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_INDIC, &arc_dsc);
|
||||
|
||||
lv_draw_arc(x, y, r, ext->arc_angle_start + ext->rotation_angle, ext->arc_angle_end + ext->rotation_angle, clip_area,
|
||||
&arc_dsc);
|
||||
}
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
@@ -512,7 +519,7 @@ static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angl
|
||||
|
||||
start_angle += ext->rotation_angle;
|
||||
end_angle += ext->rotation_angle;
|
||||
|
||||
|
||||
if(start_angle >= 360) start_angle -= 360;
|
||||
if(end_angle >= 360) end_angle -= 360;
|
||||
|
||||
@@ -535,74 +542,74 @@ static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angl
|
||||
|
||||
if(start_quarter == end_quarter && start_angle <= end_angle) {
|
||||
if(start_quarter == 0) {
|
||||
inv_area.y1 = y + ((lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y1 = y + ((_lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
||||
inv_area.y2 = y + ((lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x1 = x + ((lv_trigo_sin(end_angle + 90) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y2 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x1 = x + ((_lv_trigo_sin(end_angle + 90) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
else if(start_quarter == 1) {
|
||||
inv_area.y2 = y + ((lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x2 = x + ((lv_trigo_sin(start_angle + 90) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x2 = x + ((_lv_trigo_sin(start_angle + 90) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
||||
inv_area.y1 = y + ((lv_trigo_sin(end_angle) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x1 = x + ((lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((_lv_trigo_sin(end_angle) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x1 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
else if(start_quarter == 2) {
|
||||
inv_area.x1 = x + ((lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y2 = y + ((lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x1 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y2 = y + ((_lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
||||
inv_area.y1 = y + ((lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((lv_trigo_sin(end_angle + 90) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y1 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((_lv_trigo_sin(end_angle + 90) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
else if(start_quarter == 3) {
|
||||
/*Small arc here*/
|
||||
inv_area.x1 = x + ((lv_trigo_sin(start_angle + 90) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x1 = x + ((_lv_trigo_sin(start_angle + 90) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
|
||||
inv_area.x2 = x + ((lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + ((lv_trigo_sin(end_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x2 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + ((_lv_trigo_sin(end_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
|
||||
}
|
||||
else if(start_quarter == 0 && end_quarter == 1) {
|
||||
inv_area.x1 = x + ((lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((LV_MATH_MIN(lv_trigo_sin(end_angle),
|
||||
lv_trigo_sin(start_angle)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x1 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((LV_MATH_MIN(_lv_trigo_sin(end_angle),
|
||||
_lv_trigo_sin(start_angle)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + rout + extra_area;
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
else if(start_quarter == 1 && end_quarter == 2) {
|
||||
inv_area.x1 = x - rout - extra_area;
|
||||
inv_area.y1 = y + ((lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((LV_MATH_MAX(lv_trigo_sin(start_angle + 90),
|
||||
lv_trigo_sin(end_angle + 90)) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + ((lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y1 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + ((LV_MATH_MAX(_lv_trigo_sin(start_angle + 90),
|
||||
_lv_trigo_sin(end_angle + 90)) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
else if(start_quarter == 2 && end_quarter == 3) {
|
||||
inv_area.x1 = x + ((lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x1 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y - rout - extra_area;
|
||||
inv_area.x2 = x + ((lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + (LV_MATH_MAX(lv_trigo_sin(end_angle) * rin,
|
||||
lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.x2 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + (LV_MATH_MAX(_lv_trigo_sin(end_angle) * rin,
|
||||
_lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
else if(start_quarter == 3 && end_quarter == 0) {
|
||||
inv_area.x1 = x + ((LV_MATH_MIN(lv_trigo_sin(end_angle + 90),
|
||||
lv_trigo_sin(start_angle + 90)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x1 = x + ((LV_MATH_MIN(_lv_trigo_sin(end_angle + 90),
|
||||
_lv_trigo_sin(start_angle + 90)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.y1 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
inv_area.x2 = x + rout + extra_area;
|
||||
inv_area.y2 = y + ((lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
inv_area.y2 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
||||
lv_obj_invalidate_area(arc, &inv_area);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user