Compare commits

...

73 Commits

Author SHA1 Message Date
Gabor Kiss-Vamosi
7f1efd4f16 ci(stale): do not mark shaping and ready for development issues as stale 2024-04-18 11:29:54 +02:00
VIFEX
76fb298090 feat(vg_lite): adapt premultiply src over blend mode (#6062)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-04-18 10:55:28 +08:00
Gabor Kiss-Vamosi
bbab604278 fix(image): set the draw_task area correctly for tiled image (#6029)
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
2024-04-17 13:17:49 +02:00
Lexi Beavil
76df54db5a fix(encoder): always fire LV_EVENT_LONG_PRESSED to indev callback (#6064) 2024-04-17 12:19:13 +02:00
jiangxiaobaiyuenyxx
516825ffe0 fix(vg_lite):check the color format before alloc layer buffer (#6071)
Signed-off-by: bailinjiang <915290475@qq.com>
2024-04-17 11:23:23 +02:00
Benign X
d1306d3ec5 chore(lodepng): fix typo (#6077) 2024-04-17 11:15:04 +02:00
Benign X
970781fb83 fix(lodepng): fix crash when fallback from lodepng decoder (#6079) 2024-04-17 16:10:44 +08:00
qinshijing
7e7590a0a3 fix(scroll): fix deletion animation causing missing scroll end event (#5979)
Signed-off-by: qinshijing <qinshijing@xiaomi.com>
Co-authored-by: qinshijing <qinshijing@xiaomi.com>
2024-04-15 19:04:39 +02:00
Niklas Fiekas
4f68cd6367 fix(evdev): add missing include for strerror (#6047) 2024-04-15 18:36:08 +02:00
VIFEX
b9c41e2666 feat(fs): add profiler hook (#6056)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-04-15 18:34:38 +02:00
bryghtlabs-richard
8cbec5922e docs(obj): fix add/remove flag documentation (#6067) 2024-04-15 12:42:41 +08:00
Liam
af642572aa fix(canvas): invalidate canvas on finish layer (#6042) 2024-04-14 14:49:31 +08:00
Liam
bcc3059c19 fix(bin_decoder): fix memory leak (#5990) 2024-04-12 15:46:04 +02:00
Joram Agten
a28ddae80f fix(font): fix the include path of lvgl.h (#6050) 2024-04-12 15:43:35 +02:00
Steven Qiu
5826cd377c fix(kconfig): add Montserrat 10 font to default title font list in Kconfig (#6057) (#6058) 2024-04-12 15:41:54 +02:00
Gabor Kiss-Vamosi
8d4397b864 fix(stlye): refresh the style on transition start (#6043) 2024-04-12 12:02:34 +08:00
lhdjply
f78a5761cc docs(calendar): move instruction to the usage section (#6045)
Signed-off-by: lhdjply <lhdjply@126.com>
2024-04-12 01:10:23 +08:00
terry.rong
067bb2fc3a fix(canvas): fix buf copy assert msg error (#6063)
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-04-12 00:46:33 +08:00
Gabor Kiss-Vamosi
eb62ddf4ea fix(display): update the color format of the draw buffers on color format change (#5973) 2024-04-11 16:13:41 +08:00
zylalx1
47ec2784d8 chore: update some code and docs to use v9 API (#5876)
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
2024-04-10 15:17:44 +08:00
Gabor Kiss-Vamosi
0143320f1f perf(theme): optimize the order of function calls (#5971) 2024-04-10 15:09:06 +08:00
Pieter van Ginkel
1f37da22db feat(drivers): account for the frame buffer virtual resolution deviating from the visible resolution. (#5988) 2024-04-10 15:07:55 +08:00
Gabor Kiss-Vamosi
5e4fa47b20 fix(label): fix maybe-uninitialized warning (#6028) 2024-04-10 15:02:06 +08:00
Benign X
500e16e968 feat(decoder): add a name field to decoder to facilitate debugging (#6037) 2024-04-09 17:31:07 +08:00
VIFEX
4d0c029827 fix(draw): fix the default draw thread stack is too large (#5951)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: FASTSHIFT <vifextech@foxmail.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-04-08 21:31:19 +02:00
Gabor Kiss-Vamosi
c96706da7e ci: use ubuntu-22.04 instead of ubuntu-latest (#6032) 2024-04-08 18:18:13 +02:00
VIFEX
5f755cf47a feat(fs_posix): add error number print (#6041)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-04-08 22:25:33 +08:00
liamHowatt
b49638accd fix(driver): lv_x11_input.c fixes (#6033) 2024-04-08 15:10:48 +02:00
lhdjply
466e29a1be feat(calendar): add chinese calendar (#5940)
Signed-off-by: lhdjply <lhdjply@126.com>
2024-04-08 14:06:22 +02:00
Klaus Musch
b74d34407f feat(example): make "LVGL_Arduino.ino" easier to use (#6001) 2024-04-06 12:10:32 +02:00
liamHowatt
3e21769fa6 chore(text): move "_" funcs to private h (#5913) 2024-04-06 09:01:11 +02:00
Klaus Musch
c9a6b25885 fix(example): LVGL_Arduino.ino millis() as tick source (#5999) 2024-04-05 16:23:43 +08:00
RoboSchmied
a3d20a78dd docs: fix typo in the comments [ci skip] (#6027)
Signed-off-by: RoboSchmied <github@roboschmie.de>
2024-04-05 16:20:00 +08:00
liamHowatt
33867f6127 fix(textarea): update password bullets immediately on set (#5943) 2024-04-05 10:15:43 +02:00
VIFEX
a3e9b11cda fix(nuttx): fix gesture event failure (#5996)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: Benign X <1341398182@qq.com>
2024-04-04 18:08:09 +08:00
Benign X
c9922d5701 chore(vg_lite_tvg): fix build warnings (#5984)
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
Co-authored-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-04-04 14:57:05 +08:00
Jaeyoon Jung
29662d1c35 fix(fbdev): set resolution prior to buffer (#6004)
Signed-off-by: Jaeyoon Jung <jaeyoon.jung@lge.com>
2024-04-04 14:55:34 +08:00
liamHowatt
4fcf70828d fix(thorvg): fix windows build break (#5978) 2024-04-03 15:35:15 +02:00
Pieter van Ginkel
f7b860ffde feat(evdev): automatically calibrate pointer input devices. (#5989) 2024-04-02 21:47:54 +02:00
Benign X
03498a2f83 feat(draw_buf): user can separate font draw buf from default draw buff now (#5982) 2024-03-30 13:13:05 +08:00
Benign X
83b66d5374 chore(kconfig): move use_vector to correct place (#5995) 2024-03-29 18:15:14 +08:00
liamHowatt
c6c2c1e961 feat(scale): mutiple line needles (#5937) 2024-03-29 10:33:29 +01:00
Ramesh
436172e582 fix(kconfig): update as per lv_conf_template.h (#5980) 2024-03-29 08:19:19 +01:00
Benign X
db84c4ee29 feat(draw_buff): add user custom draw buffer instance support (#5974) 2024-03-29 11:16:54 +08:00
Ramesh
dee1d27e0d chore(vg_lite): fix typo (#5993) 2024-03-29 11:04:55 +08:00
Benign X
650b57cd2c feat(cache): add more profile notes (#5983) 2024-03-29 10:39:42 +08:00
Benign X
00c83eb2d2 feat(font): add lv_font_glyph_release_draw_data api to release glyph data (#5985) 2024-03-28 20:53:28 +01:00
VIFEX
4cce3b5cd9 perf(draw): skip border drawing when border side is none (#5959)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-03-28 19:37:48 +01:00
Gabor Kiss-Vamosi
30d1a5cf9b docs(renesas): fix the links (#5977) 2024-03-28 18:59:56 +01:00
jiangxiaobaiyuenyxx
ab6ee94aee fix(anim): optimize repeat_count type (#5975)
Signed-off-by: bailinjiang <915290475@qq.com>
2024-03-28 09:49:31 +08:00
lhdjply
dc0210b9c6 fix(rtthread): implement lv_strcat function in rt-thread due to absence of rt_strcat (#5920)
Signed-off-by: lhdjply <lhdjply@126.com>
2024-03-27 21:17:05 +01:00
Gabor Kiss-Vamosi
fea8a97f5f docs(renesas): add a general introduction page (#5969) 2024-03-27 11:11:59 +01:00
pengyiqiang
9b3e8eec6d chore(Makefile): remove useless macro LV_USE_DEV_VERSION
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-03-27 16:13:42 +08:00
VIFEX
ed5d528de8 chore(vg_lite): remove duplicate parameter judgments (#5960)
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-03-27 08:52:31 +01:00
Benign X
000699827f feat(nuttx): add defer feature for nuttx image cache (#5967) 2024-03-27 14:36:29 +08:00
liamHowatt
03b5f583bc fix(span): handle trailing newline (#5957) 2024-03-27 06:24:44 +01:00
lhdjply
45e4aa9fc3 fix(sdl_keyboard): fix warning of the implicit declaration of function memmove (#5962)
Signed-off-by: lhdjply <lhdjply@126.com>
2024-03-27 10:56:45 +08:00
lhdjply
b426209f0c chore(PR): modify the astyle version description in PR (#5963)
Signed-off-by: lhdjply <lhdjply@126.com>
2024-03-27 10:56:22 +08:00
bailinjiang
6e3f6866cb fix(anim): fix lv_anim_set_repeat_count configuration parameter may be truncated
Signed-off-by: bailinjiang <915290475@qq.com>
2024-03-27 10:55:17 +08:00
bailinjiang
150d1a1d37 fix(animimg): Optimize the structure size of animations
Signed-off-by: bailinjiang <915290475@qq.com>
2024-03-27 10:54:22 +08:00
cristian-stoica
ac576a2bf4 feat(vglite) add implementation for partial border (#5912)
Signed-off-by: Ana Grad <ana.grad@nxp.com>
Co-authored-by: Ana Grad <ana.grad@nxp.com>
2024-03-26 17:57:17 +08:00
Gabor Kiss-Vamosi
bcb8dbb736 feat(mask): add support for image file bitmap masks (#5911) 2024-03-26 17:28:09 +08:00
Gabriel Wang
667f401db6 chore(cmsis-pack): minor update (#5948) 2024-03-26 10:59:47 +08:00
VIFEX
e33bc08e54 fix(obj_tree): fix event loss caused by obj deletion (#5950)
Signed-off-by: HaoHangyu <haohangyu@xiaomi.com>
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: HaoHangyu <haohangyu@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-03-26 10:59:32 +08:00
Marex
b339e67581 fix(sdl): handle both LV_IMAGE_SRC_FILE and LV_IMAGE_SRC_VARIABLE (#5852)
Signed-off-by: Marek Vasut <marex@denx.de>
Co-authored-by: Marek Vasut <marex@denx.de>
2024-03-25 19:49:17 +01:00
Marcel Kalmes
7722f0f5ce fixed compile error on line 402 when using two SDL frame buffers 2024-03-25 22:38:55 +08:00
Marex
9dec22dfaa fix(demos): update README to match lv_demos.c (#5939)
Signed-off-by: Marek Vasut <marex@denx.de>
Co-authored-by: Marek Vasut <marex@denx.de>
2024-03-25 14:43:27 +08:00
liamHowatt
ba42133458 feat(stdlib): add lv_strncat and refactor strcat uses (#5927) 2024-03-25 14:37:51 +08:00
liamHowatt
0cdad0299d chore(observer): rename lv_button_bind_checked to lv_obj_bind_checked (#5944) 2024-03-25 14:13:31 +08:00
Benign X
48416d7dae refactor(font): refactor font glyph data acquire method (#5884) 2024-03-22 11:51:08 +01:00
Benign X
213cb5971e feat(cache): image cache supports dynamic setting of cache size (#5926) 2024-03-22 10:51:03 +08:00
Sean Wilson
9fe9cf6368 Optimize lv_color_16_16_mix() when c1 == c2 (#5929) 2024-03-22 10:07:00 +08:00
lion2tomato
21dd110e63 feat(draw): add draw thread stack size config option (#5910)
Signed-off-by: lijianjun <lijianjun@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
Co-authored-by: lijianjun <lijianjun@xiaomi.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
2024-03-22 10:06:27 +08:00
236 changed files with 25566 additions and 2308 deletions

View File

@@ -40,7 +40,7 @@ static void memory_monitor(lv_timer_t * param);
/**********************
* STATIC VARIABLES
**********************/
static lv_disp_t * disp1;
static lv_display_t * disp1;
int monitor_hor_res, monitor_ver_res;
@@ -77,9 +77,9 @@ int main(int argc, char ** argv)
void do_loop(void *arg)
{
/* Periodically call the lv_task handler.
/* Periodically call the lv_timer handler.
* It could be done in a timer interrupt or an OS task too.*/
lv_task_handler();
lv_timer_handler();
}
/**********************
@@ -92,7 +92,7 @@ void do_loop(void *arg)
*/
static void hal_init(void)
{
lv_disp_t * disp = lv_sdl_window_create(monitor_hor_res, monitor_ver_res);
lv_display_t * disp = lv_sdl_window_create(monitor_hor_res, monitor_ver_res);
lv_group_t * g = lv_group_create();
lv_group_set_default(g);

View File

@@ -7,7 +7,7 @@ A clear and concise description of what the bug or new feature is.
- Add [Examples](https://github.com/lvgl/lvgl/tree/master/examples) if relevant.
- Add [Tests](https://github.com/lvgl/lvgl/blob/master/tests/README.md) if applicable.
- If you added new options to `lv_conf_template.h` run [lv_conf_internal_gen.py](https://github.com/lvgl/lvgl/blob/master/scripts/lv_conf_internal_gen.py) and update [Kconfig](https://github.com/lvgl/lvgl/blob/master/Kconfig).
- Run `scripts/code-format.py` ([astyle](http://astyle.sourceforge.net/install.html) version [v3.4.10](https://github.com/szepeviktor/astyle/releases/tag/v3.4.10) needs to be installed) and follow the [Code Conventions](https://docs.lvgl.io/master/CODING_STYLE.html).
- Run `scripts/code-format.py` ([astyle](http://astyle.sourceforge.net/install.html) version [v3.4.12](https://github.com/szepeviktor/astyle/releases/tag/v3.4.12) needs to be installed) and follow the [Code Conventions](https://docs.lvgl.io/master/CODING_STYLE.html).
- Mark the Pull request as [Draft](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request) while you are working on the first version, and mark is as _Ready_ when it's ready for review.
- When changes were requested, [re-request review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/requesting-a-pull-request-review) to notify the maintainers.
- Help us to review this Pull Request! Anyone can [approve or request changes](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/approving-a-pull-request-with-required-reviews).

View File

@@ -7,7 +7,7 @@ on:
jobs:
lint:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1

View File

@@ -8,7 +8,7 @@ jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
name: Build ${{ matrix.port }} port
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
continue-on-error: true
strategy:
matrix:

View File

@@ -9,7 +9,7 @@ on:
jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
strategy:
matrix:
# A valid option parameter to the cmake file.

View File

@@ -6,7 +6,7 @@ on:
jobs:
verify-conf-internal:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

View File

@@ -6,7 +6,7 @@ on:
jobs:
verify-formatting:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

View File

@@ -7,28 +7,28 @@ on:
jobs:
stale:
if: github.repository == 'lvgl/lvgl'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/stale@v9
with:
repo-token: ${{ secrets.LVGL_BOT_TOKEN }}
stale-issue-message: |
We need some feedback on this issue.
Now we mark this as "stale" because there was no activity here for 14 days.
Now we mark this as "stale" because there was no activity here for 14 days.
Remove the "stale" label or comment else this will be closed in 7 days.
stale-pr-message: |
We need some feedback on this pull request.
Now we mark this as "stale" because there was no activity here for 14 days.
Now we mark this as "stale" because there was no activity here for 14 days.
Remove the "stale" label or comment else this will be closed in 7 days.
close-issue-message: |
As there was no activity here for a while we close this issue. But don't worry, the conversation is still here and you can get back to it at any time.
So feel free to comment if you have remarks or ideas on this topic.
days-before-stale: 14
days-before-close: 7
exempt-issue-labels: 'pinned, next major, next minor'
exempt-issue-labels: 'pinned, next major, next minor, shaping, ready for development'
exempt-pr-labels: 'pinned, next major, next minor'

View File

@@ -10,7 +10,7 @@ env:
jobs:
build-and-deploy:
if: github.repository == 'lvgl/lvgl'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
concurrency: docs-build-and-deploy
steps:
- name: Checkout

View File

@@ -8,7 +8,7 @@ on:
jobs:
upload_components:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:

View File

@@ -4,7 +4,7 @@ on:
jobs:
auto_close_issues:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

View File

@@ -9,7 +9,7 @@ on:
jobs:
build:
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
name: Build using Makefile
steps:
- uses: actions/checkout@v4

View File

@@ -6,7 +6,7 @@ on:
name: PlatformIO Publish
jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

View File

@@ -9,7 +9,7 @@ name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4

58
Kconfig
View File

@@ -183,6 +183,13 @@ menu "LVGL configuration"
it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks.
"Transformed layers" (if `transform_angle/zoom` are set) use larger buffers and can't be drawn in chunks.
config LV_DRAW_THREAD_STACK_SIZE
int "Stack size of draw thread in bytes"
default 8192
depends on LV_USE_OS > 0
help
If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
config LV_USE_DRAW_SW
bool "Enable software rendering"
default y
@@ -206,7 +213,7 @@ menu "LVGL configuration"
config LV_USE_NATIVE_HELIUM_ASM
bool "Enable native helium assembly"
default y
default n
depends on LV_USE_DRAW_SW
help
Disabling this allows arm2d to work on its own (for testing only)
@@ -335,7 +342,7 @@ menu "LVGL configuration"
which usually improves performance,
but does not guarantee the same rendering quality as the software.
config LV_VG_LITE_LINEAER_GRAD_CACHE_CNT
config LV_VG_LITE_LINEAR_GRAD_CACHE_CNT
int "VG-Lite linear gradient image maximum cache number."
default 32
depends on LV_USE_DRAW_VG_LITE
@@ -666,6 +673,8 @@ menu "LVGL configuration"
bool "Enable Montserrat 28 compressed"
config LV_FONT_DEJAVU_16_PERSIAN_HEBREW
bool "Enable Dejavu 16 Persian, Hebrew, Arabic letters"
config LV_FONT_SIMSUN_14_CJK
bool "Enable Simsun 14 CJK"
config LV_FONT_SIMSUN_16_CJK
bool "Enable Simsun 16 CJK"
@@ -686,6 +695,9 @@ menu "LVGL configuration"
config LV_FONT_DEFAULT_MONTSERRAT_8
bool "Montserrat 8"
select LV_FONT_MONTSERRAT_8
config LV_FONT_DEFAULT_MONTSERRAT_10
bool "Montserrat 10"
select LV_FONT_MONTSERRAT_10
config LV_FONT_DEFAULT_MONTSERRAT_12
bool "Montserrat 12"
select LV_FONT_MONTSERRAT_12
@@ -749,6 +761,9 @@ menu "LVGL configuration"
config LV_FONT_DEFAULT_DEJAVU_16_PERSIAN_HEBREW
bool "Dejavu 16 Persian, Hebrew, Arabic letters"
select LV_FONT_DEJAVU_16_PERSIAN_HEBREW
config LV_FONT_DEFAULT_SIMSUN_14_CJK
bool "Simsun 14 CJK"
select LV_FONT_SIMSUN_14_CJK
config LV_FONT_DEFAULT_SIMSUN_16_CJK
bool "Simsun 16 CJK"
select LV_FONT_SIMSUN_16_CJK
@@ -874,6 +889,9 @@ menu "LVGL configuration"
bool "Use calendar header dropdown"
depends on LV_USE_CALENDAR
default y
config LV_USE_CALENDAR_CHINESE
bool "Use chinese calendar"
depends on LV_USE_CALENDAR
config LV_USE_CANVAS
bool "Canvas. Requires: lv_image"
imply LV_USE_IMAGE
@@ -928,9 +946,6 @@ menu "LVGL configuration"
config LV_USE_MSGBOX
bool "Msgbox"
default y if !LV_CONF_MINIMAL
config LV_USE_OBSERVER
bool "Observer"
default n
config LV_USE_ROLLER
bool "Roller. Requires: lv_label"
imply LV_USE_LABEL
@@ -1143,6 +1158,7 @@ menu "LVGL configuration"
config LV_USE_RLOTTIE
bool "Lottie library"
config LV_USE_THORVG
bool "ThorVG library"
choice
@@ -1248,10 +1264,6 @@ menu "LVGL configuration"
bool "Center"
endchoice
config LV_USE_MONKEY
bool "Enable Monkey test"
default n
config LV_USE_PROFILER
bool "Runtime performance profiler"
config LV_USE_PROFILER_BUILTIN
@@ -1267,6 +1279,10 @@ menu "LVGL configuration"
depends on LV_USE_PROFILER
default "lvgl/src/misc/lv_profiler_builtin.h"
config LV_USE_MONKEY
bool "Enable Monkey test"
default n
config LV_USE_GRIDNAV
bool "Enable grid navigation"
default n
@@ -1276,9 +1292,13 @@ menu "LVGL configuration"
default n
config LV_USE_IMGFONT
bool "draw image in label or span obj"
bool "Support using images as font in label or span widgets"
default n
config LV_USE_OBSERVER
bool "Observer"
default y
config LV_USE_IME_PINYIN
bool "Enable Pinyin input method"
default n
@@ -1378,6 +1398,24 @@ menu "LVGL configuration"
depends on LV_USE_SDL
default y
choice
prompt "SDL mousewheel mode"
depends on LV_USE_SDL
default LV_SDL_MOUSEWHEEL_MODE_ENCODER
config LV_SDL_MOUSEWHEEL_MODE_ENCODER
bool "The mousewheel emulates an encoder input device"
config LV_SDL_MOUSEWHEEL_MODE_CROWN
bool "The mousewheel emulates a smart watch crown"
endchoice
config LV_SDL_MOUSEWHEEL_MODE
int
depends on LV_USE_SDL
default 0 if LV_SDL_MOUSEWHEEL_MODE_ENCODER
default 1 if LV_SDL_MOUSEWHEEL_MODE_CROWN
config LV_USE_X11
bool "Use X11 window manager to open window on Linux PC and handle mouse and keyboard"
default n

View File

@@ -59,7 +59,7 @@
## Configure Demos Entry
"demos/lv_demos.c" provides `lv_demos_create` and `lv_demos_usage` to simplify the creation of demos.
"demos/lv_demos.c" provides `lv_demos_create` and `lv_demos_show_help` to simplify the creation of demos.
If you build your main program named `lv_demos`, then you can run the widgets demo by running `lv_demos widgets` and the benchmark demo by running `lv_demos benchmark 1`.
@@ -71,9 +71,9 @@ For example:
#include "demos/lv_demos.h"
...
static lv_disp_t* hal_init(void)
static lv_display_t* hal_init(void)
{
lv_disp_t* disp = NULL;
lv_display_t* disp = NULL;
...
/* TODO: init display and indev */
@@ -86,14 +86,14 @@ int main(int argc, char ** argv)
{
lv_init();
lv_disp_t* disp = hal_init();
lv_display_t* disp = hal_init();
if (disp == NULL) {
LV_LOG_ERROR("lv_demos initialization failure!");
return 1;
}
if (!lv_demos_create(&argv[1], argc - 1)) {
lv_demos_usage();
lv_demos_show_help();
goto demo_end;
}

View File

@@ -77,9 +77,9 @@ static void empty_screen_cb(void)
static void moving_wallpaper_cb(void)
{
lv_obj_set_style_pad_all(lv_screen_active(), 0, 0);
LV_IMG_DECLARE(img_benchmark_cogwheel_rgb);
LV_IMAGE_DECLARE(img_benchmark_cogwheel_rgb);
lv_obj_t * img = lv_img_create(lv_screen_active());
lv_obj_t * img = lv_image_create(lv_screen_active());
lv_obj_set_size(img, lv_pct(150), lv_pct(150));
lv_image_set_src(img, &img_benchmark_cogwheel_rgb);
lv_image_set_inner_align(img, LV_IMAGE_ALIGN_TILE);
@@ -120,7 +120,7 @@ static void multiple_rgb_images_cb(void)
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
lv_obj_set_style_pad_row(lv_screen_active(), 20, 0);
LV_IMG_DECLARE(img_benchmark_cogwheel_rgb);
LV_IMAGE_DECLARE(img_benchmark_cogwheel_rgb);
int32_t hor_cnt = ((int32_t)lv_display_get_horizontal_resolution(NULL) - 16) / 116;
int32_t ver_cnt = ((int32_t)lv_display_get_vertical_resolution(NULL) - 116) / 116;
@@ -131,7 +131,7 @@ static void multiple_rgb_images_cb(void)
for(y = 0; y < ver_cnt; y++) {
int32_t x;
for(x = 0; x < hor_cnt; x++) {
lv_obj_t * obj = lv_img_create(lv_screen_active());
lv_obj_t * obj = lv_image_create(lv_screen_active());
lv_image_set_src(obj, &img_benchmark_cogwheel_rgb);
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
@@ -146,7 +146,7 @@ static void multiple_argb_images_cb(void)
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
lv_obj_set_style_pad_row(lv_screen_active(), 20, 0);
LV_IMG_DECLARE(img_benchmark_cogwheel_argb);
LV_IMAGE_DECLARE(img_benchmark_cogwheel_argb);
int32_t hor_cnt = ((int32_t)lv_display_get_horizontal_resolution(NULL) - 16) / 116;
int32_t ver_cnt = ((int32_t)lv_display_get_vertical_resolution(NULL) - 116) / 116;
@@ -157,7 +157,7 @@ static void multiple_argb_images_cb(void)
for(y = 0; y < ver_cnt; y++) {
int32_t x;
for(x = 0; x < hor_cnt; x++) {
lv_obj_t * obj = lv_img_create(lv_screen_active());
lv_obj_t * obj = lv_image_create(lv_screen_active());
lv_image_set_src(obj, &img_benchmark_cogwheel_argb);
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
@@ -172,7 +172,7 @@ static void rotated_argb_image_cb(void)
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
lv_obj_set_style_pad_row(lv_screen_active(), 20, 0);
LV_IMG_DECLARE(img_benchmark_cogwheel_argb);
LV_IMAGE_DECLARE(img_benchmark_cogwheel_argb);
int32_t hor_cnt = ((int32_t)lv_display_get_horizontal_resolution(NULL) - 16) / 116;
int32_t ver_cnt = ((int32_t)lv_display_get_vertical_resolution(NULL) - 116) / 116;
@@ -183,7 +183,7 @@ static void rotated_argb_image_cb(void)
for(y = 0; y < ver_cnt; y++) {
int32_t x;
for(x = 0; x < hor_cnt; x++) {
lv_obj_t * obj = lv_img_create(lv_screen_active());
lv_obj_t * obj = lv_image_create(lv_screen_active());
lv_image_set_src(obj, &img_benchmark_cogwheel_argb);
if(x == 0) lv_obj_add_flag(obj, LV_OBJ_FLAG_FLEX_IN_NEW_TRACK);
@@ -241,7 +241,7 @@ static void multiple_arcs_cb(void)
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_ROW_WRAP);
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_START);
LV_IMG_DECLARE(img_benchmark_cogwheel_argb);
LV_IMAGE_DECLARE(img_benchmark_cogwheel_argb);
int32_t hor_cnt = (lv_display_get_horizontal_resolution(NULL) - 16) / lv_dpx(160);
int32_t ver_cnt = (lv_display_get_vertical_resolution(NULL) - 16) / lv_dpx(160);
@@ -761,7 +761,7 @@ static lv_obj_t * card_create(void)
lv_obj_set_size(panel, 270, 120);
lv_obj_set_style_pad_all(panel, 8, 0);
LV_IMG_DECLARE(img_transform_avatar_15);
LV_IMAGE_DECLARE(img_transform_avatar_15);
lv_obj_t * child = lv_image_create(panel);
lv_obj_align(child, LV_ALIGN_LEFT_MID, 0, 0);
lv_image_set_src(child, &img_transform_avatar_15);

View File

@@ -184,7 +184,7 @@ const LV_ATTRIBUTE_MEM_ALIGN uint8_t img_lv_demo_music_cover_1_map[] = {
0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,
};
lv_img_dsc_t img_lv_demo_music_cover_1 = {
const lv_image_dsc_t img_lv_demo_music_cover_1 = {
.header.w = 176,
.header.h = 175,
.header.cf = LV_COLOR_FORMAT_ARGB8888,

View File

@@ -445,7 +445,7 @@ img_lv_demo_music_cover_1_map[] = {
};
const lv_img_dsc_t img_lv_demo_music_cover_1 = {
const lv_image_dsc_t img_lv_demo_music_cover_1 = {
.header.w = 428,
.header.h = 428,
.header.cf = LV_COLOR_FORMAT_ARGB8888,

View File

@@ -185,7 +185,7 @@ const LV_ATTRIBUTE_MEM_ALIGN uint8_t img_lv_demo_music_cover_2_map[] = {
};
lv_img_dsc_t img_lv_demo_music_cover_2 = {
const lv_image_dsc_t img_lv_demo_music_cover_2 = {
.header.w = 176,
.header.h = 175,
.header.cf = LV_COLOR_FORMAT_ARGB8888,

View File

@@ -445,7 +445,7 @@ img_lv_demo_music_cover_2_map[] = {
};
const lv_img_dsc_t img_lv_demo_music_cover_2 = {
const lv_image_dsc_t img_lv_demo_music_cover_2 = {
.header.w = 428,
.header.h = 428,
.header.cf = LV_COLOR_FORMAT_ARGB8888,

View File

@@ -185,7 +185,7 @@ const LV_ATTRIBUTE_MEM_ALIGN uint8_t img_lv_demo_music_cover_3_map[] = {
};
lv_img_dsc_t img_lv_demo_music_cover_3 = {
const lv_image_dsc_t img_lv_demo_music_cover_3 = {
.header.w = 176,
.header.h = 175,
.header.cf = LV_COLOR_FORMAT_ARGB8888,

View File

@@ -444,7 +444,7 @@ img_lv_demo_music_cover_3_map[] = {
};
const lv_img_dsc_t img_lv_demo_music_cover_3 = {
const lv_image_dsc_t img_lv_demo_music_cover_3 = {
.header.w = 428,
.header.h = 428,
.header.cf = LV_COLOR_FORMAT_ARGB8888,

View File

@@ -55,7 +55,7 @@ img_render_lvgl_logo_argb8888_map[] = {
0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0xd7, 0x33, 0x01, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd9, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd6, 0x33, 0x00, 0x01, 0xd7, 0x33, 0x01, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd6, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd7, 0x33, 0x00, 0x00, 0xd9, 0x28, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x22, 0x1c, 0x1c, 0x25, 0x23, 0x1e, 0x1e, 0x33, 0x22, 0x1e, 0x1e, 0x33, 0x23, 0x1e, 0x1e, 0x33, 0x23, 0x1e, 0x1e, 0x33, 0x23, 0x1e, 0x1e, 0x33, 0x20, 0x20, 0x20, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const lv_img_dsc_t img_render_lvgl_logo_argb8888 = {
const lv_image_dsc_t img_render_lvgl_logo_argb8888 = {
.header.cf = LV_COLOR_FORMAT_ARGB8888,
.header.w = 30,
.header.h = 30,

View File

@@ -56,7 +56,7 @@ img_render_lvgl_logo_rgb565_map[] = {
0xff, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x5d, 0xff, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9e, 0xf7, 0x5d, 0xef, 0x5d, 0xef, 0x5d, 0xef, 0x5d, 0xef, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};
const lv_img_dsc_t img_render_lvgl_logo_rgb565 = {
const lv_image_dsc_t img_render_lvgl_logo_rgb565 = {
.header.cf = LV_COLOR_FORMAT_RGB565,
.header.w = 30,
.header.h = 30,

View File

@@ -195,7 +195,7 @@ img_render_lvgl_logo_rgb888_map[] = {
0xe7, 0xe6, 0xe6, 0xfb, 0xfa, 0xfa, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
};
const lv_img_dsc_t img_render_lvgl_logo_rgb888 = {
const lv_image_dsc_t img_render_lvgl_logo_rgb888 = {
.header.cf = LV_COLOR_FORMAT_RGB888,
.header.w = 30,
.header.h = 30,

View File

@@ -55,7 +55,7 @@ img_render_lvgl_logo_xrgb8888_map[] = {
0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe6, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe6, 0xf8, 0xff, 0xed, 0xed, 0xf9, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xe7, 0xe7, 0xf8, 0xff, 0xed, 0xed, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xee, 0xee, 0xef, 0xff, 0xe8, 0xe7, 0xe7, 0xff, 0xe8, 0xe7, 0xe7, 0xff, 0xe8, 0xe7, 0xe7, 0xff, 0xe8, 0xe7, 0xe7, 0xff, 0xe8, 0xe7, 0xe7, 0xff, 0xfc, 0xfb, 0xfb, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};
const lv_img_dsc_t img_render_lvgl_logo_xrgb8888 = {
const lv_image_dsc_t img_render_lvgl_logo_xrgb8888 = {
.header.cf = LV_COLOR_FORMAT_XRGB8888,
.header.w = 30,
.header.h = 30,

View File

@@ -331,10 +331,10 @@ static lv_obj_t * image_obj_create(lv_obj_t * parent, int32_t col, int32_t row,
static void image_core_cb(lv_obj_t * parent, bool recolor)
{
LV_IMG_DECLARE(img_render_lvgl_logo_xrgb8888);
LV_IMG_DECLARE(img_render_lvgl_logo_rgb888);
LV_IMG_DECLARE(img_render_lvgl_logo_rgb565);
LV_IMG_DECLARE(img_render_lvgl_logo_argb8888);
LV_IMAGE_DECLARE(img_render_lvgl_logo_xrgb8888);
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb888);
LV_IMAGE_DECLARE(img_render_lvgl_logo_rgb565);
LV_IMAGE_DECLARE(img_render_lvgl_logo_argb8888);
const void * srcs[] = {
&img_render_lvgl_logo_argb8888,
&img_render_lvgl_logo_xrgb8888,

View File

@@ -146,7 +146,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
obj = lv_button_create(main_page);
lv_obj_set_size(obj, 100, 70);
lv_obj_set_style_bg_image_src(obj, LV_SYMBOL_DUMMY"Text from\nstyle", 0);
lv_obj_delete_async(obj); /*Delete on next call of `lv_task_handler` (so not now)*/
lv_obj_delete_async(obj); /*Delete on next call of `lv_timer_handler` (so not now)*/
break;
case 5:
@@ -299,7 +299,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
obj = lv_table_create(main_page);
lv_table_set_cell_value(obj, 0, 0, "0,0");
lv_table_set_cell_value_fmt(obj, 3, 0, "%d,%d", 5, 0);
lv_table_set_row_cnt(obj, 5);
lv_table_set_row_count(obj, 5);
lv_table_set_cell_value_fmt(obj, 1, 0, "%s", "1,0");
lv_table_set_cell_value(obj, 1, 3, "1,3");
break;

View File

@@ -266,7 +266,7 @@ void lv_demo_vector_graphic(void)
lv_draw_buf_t * draw_buf = lv_draw_buf_create(WIDTH, HEIGHT, LV_COLOR_FORMAT_ARGB8888, LV_STRIDE_AUTO);
lv_draw_buf_clear(draw_buf, NULL);
lv_obj_t * canvas = lv_canvas_create(lv_scr_act());
lv_obj_t * canvas = lv_canvas_create(lv_screen_active());
lv_canvas_set_draw_buf(canvas, draw_buf);
lv_obj_add_event_cb(canvas, delete_event_cb, LV_EVENT_DELETE, NULL);

View File

@@ -841,7 +841,7 @@ static void analytics_create(lv_obj_t * parent)
lv_scale_section_set_style(section, LV_PART_INDICATOR, &scale3_section3_indicator_style);
lv_scale_section_set_style(section, LV_PART_ITEMS, &scale3_section3_tick_style);
LV_IMG_DECLARE(img_demo_widgets_needle);
LV_IMAGE_DECLARE(img_demo_widgets_needle);
lv_obj_t * needle = lv_image_create(scale3);
lv_image_set_src(needle, &img_demo_widgets_needle);
lv_image_set_pivot(needle, 3, 4);

View File

@@ -190,7 +190,7 @@ C code
.. code:: c
lv_obj_t * btn = lv_btn_create(lv_scr_act());                   /*Add a button to the current screen*/
lv_obj_t * btn = lv_button_create(lv_screen_active());                   /*Add a button to the current screen*/
lv_obj_center(btn);                                     /*Set its position*/
lv_obj_set_size(btn, 100, 50);                                  /*Set its size*/
lv_obj_add_event(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /*Assign a callback to the button*/
@@ -267,25 +267,25 @@ C code
.. code:: c
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
lv_obj_t * cb;
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Apple");
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Banana");
lv_obj_add_state(cb, LV_STATE_CHECKED);
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Lemon");
lv_obj_add_state(cb, LV_STATE_DISABLED);
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_checkbox_set_text(cb, "Melon\nand a new line");
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
@@ -372,7 +372,7 @@ C code
.. code:: c
lv_obj_t * slider = lv_slider_create(lv_scr_act());
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_slider_set_value(slider, 70, LV_ANIM_OFF);
lv_obj_set_size(slider, 300, 20);
lv_obj_center(slider);
@@ -486,20 +486,20 @@ C code
.. code:: c
lv_obj_t * ltr_label = lv_label_create(lv_scr_act());
lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
lv_obj_set_width(ltr_label, 310);
lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
lv_obj_t * rtl_label = lv_label_create(lv_scr_act());
lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_width(rtl_label, 310);
lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
lv_obj_t * cz_label = lv_label_create(lv_scr_act());
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
lv_label_set_text(cz_label,
"嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);

View File

@@ -239,7 +239,7 @@ Código C
.. code:: c
lv_obj_t * btn = lv_btn_create(lv_scr_act()); /* Adiciona o botão a tela atual */
lv_obj_t * btn = lv_button_create(lv_screen_active()); /* Adiciona o botão a tela atual */
lv_obj_center(btn); /* Define a posição do botão */
lv_obj_set_size(btn, 100, 50); /* Define o tamanho do botão */
lv_obj_add_event(btn, btn_event_cb, LV_EVENT_CLICKED, NULL); /* Atribui um retorno de chamada (callback) ao botão */
@@ -316,25 +316,25 @@ Código em C
.. code:: c
lv_obj_set_flex_flow(lv_scr_act(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(lv_scr_act(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_COLUMN);
lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER);
lv_obj_t * cb;
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Maça");
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Banana");
lv_obj_add_state(cb, LV_STATE_CHECKED);
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_checkbox_set_text(cb, "Limão");
lv_obj_add_state(cb, LV_STATE_DISABLED);
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
cb = lv_checkbox_create(lv_scr_act());
cb = lv_checkbox_create(lv_screen_active());
lv_obj_add_state(cb, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_checkbox_set_text(cb, "Melão\ne uma nova linha");
lv_obj_add_event(cb, event_handler, LV_EVENT_ALL, NULL);
@@ -421,7 +421,7 @@ Código C
.. code:: c
lv_obj_t * slider = lv_slider_create(lv_scr_act());
lv_obj_t * slider = lv_slider_create(lv_screen_active());
lv_slider_set_value(slider, 70, LV_ANIM_OFF);
lv_obj_set_size(slider, 300, 20);
lv_obj_center(slider);
@@ -535,20 +535,20 @@ Código C
.. code:: c
lv_obj_t * ltr_label = lv_label_create(lv_scr_act());
lv_obj_t * ltr_label = lv_label_create(lv_screen_active());
lv_label_set_text(ltr_label, "In modern terminology, a microcontroller is similar to a system on a chip (SoC).");
lv_obj_set_style_text_font(ltr_label, &lv_font_montserrat_16, 0);
lv_obj_set_width(ltr_label, 310);
lv_obj_align(ltr_label, LV_ALIGN_TOP_LEFT, 5, 5);
lv_obj_t * rtl_label = lv_label_create(lv_scr_act());
lv_obj_t * rtl_label = lv_label_create(lv_screen_active());
lv_label_set_text(rtl_label,"מעבד, או בשמו המלא יחידת עיבוד מרכזית (באנגלית: CPU - Central Processing Unit).");
lv_obj_set_style_base_dir(rtl_label, LV_BASE_DIR_RTL, 0);
lv_obj_set_style_text_font(rtl_label, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_width(rtl_label, 310);
lv_obj_align(rtl_label, LV_ALIGN_LEFT_MID, 5, 0);
lv_obj_t * cz_label = lv_label_create(lv_scr_act());
lv_obj_t * cz_label = lv_label_create(lv_screen_active());
lv_label_set_text(cz_label,
"嵌入式系统Embedded System\n是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。");
lv_obj_set_style_text_font(cz_label, &lv_font_simsun_16_cjk, 0);

View File

@@ -5,6 +5,7 @@ Chip vendors
.. toctree::
:maxdepth: 2
nxp
stm32
espressif
nxp
renesas
stm32

View File

@@ -0,0 +1,84 @@
=======
Renesas
=======
`Renesas <https://renesas.com/>`__ is an official partner of LVGL.
Therefore, LVGL contains built-in support for `Dave2D <https://lpccs-docs.renesas.com/DA1470x/UM-B-157_DA1470x-GPU-API-Manual/files/doc/overview-txt.html>`__ (the GPU of Renesas)
and LVGL also hosts ready-to-use Renesas projects.
Dave2D
------
Dave2D is capable of accelerating most of the drawing operations of LVGL:
- Rectangle drawing, even with gradients
- Image drawing, scaling, and rotation
- Letter drawing
- Triangle drawing
- Line drawing
As Dave2D works in the background, the CPU is free for other tasks. In practice, during rendering, Dave2D can reduce the CPU usage by half or to one-third, depending on the application.
Certified boards
----------------
LVGL has `certified <https://lvgl.io/certificate>`__ one Renesas board so far (more will come soon).
.. raw:: html
<iframe width="560" height="315" src="https://www.youtube.com/embed/LHPIqBV_MGA?si=mtW3g-av56bCdR4k" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
Get started with the Renesas ecosystem
--------------------------------------
The official IDE of Renesas is called `e² studio <https://www.renesas.com/us/en/software-tool/e-studio?gad_source=1&gclid=CjwKCAjw5ImwBhBtEiwAFHDZx2V3lumaenbyJnc5Ctrclr_lEQM3G22iZgB-4F92OVLCI7xmzp1YQRoCcRgQAvD_BwE>`__. As it's Eclipse-based, it runs on Windows, Linux, and Mac as well.
To get started, just download and install e² studio.
Getting started with LVGL
-------------------------
LVGL provides a ready-to-use project for the `EK-RA8D1 <https://www.renesas.com/us/en/products/microcontrollers-microprocessors/ra-cortex-m-mcus/ek-ra8d1-evaluation-kit-ra8d1-mcu-group>`__ development board. Its main features from the HMI's point of view are:
- 480MHz, Arm Cortex®-M85 core
- 2MB Code Flash, 1MB SRAM
- MIPI DSI & Parallel Graphics Expansion Ports
- 4.5 Inch backlit TFT display, 16.7M display colors
- 480x854 pixels resolution
To get a ready-to-use project, clone the [lv_renesas](https://github.com/lvgl/lv_renesas.git) repository:
.. code:: shell
git clone https://github.com/lvgl/lv_renesas.git --recurse-submodules
After that, *Import* ``lv_ek_ra8d1`` into e² studio, build the project, and flash it.
Note that on the ``SW1`` DIP switch (middle of the board) 7 should be ON, all others are OFF.
Modify the project
------------------
Open a demo
~~~~~~~~~~~
In `LVGL_thread_entry <https://github.com/lvgl/lv_renesas/blob/master/lv_ek_ra8d1/src/LVGL_thread_entry.c>`__, the demos are automatically enabled based on the settings in `lv_conf.h <https://github.com/lvgl/lv_renesas/blob/master/lv_ek_ra8d1/src/lv_conf.h>`__.
You can disable all demos (or just comment them out) and call some ``lv_example_...()`` functions, or add your custom code.
Configuration
~~~~~~~~~~~~~
``lv_conf.h`` contains the most important settings for LVGL. Namely:
- ``LV_COLOR_DEPTH`` to set LVGL's default color depth
- ``LV_MEM_SIZE to`` set the maximum RAM available for LVGL
- ``LV_USE_DAVE2D`` to enable the GPU
``configuration.xml`` contains the settings for the board and the MCU. By opening this file, all the hardware and software components can be customized in a visual way.
Support
-------
In case of an problems or questions open an issue in the `lv_renesas <https://github.com/lvgl/lv_renesas/issues>`__ repository.

View File

@@ -77,8 +77,8 @@ Usage
{
...
/* Periodically call the lv_task handler */
lv_task_handler();
/* Periodically call the lv_timer handler */
lv_timer_handler();
}
}
@@ -107,7 +107,7 @@ Usage
lv_display_add_event_cb(disp, on_close_cb, LV_EVENT_DELETE, disp);
/* initialize X11 input drivers (for keyboard, mouse & mousewheel) */
LV_IMG_DECLARE(my_mouse_cursor_icon);
LV_IMAGE_DECLARE(my_mouse_cursor_icon);
lv_x11_inputs_create(disp, &my_mouse_cursor_icon);
#if !LV_X11_DIRECT_EXIT
@@ -121,7 +121,7 @@ Usage
{
...
/* Periodically call the lv_task handler */
lv_task_handler();
/* Periodically call the lv_timer handler */
lv_timer_handler();
}
}

View File

@@ -239,7 +239,7 @@ Step-by-step instructions
/* DCX high (data) */
HAL_GPIO_WritePin(LCD_DCX_GPIO_Port, LCD_DCX_Pin, GPIO_PIN_SET);
/* for color data use DMA transfer */
/* Set the SPI in 16-bit mode to match endianess */
/* Set the SPI in 16-bit mode to match endianness */
hspi1.Init.DataSize = SPI_DATASIZE_16BIT;
HAL_SPI_Init(&hspi1);
lcd_bus_busy = 1;

View File

@@ -272,14 +272,11 @@ Set an object state if an integer subject's value is not equal to a reference va
observer = lv_obj_bind_state_if_not_eq(obj, &subject, LV_STATE_*, ref_value);
Button
------
Set an integer subject to 1 when a button is checked and set it 0 when unchecked.
Set an integer subject to 1 when an object is checked and set it 0 when unchecked.
.. code:: c
observer = lv_button_bind_checked(obj, &subject);
observer = lv_obj_bind_checked(obj, &subject);
Label
-----

View File

@@ -159,7 +159,7 @@ adjusted with :cpp:expr:`lv_obj_set_style_bg_color(obj, color)`;
The display background image is a path to a file or a pointer to an
:cpp:struct:`lv_image_dsc_t` variable (converted image data) to be used as
wallpaper. It can be set with :cpp:expr:`lv_obj_set_style_bg_img_src(obj, &my_img)`;
wallpaper. It can be set with :cpp:expr:`lv_obj_set_style_bg_image_src(obj, &my_img)`;
If a background image is configured the background won't be filled with
``bg_color``.

View File

@@ -244,6 +244,7 @@ open/close the PNG files. It should look like this:
lv_image_decoder_t * dec = lv_image_decoder_create();
lv_image_decoder_set_info_cb(dec, decoder_info);
lv_image_decoder_set_open_cb(dec, decoder_open);
lv_image_decoder_set_get_area_cb(dec, decoder_get_area);
lv_image_decoder_set_close_cb(dec, decoder_close);
@@ -280,7 +281,7 @@ open/close the PNG files. It should look like this:
/*Check whether the type `src` is known by the decoder*/
if(is_png(dsc->src) == false) return LV_RESULT_INVALID;
/*Decode and store the image. If `dsc->decoded` is `NULL`, the `read_line` function will be called to get the image data line-by-line*/
/*Decode and store the image. If `dsc->decoded` is `NULL`, the `decoder_get_area` function will be called to get the image data line-by-line*/
dsc->decoded = my_png_decoder(dsc->src);
/*Change the color format if decoded image format is different than original format. For PNG it's usually decoded to ARGB8888 format*/
@@ -296,13 +297,58 @@ open/close the PNG files. It should look like this:
* Decode an area of image
* @param decoder pointer to the decoder where this function belongs
* @param dsc image decoder descriptor
* @param full_area full image area information
* @param decoded_area area information to decode (x1, y1, x2, y2)
* @return LV_RESULT_OK: no error; LV_RESULT_INVALID: can't decode image area
* @param full_area input parameter. the full area to decode after enough subsequent calls
* @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding.
* the decoded area is stored here after each call.
* @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed or there is nothing left to decode
*/
static lv_result_t decoder_get_area(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc,
const lv_area_t * full_area, lv_area_t * decoded_area)
{
/**
* If `dsc->decoded` is always set in `decoder_open` then `decoder_get_area` does not need to be implemented.
* If `dsc->decoded` is only sometimes set or never set in `decoder_open` then `decoder_get_area` is used to
* incrementally decode the image by calling it repeatedly until it returns `LV_RESULT_INVALID`.
* In the example below the image is decoded line-by-line but the decoded area can have any shape and size
* depending on the requirements and capabilities of the image decoder.
*/
my_decoder_data_t * my_decoder_data = dsc->user_data;
/* if `decoded_area` has a field set to `LV_COORD_MIN` then reset decoding */
if(decoded_area->y1 == LV_COORD_MIN) {
decoded_area->x1 = full_area->x1;
decoded_area->x2 = full_area->x2;
decoded_area->y1 = full_area->y1;
decoded_area->y2 = decoded_area->y1; /* decode line-by-line, starting with the first line */
/* create a draw buf the size of one line */
bool reshape_success = NULL != lv_draw_buf_reshape(my_decoder_data->partial,
dsc->decoded.header.cf,
lv_area_get_width(full_area),
1,
LV_STRIDE_AUTO);
if(!reshape_success) {
lv_draw_buf_destroy(my_decoder_data->partial);
my_decoder_data->partial = lv_draw_buf_create(lv_area_get_width(full_area),
1,
dsc->decoded.header.cf,
LV_STRIDE_AUTO);
my_png_decode_line_reset(full_area);
}
}
/* otherwise decoding is already in progress. decode the next line */
else {
/* all lines have already been decoded. indicate completion by returning `LV_RESULT_INVALID` */
if (decoded_area->y1 >= full_area->y2) return LV_RESULT_INVALID;
decoded_area->y1++;
decoded_area->y2++;
}
my_png_decode_line(my_decoder_data->partial);
return LV_RESULT_OK;
}
/**
@@ -314,8 +360,12 @@ open/close the PNG files. It should look like this:
static void decoder_close(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc)
{
/*Free all allocated data*/
my_png_cleanup();
/*Call the built-in close function if the built-in open/read_line was used*/
my_decoder_data_t * my_decoder_data = dsc->user_data;
lv_draw_buf_destroy(my_decoder_data->partial);
/*Call the built-in close function if the built-in open/get_area was used*/
lv_bin_decoder_close(decoder, dsc);
}

View File

@@ -28,7 +28,7 @@ Pointer input devices (like a mouse) can have a cursor.
...
lv_indev_t * mouse_indev = lv_indev_create();
...
LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image source.*/
LV_IMAGE_DECLARE(mouse_cursor_icon); /*Declare the image source.*/
lv_obj_t * cursor_obj = lv_image_create(lv_screen_active()); /*Create an image object for the cursor */
lv_image_set_src(cursor_obj, &mouse_cursor_icon); /*Set the image source*/
lv_indev_set_cursor(mouse_indev, cursor_obj); /*Connect the image object to the driver*/

View File

@@ -154,7 +154,7 @@ the object and all of its children.
void lv_obj_delete(lv_obj_t * obj);
:cpp:func:`lv_obj_del` will delete the object immediately. If for any reason you
:cpp:func:`lv_obj_delete` will delete the object immediately. If for any reason you
can't delete the object immediately you can use
:cpp:expr:`lv_obj_delete_async(obj)` which will perform the deletion on the next
call of :cpp:func:`lv_timer_handler`. This is useful e.g. if you want to

View File

@@ -134,7 +134,7 @@ You will obtain a processed text file named `trace.systrace`, which roughly cont
# tracer: nop
#
LVGL-1 [0] 2892.002993: tracing_mark_write: B|1|lv_timer_handler
LVGL-1 [0] 2892.002993: tracing_mark_write: B|1|_lv_disp_refr_timer
LVGL-1 [0] 2892.002993: tracing_mark_write: B|1|_lv_display_refr_timer
LVGL-1 [0] 2892.003459: tracing_mark_write: B|1|refr_invalid_areas
LVGL-1 [0] 2892.003461: tracing_mark_write: B|1|lv_draw_rect
LVGL-1 [0] 2892.003550: tracing_mark_write: E|1|lv_draw_rect

View File

@@ -20,8 +20,9 @@ How to Use
**********
In general:
- you can set the macro :c:macro:`LV_USE_DRAW_ARM2D_SYNC` to ``1`` in
``lv_conf.h`` to enable Arm-2D synchronous acceleration for LVGL.
- you can set the macro :c:macro:`LV_USE_DRAW_ARM2D_SYNC` to ``1`` and
:c:macro:`LV_DRAW_SW_ASM` to ``LV_DRAW_SW_ASM_HELIUM`` in ``lv_conf.h`` to
enable Arm-2D synchronous acceleration for LVGL.
- You can set
the macro :c:macro:`LV_USE_DRAW_ARM2D_ASYNC` to ``1`` in ``lv_conf.h`` to enable
Arm-2D Asynchronous acceleration for LVGL.

View File

@@ -219,8 +219,8 @@ To get a property's value from a style:
.. code:: c
lv_style_value_t v;
lv_res_t res = lv_style_get_prop(&style, LV_STYLE_BG_COLOR, &v);
if(res == LV_RES_OK) { /*Found*/
lv_result_t res = lv_style_get_prop(&style, LV_STYLE_BG_COLOR, &v);
if(res == LV_RESULT_OK) { /*Found*/
do_something(v.color);
}

View File

@@ -31,7 +31,7 @@ Here is some pseudocode to illustrate the concept:
while(1) {
uint32_t time_till_next;
mutex_lock(&lvgl_mutex);
time_till_next = lv_task_handler();
time_till_next = lv_timer_handler();
mutex_unlock(&lvgl_mutex);
thread_sleep(time_till_next); /* sleep for a while */
}

View File

@@ -10,7 +10,7 @@ main ``while(1)`` should look like this:
while(1) {
/*Normal operation (no sleep) in < 1 sec inactivity*/
if(lv_display_get_inactive_time(NULL) < 1000) {
lv_task_handler();
lv_timer_handler();
}
/*Sleep after 1 sec inactivity*/
else {
@@ -27,7 +27,7 @@ function to signal a wake-up (press, touch or click etc.) has happened:
lv_tick_inc(LV_DEF_REFR_PERIOD); /*Force task execution on wake-up*/
timer_start(); /*Restart the timer where lv_tick_inc() is called*/
lv_task_handler(); /*Call `lv_task_handler()` manually to process the wake-up event*/
lv_timer_handler(); /*Call `lv_timer_handler()` manually to process the wake-up event*/
In addition to :cpp:func:`lv_display_get_inactive_time` you can check
:cpp:func:`lv_anim_count_running` to see if all animations have finished.

View File

@@ -12,7 +12,7 @@ There are two ways to provide the tick to LVGL:
1. Call ``lv_tick_set_cb(my_get_milliseconds_function);``: `my_get_milliseconds_function` needs to tell how many milliseconds have elapsed since start up. Most of the platforms have built-in functions that can be used as they are. For example
- SDL: ``lv_tick_set_cb(SDL_GetTicks);``
- Arduino: ``lv_tick_set_cb(millis);``
- Arduino: ``lv_tick_set_cb(my_tick_get_cb);``, where ``my_tick_get_cb`` is: ``static uint32_t my_tick_get_cb(void) { return millis(); }``
- FreeRTOS: ``lv_tick_set_cb(xTaskGetTickCount);``
- STM32: ``lv_tick_set_cb(HAL_GetTick);``
- ESP32: ``lv_tick_set_cb(my_tick_get_cb);``, where ``my_tick_get_cb`` is a wrapper for ``esp_timer_get_time() / 1000;``

View File

@@ -82,6 +82,21 @@ where ``years_list`` is a pointer to the custom years list. It can be a constant
like ``static const char * years = "2023\n2022\n2021\n2020\n2019";``,
or can be generated dynamically into a buffer as well.
Chinese calendar
----------------
The Chinese calendar is a traditional cultural tool that integrates elements
such as the lunar calendar, solar terms, and traditional festivals. It is
widely used in Chinese social life, helping people understand the dates of
the lunar calendar, arrange festival activities, and inherit the excellent
traditional culture of the Chinese nation. Whether in families, businesses,
or education, the Chinese calendar plays an irreplaceable role, enabling
people to better understand and appreciate the charm of Chinese traditional
culture.
If you want to use the Chinese calendar, please
use :cpp:expr:`lv_calendar_set_chinese_mode(calendar, true)` to enable it.
.. _lv_calendar_events:
Events
@@ -89,8 +104,8 @@ Events
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent if a date is clicked.
:cpp:expr:`lv_calendar_get_pressed_date(calendar, &date)` set ``date`` to the
date currently being pressed. Returns :cpp:enumerator:`LV_RES_OK` if there is a
valid pressed date, else :cpp:enumerator:`LV_RES_INVALID`.
date currently being pressed. Returns :cpp:enumerator:`LV_RESULT_OK` if there is a
valid pressed date, else :cpp:enumerator:`LV_RESULT_INVALID`.
Learn more about :ref:`events`.

View File

@@ -51,6 +51,8 @@ if(NOT LV_CONF_BUILD_DISABLE_THORVG_INTERNAL)
target_link_libraries(lvgl_thorvg PUBLIC lvgl)
endif()
set_source_files_properties(${LVGL_ROOT_DIR}/src/others/vg_lite_tvg/vg_lite_tvg.cpp PROPERTIES COMPILE_FLAGS -Wunused-parameter)
# Build LVGL example library
if(NOT LV_CONF_BUILD_DISABLE_EXAMPLES)
add_library(lvgl_examples ${EXAMPLE_SOURCES})

View File

@@ -36,6 +36,9 @@
<repository type="git">https://github.com/lvgl/lvgl.git</repository>
<releases>
<release date="2024-03-24" version="9.1.1-dev1" url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/LVGL.lvgl.9.1.1-dev1.pack">
- LVGL 9.1.1-dev
</release>
<release date="2024-03-19" version="9.1.0" url="https://github.com/lvgl/lvgl/raw/v9.1.0/env_support/cmsis-pack/LVGL.lvgl.9.1.0.pack">
- LVGL 9.1.0
- See Change Log
@@ -1295,6 +1298,21 @@
</component>
<component Cgroup="Libraries and Others" Csub="Lib Filesystem" Cvariant="Arduino LittleFs" condition="LVGL-Essential">
<description>Add API for file access via Arduino LittleFs</description>
<files>
<!-- src/libs/fsdrv -->
<file category="sourceCpp" name="src/libs/fsdrv/lv_fs_arduino_esp_littlefs.cpp" />
</files>
<RTE_Components_h>
/*! \brief enable Arduino LittleFs file access */
#define LV_USE_FS_ARDUINO_ESP_LITTLEFS 1
</RTE_Components_h>
</component>
<!--
<component Cgroup="Libraries and Others" Csub="Lib Filesystem" Cvariant="WIN32" condition="LVGL-Essential">
<description>Add API for file access via STDIO</description>

View File

@@ -2,8 +2,8 @@
<index schemaVersion="1.0.0" xs:noNamespaceSchemaLocation="PackIndex.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<vendor>LVGL</vendor>
<url>https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/</url>
<timestamp>2024-03-19</timestamp>
<timestamp>2024-03-24</timestamp>
<pindex>
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="9.1.0"/>
<pdsc url="https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/" vendor="LVGL" name="lvgl" version="9.1.1-dev1"/>
</pindex>
</index>

View File

@@ -126,6 +126,7 @@ Make sure `LV_MEM_SIZE` is no less than `(128*1024U)`.
- \#define LV_USE_FS_WIN32 0
- \#define LV_USE_FS_FATFS 0
- #define LV_USE_FS_LITTLEFS 0
- #define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0
- #define LV_USE_FS_MEMFS 0
- \#define LV_USE_LODEPNG 0
- #define LV_USE_LIBPNG 0

View File

@@ -1,6 +1,6 @@
/**
* @file lv_conf.h
* Configuration file for v9.1.0
* Configuration file for v9.1.1-dev
*/
/* clang-format off */
@@ -148,6 +148,9 @@
#endif
#endif
/* Set stack size of drawing thread. Unit is byte. If Thorvg is enabled, 128kB is required tested on simulator.*/
#define LV_DRAW_THREAD_STACKSIZE 32768
#if LV_USE_DRAW_VGLITE
/* Enable blit quality degradation workaround recommended for screen's dimension > 352 pixels. */
#define LV_USE_VGLITE_BLIT_SPLIT 0
@@ -187,7 +190,7 @@
/* VG-Lite linear gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_LINEAER_GRAD_CACHE_CNT 32
#define LV_VG_LITE_LINEAR_GRAD_CACHE_CNT 32
/* VG-Lite radial gradient image maximum cache size.
* NOTE: The memory usage of a single gradient image is radial grad radius * 4 bytes.
@@ -648,6 +651,11 @@
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*API for Arduino LittleFs. */
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
#define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
/*GIF decoder library*/
#if LV_USE_GIF
/*GIF decoder accelerate*/

View File

@@ -65,7 +65,7 @@ static void lvgl_thread_entry(void *parameter)
/* handle the tasks of LVGL */
while(1)
{
lv_task_handler();
lv_timer_handler();
rt_thread_mdelay(PKG_LVGL_DISP_REFR_PERIOD);
}
}

View File

@@ -1,5 +1,5 @@
/*Using LVGL with Arduino requires some extra steps:
*Be sure to read the docs here: https://docs.lvgl.io/master/get-started/platforms/arduino.html */
*Be sure to read the docs here: https://docs.lvgl.io/master/integration/framework/arduino.html */
#include <lvgl.h>
@@ -15,9 +15,10 @@
//#include <examples/lv_examples.h>
//#include <demos/lv_demos.h>
/*Set to your screen resolution*/
/*Set to your screen resolution and rotation*/
#define TFT_HOR_RES 320
#define TFT_VER_RES 240
#define TFT_ROTATION LV_DISPLAY_ROTATION_0
/*LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes*/
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))
@@ -46,7 +47,7 @@ void my_disp_flush( lv_display_t *disp, const lv_area_t *area, uint8_t * px_map)
*/
/*Call it to tell LVGL you are ready*/
lv_disp_flush_ready(disp);
lv_display_flush_ready(disp);
}
/*Read the touchpad*/
@@ -67,6 +68,12 @@ void my_touchpad_read( lv_indev_t * indev, lv_indev_data_t * data )
*/
}
/*use Arduinos millis() as tick source*/
static uint32_t my_tick(void)
{
return millis();
}
void setup()
{
String LVGL_Arduino = "Hello Arduino! ";
@@ -78,7 +85,7 @@ void setup()
lv_init();
/*Set a tick source so that LVGL will know how much time elapsed. */
lv_tick_set_cb(millis);
lv_tick_set_cb(my_tick);
/* register print function for debugging */
#if LV_USE_LOG != 0
@@ -89,6 +96,8 @@ void setup()
#if LV_USE_TFT_ESPI
/*TFT_eSPI can be enabled lv_conf.h to initialize the display in a simple way*/
disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, sizeof(draw_buf));
lv_display_set_rotation(disp, TFT_ROTATION);
#else
/*Else create a display yourself*/
disp = lv_display_create(TFT_HOR_RES, TFT_VER_RES);
@@ -103,7 +112,7 @@ void setup()
/* Create a simple label
* ---------------------
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_obj_t *label = lv_label_create( lv_screen_active() );
lv_label_set_text( label, "Hello Arduino, I'm LVGL!" );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
@@ -120,7 +129,7 @@ void setup()
lv_demo_widgets();
*/
lv_obj_t *label = lv_label_create( lv_scr_act() );
lv_obj_t *label = lv_label_create( lv_screen_active() );
lv_label_set_text( label, "Hello Arduino, I'm LVGL!" );
lv_obj_align( label, LV_ALIGN_CENTER, 0, 0 );
@@ -129,6 +138,6 @@ void setup()
void loop()
{
lv_task_handler(); /* let the GUI do its work */
lv_timer_handler(); /* let the GUI do its work */
delay(5); /* let this time pass */
}

View File

@@ -19,7 +19,6 @@ void lv_example_barcode_1(void)
/*Add a border with bg_color*/
lv_obj_set_style_border_color(barcode, bg_color, 0);
lv_obj_set_style_border_width(barcode, 5, 0);
/*Set data*/
lv_barcode_update(barcode, "https://lvgl.io");

View File

@@ -14,18 +14,7 @@ static void file_explorer_event_handler(lv_event_t * e)
if(code == LV_EVENT_VALUE_CHANGED) {
const char * cur_path = lv_file_explorer_get_current_path(obj);
const char * sel_fn = lv_file_explorer_get_selected_file_name(obj);
uint16_t path_len = strlen(cur_path);
uint16_t fn_len = strlen(sel_fn);
if((path_len + fn_len) <= LV_FILE_EXPLORER_PATH_MAX_LEN) {
char file_info[LV_FILE_EXPLORER_PATH_MAX_LEN];
strcpy(file_info, cur_path);
strcat(file_info, sel_fn);
LV_LOG_USER("%s", file_info);
}
else LV_LOG_USER("%s%s", cur_path, sel_fn);
LV_LOG_USER("%s%s", cur_path, sel_fn);
}
}

View File

@@ -14,18 +14,8 @@ static void file_explorer_event_handler(lv_event_t * e)
if(code == LV_EVENT_VALUE_CHANGED) {
const char * cur_path = lv_file_explorer_get_current_path(obj);
const char * sel_fn = lv_file_explorer_get_selected_file_name(obj);
uint16_t path_len = strlen(cur_path);
uint16_t fn_len = strlen(sel_fn);
if((path_len + fn_len) <= LV_FILE_EXPLORER_PATH_MAX_LEN) {
char file_info[LV_FILE_EXPLORER_PATH_MAX_LEN];
strcpy(file_info, cur_path);
strcat(file_info, sel_fn);
LV_LOG_USER("%s", file_info);
}
else LV_LOG_USER("%s%s", cur_path, sel_fn);
LV_LOG_USER("%s%s", cur_path, sel_fn);
}
}

View File

@@ -50,18 +50,8 @@ static void file_explorer_event_handler(lv_event_t * e)
if(code == LV_EVENT_VALUE_CHANGED) {
const char * cur_path = lv_file_explorer_get_current_path(obj);
const char * sel_fn = lv_file_explorer_get_selected_file_name(obj);
uint16_t path_len = strlen(cur_path);
uint16_t fn_len = strlen(sel_fn);
if((path_len + fn_len) <= LV_FILE_EXPLORER_PATH_MAX_LEN) {
char file_info[LV_FILE_EXPLORER_PATH_MAX_LEN];
strcpy(file_info, cur_path);
strcat(file_info, sel_fn);
LV_LOG_USER("%s", file_info);
}
else LV_LOG_USER("%s%s", cur_path, sel_fn);
LV_LOG_USER("%s%s", cur_path, sel_fn);
}
else if(code == LV_EVENT_READY) {
lv_obj_t * tb = lv_file_explorer_get_file_table(obj);

View File

@@ -33,7 +33,7 @@ void lv_example_observer_5(void)
lv_subject_add_observer(&fw_update_status_subject, fw_upload_manager_observer_cb, NULL);
/*Create start FW update button*/
lv_obj_t * btn = lv_btn_create(lv_screen_active());
lv_obj_t * btn = lv_button_create(lv_screen_active());
lv_obj_add_event_cb(btn, fw_update_btn_clicked_event_cb, LV_EVENT_CLICKED, NULL);
lv_obj_center(btn);
lv_obj_t * label = lv_label_create(btn);

View File

@@ -175,7 +175,7 @@ static lv_obj_t * my_button_create(lv_obj_t * parent, const char * text, lv_even
lv_subject_add_observer_with_target(&theme_subject, my_button_style_observer_cb, &styles, NULL);
}
lv_obj_t * btn = lv_btn_create(parent);
lv_obj_t * btn = lv_button_create(parent);
lv_obj_remove_style_all(btn);
lv_obj_add_style(btn, &styles.style_main, 0);
lv_obj_add_style(btn, &styles.style_pressed, LV_STATE_PRESSED);

View File

@@ -186,10 +186,10 @@ static void touchpad_read(lv_indev_t * indev_drv, lv_indev_data_t * data)
/*Save the pressed coordinates and the state*/
if(touchpad_is_pressed()) {
touchpad_get_xy(&last_x, &last_y);
data->state = LV_INDEV_STATE_PR;
data->state = LV_INDEV_STATE_PRESSED;
}
else {
data->state = LV_INDEV_STATE_REL;
data->state = LV_INDEV_STATE_RELEASED;
}
/*Set the last pressed coordinates*/
@@ -232,10 +232,10 @@ static void mouse_read(lv_indev_t * indev_drv, lv_indev_data_t * data)
/*Get whether the mouse button is pressed or released*/
if(mouse_is_pressed()) {
data->state = LV_INDEV_STATE_PR;
data->state = LV_INDEV_STATE_PRESSED;
}
else {
data->state = LV_INDEV_STATE_REL;
data->state = LV_INDEV_STATE_RELEASED;
}
}
@@ -277,7 +277,7 @@ static void keypad_read(lv_indev_t * indev_drv, lv_indev_data_t * data)
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
data->state = LV_INDEV_STATE_PRESSED;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
@@ -301,7 +301,7 @@ static void keypad_read(lv_indev_t * indev_drv, lv_indev_data_t * data)
last_key = act_key;
}
else {
data->state = LV_INDEV_STATE_REL;
data->state = LV_INDEV_STATE_RELEASED;
}
data->key = last_key;
@@ -339,7 +339,7 @@ static void encoder_handler(void)
/*Your code comes here*/
encoder_diff += 0;
encoder_state = LV_INDEV_STATE_REL;
encoder_state = LV_INDEV_STATE_RELEASED;
}
/*------------------
@@ -362,11 +362,11 @@ static void button_read(lv_indev_t * indev_drv, lv_indev_data_t * data)
int8_t btn_act = button_get_pressed_id();
if(btn_act >= 0) {
data->state = LV_INDEV_STATE_PR;
data->state = LV_INDEV_STATE_PRESSED;
last_btn = btn_act;
}
else {
data->state = LV_INDEV_STATE_REL;
data->state = LV_INDEV_STATE_RELEASED;
}
/*Save the last pressed button's ID*/

View File

@@ -167,7 +167,7 @@ static void lcd_send_color(lv_display_t * disp, const uint8_t * cmd, size_t cmd_
/* DCX high (data) */
HAL_GPIO_WritePin(LCD_DCX_GPIO_Port, LCD_DCX_Pin, GPIO_PIN_SET);
/* for color data use DMA transfer */
/* Set the SPI in 16-bit mode to match endianess */
/* Set the SPI in 16-bit mode to match endianness */
hspi1.Init.DataSize = SPI_DATASIZE_16BIT;
HAL_SPI_Init(&hspi1);
lcd_bus_busy = 1;

View File

@@ -5,3 +5,8 @@ Calendar with header
.. lv_example:: widgets/calendar/lv_example_calendar_1
:language: c
Chinese calendar
-------------------------------------
.. lv_example:: widgets/calendar/lv_example_calendar_2
:language: c

View File

@@ -0,0 +1,32 @@
#include "../../lv_examples.h"
#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE && LV_BUILD_EXAMPLES
void lv_example_calendar_2(void)
{
lv_obj_t * calendar = lv_calendar_create(lv_screen_active());
lv_obj_set_size(calendar, 300, 300);
lv_obj_align(calendar, LV_ALIGN_TOP_MID, 0, 0);
lv_calendar_set_today_date(calendar, 2024, 03, 22);
lv_calendar_set_showed_date(calendar, 2024, 03);
#if LV_USE_CALENDAR_HEADER_DROPDOWN
lv_calendar_header_dropdown_create(calendar);
#elif LV_USE_CALENDAR_HEADER_ARROW
lv_calendar_header_arrow_create(calendar);
#endif
lv_calendar_set_chinese_mode(calendar, true);
lv_obj_set_style_text_font(calendar, &lv_font_simsun_14_cjk, LV_PART_MAIN);
}
#else
void lv_example_calendar_2(void)
{
lv_obj_t * label = lv_label_create(lv_screen_active());
lv_label_set_text(label, "chinese calendar is not enabled");
lv_obj_center(label);
}
#endif

View File

@@ -47,6 +47,7 @@ void lv_example_buttonmatrix_2(void);
void lv_example_buttonmatrix_3(void);
void lv_example_calendar_1(void);
void lv_example_calendar_2(void);
void lv_example_canvas_1(void);
void lv_example_canvas_2(void);
@@ -116,6 +117,7 @@ void lv_example_scale_2(void);
void lv_example_scale_3(void);
void lv_example_scale_4(void);
void lv_example_scale_5(void);
void lv_example_scale_6(void);
void lv_example_slider_1(void);
void lv_example_slider_2(void);

View File

@@ -28,3 +28,9 @@ An scale with section and custom styling
.. lv_example:: widgets/scale/lv_example_scale_5
:language: c
A round scale with multiple needles, resembling a clock
"""""""""""""""""""""""""""""""""""""""""""""""""""""""
.. lv_example:: widgets/scale/lv_example_scale_6
:language: c

View File

@@ -81,7 +81,7 @@ void lv_example_scale_3(void)
lv_scale_set_rotation(scale_img, 135);
/* image must point to the right. E.g. -O------>*/
needle_img = lv_img_create(scale_img);
needle_img = lv_image_create(scale_img);
lv_image_set_src(needle_img, &img_hand);
lv_obj_align(needle_img, LV_ALIGN_CENTER, 47, -2);
lv_image_set_pivot(needle_img, 3, 4);

View File

@@ -0,0 +1,126 @@
#include "../../lv_examples.h"
#if LV_USE_SCALE && LV_BUILD_EXAMPLES
#if LV_USE_FLOAT
#define my_PRIprecise "f"
#else
#define my_PRIprecise LV_PRId32
#endif
static lv_obj_t * scale;
static lv_obj_t * minute_hand;
static lv_obj_t * hour_hand;
static lv_point_precise_t minute_hand_points[2];
static int32_t hour;
static int32_t minute;
static void timer_cb(lv_timer_t * timer)
{
LV_UNUSED(timer);
minute++;
if(minute > 59) {
minute = 0;
hour++;
if(hour > 11) {
hour = 0;
}
}
/**
* the scale will store the needle line points in the existing
* point array if one was set with `lv_line_set_points_mutable`.
* Otherwise, it will allocate the needle line points.
*/
/* the scale will store the minute hand line points in `minute_hand_points` */
lv_scale_set_line_needle_value(scale, minute_hand, 60, minute);
/* log the points that were stored in the array */
LV_LOG_USER(
"minute hand points - "
"0: (%" my_PRIprecise ", %" my_PRIprecise "), "
"1: (%" my_PRIprecise ", %" my_PRIprecise ")",
minute_hand_points[0].x, minute_hand_points[0].y,
minute_hand_points[1].x, minute_hand_points[1].y
);
/* the scale will allocate the hour hand line points */
lv_scale_set_line_needle_value(scale, hour_hand, 40, hour * 5 + (minute / 12));
}
/**
* A round scale with multiple needles, resembing a clock
*/
void lv_example_scale_6(void)
{
scale = lv_scale_create(lv_screen_active());
lv_obj_set_size(scale, 150, 150);
lv_scale_set_mode(scale, LV_SCALE_MODE_ROUND_INNER);
lv_obj_set_style_bg_opa(scale, LV_OPA_60, 0);
lv_obj_set_style_bg_color(scale, lv_color_black(), 0);
lv_obj_set_style_radius(scale, LV_RADIUS_CIRCLE, 0);
lv_obj_set_style_clip_corner(scale, true, 0);
lv_obj_center(scale);
lv_scale_set_label_show(scale, true);
lv_scale_set_total_tick_count(scale, 61);
lv_scale_set_major_tick_every(scale, 5);
static const char * hour_ticks[] = {"12", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", NULL};
lv_scale_set_text_src(scale, hour_ticks);
static lv_style_t indicator_style;
lv_style_init(&indicator_style);
/* Label style properties */
lv_style_set_text_font(&indicator_style, LV_FONT_DEFAULT);
lv_style_set_text_color(&indicator_style, lv_palette_main(LV_PALETTE_YELLOW));
/* Major tick properties */
lv_style_set_line_color(&indicator_style, lv_palette_main(LV_PALETTE_YELLOW));
lv_style_set_length(&indicator_style, 8); /* tick length */
lv_style_set_line_width(&indicator_style, 2); /* tick width */
lv_obj_add_style(scale, &indicator_style, LV_PART_INDICATOR);
/* Minor tick properties */
static lv_style_t minor_ticks_style;
lv_style_init(&minor_ticks_style);
lv_style_set_line_color(&minor_ticks_style, lv_palette_main(LV_PALETTE_YELLOW));
lv_style_set_length(&minor_ticks_style, 6); /* tick length */
lv_style_set_line_width(&minor_ticks_style, 2); /* tick width */
lv_obj_add_style(scale, &minor_ticks_style, LV_PART_ITEMS);
/* Main line properties */
static lv_style_t main_line_style;
lv_style_init(&main_line_style);
lv_style_set_arc_color(&main_line_style, lv_color_black());
lv_style_set_arc_width(&main_line_style, 5);
lv_obj_add_style(scale, &main_line_style, LV_PART_MAIN);
lv_scale_set_range(scale, 0, 60);
lv_scale_set_angle_range(scale, 360);
lv_scale_set_rotation(scale, 270);
minute_hand = lv_line_create(scale);
lv_line_set_points_mutable(minute_hand, minute_hand_points, 2);
lv_obj_set_style_line_width(minute_hand, 3, 0);
lv_obj_set_style_line_rounded(minute_hand, true, 0);
lv_obj_set_style_line_color(minute_hand, lv_color_white(), 0);
hour_hand = lv_line_create(scale);
lv_obj_set_style_line_width(hour_hand, 5, 0);
lv_obj_set_style_line_rounded(hour_hand, true, 0);
lv_obj_set_style_line_color(hour_hand, lv_palette_main(LV_PALETTE_RED), 0);
hour = 11;
minute = 5;
lv_timer_t * timer = lv_timer_create(timer_cb, 250, NULL);
lv_timer_ready(timer);
}
#endif

View File

@@ -1,6 +1,6 @@
/**
* @file lv_conf.h
* Configuration file for v9.1.0
* Configuration file for v9.1.1-dev
*/
/*
@@ -113,6 +113,11 @@
/*The target buffer size for simple layer chunks.*/
#define LV_DRAW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/
/* The stack size of the drawing thread.
* NOTE: If FreeType or ThorVG is enabled, it is recommended to set it to 32KB or more.
*/
#define LV_DRAW_THREAD_STACK_SIZE (8 * 1024) /*[bytes]*/
#define LV_USE_DRAW_SW 1
#if LV_USE_DRAW_SW == 1
/* Set the number of draw unit.
@@ -201,7 +206,7 @@
/* VG-Lite linear gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_LINEAER_GRAD_CACHE_CNT 32
#define LV_VG_LITE_LINEAR_GRAD_CACHE_CNT 32
/* VG-Lite radial gradient image maximum cache size.
* NOTE: The memory usage of a single gradient image is radial grad radius * 4 bytes.
@@ -423,6 +428,7 @@
/*Demonstrate special features*/
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Persian letters and all their forms*/
#define LV_FONT_SIMSUN_14_CJK 0 /*1000 most common CJK radicals*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace fonts*/
@@ -521,6 +527,7 @@
#define LV_CALENDAR_DEFAULT_MONTH_NAMES {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}
#define LV_USE_CALENDAR_HEADER_ARROW 1
#define LV_USE_CALENDAR_HEADER_DROPDOWN 1
#define LV_USE_CALENDAR_CHINESE 0
#endif /*LV_USE_CALENDAR*/
#define LV_USE_CANVAS 1

4
lvgl.h
View File

@@ -15,8 +15,8 @@ extern "C" {
***************************/
#define LVGL_VERSION_MAJOR 9
#define LVGL_VERSION_MINOR 1
#define LVGL_VERSION_PATCH 0
#define LVGL_VERSION_INFO ""
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO "dev"
/*********************
* INCLUDES

View File

@@ -74,8 +74,11 @@ os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28_compressed.
print("\nGenerating 16 px Hebrew, Persian")
os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF")
print("\nGenerating 14 px CJK")
os.system(u"./built_in_font_gen.py --size 14 -o lv_font_simsun_14_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 盗提陽帯鼻画輕ッ冊ェル写父ぁフ結想正四O夫源庭場天續鳥れ講猿苦階給了製守8祝己妳薄泣塩帰ぺ吃変輪那着仍嗯爭熱創味保字宿捨準查達肯ァ薬得査障該降察ね網加昼料等図邪秋コ態品屬久原殊候路願楽確針上被怕悲風份重歡っ附ぷ既4黨價娘朝凍僅際洋止右航よ专角應酸師個比則響健昇豐筆歷適修據細忙跟管長令家ザ期般花越ミ域泳通些油乏ラ。營ス返調農叫樹刊愛間包知把ヤ貧橋拡普聞前ジ建当繰ネ送習渇用補ィ覺體法遊宙ョ酔余利壊語くつ払皆時辺追奇そ們只胸械勝住全沈力光ん深溝二類北面社值試9和五勵ゃ貿幾逐打課ゲて領3鼓辦発評渉詳暇込计駄供嘛郵頃腦反構絵お容規借身妻国慮剛急乗静必議置克土オ乎荷更肉還混古渡授合主離條値決季晴東大尚央州が嗎験流先医亦林田星晩拿60旅婦量為痛テ孫う環友況玩務其ぼち揺坐一肩腰犯タょ希即果ぶ物練待み高九找やヶ都グ去」サ、气仮雑酒許終企笑録形リ銀切ギ快問滿役単黄集森毎實研喜蘇司鉛洲川条媽才兩話言雖媒出客づ卻現異故り誌逮同訊已視本題ぞを横開音第席費持眾怎選元退限ー賽処喝就残無いガ多ケ沒義遠歌隣錢某雪析嬉採自透き側員予ゼ白婚电へ顯呀始均畫似懸格車騒度わ親店週維億締慣免帳電甚來園浴ゅ愈京と杯各海怒ぜ排敗挙老買7極模実紀ヒ携隻告シ並屋這孩讓質ワブ富賃争康由辞マ火於短樣削弟材注節另室ダ招擁ぃ若套底波行勤關著泊背疲狭作念推ぐ民貸祖介說ビ代温契你我レ入描變再札ソ派頭智遅私聽舉灣山伸放直安ト誕煙付符幅ふ絡她届耳飲忘参革團仕様載ど歩獲嫌息の汚交興魚指資雙與館初学年幸史位柱族走括び考青也共腕Lで販擔理病イ今逃當寺猫邊菓係ム秘示解池影ド文例斷曾事茶寫明科桃藝売便え導禁財飛替而亡到し具空寝辛業ウ府セ國何基菜厳市努張缺雲根外だ断万砂ゴ超使台实ぽ礼最慧算軟界段律像夕丈窓助刻月夏政呼ぴざ擇趣除動従涼方勉名線対存請子氏將5少否諸論美感或西者定食御表は參歳緑命進易性錯房も捕皿判中觀戦ニ緩町ピ番ず金千ろ?不た象治関ャ每看徒卒統じ手範訪押座步号ベ旁以母すほ密減成往歲件緒読歯效院种七謂凝濃嵌震喉繼クュ拭死円2積水欲如ポにさ寒道區精啦姐ア聯能足及停思壓春且メ裏株官答概黒過氷柿戻厚ぱ党祭織引計け委暗複誘港バ失下村較続神ぇ尤強秀膝兒来績十書済化服破新廠1紹您情半式產系好教暑早め樂地休協良な哪常要揮周かエ麗境働避護ンツ香夜太見設非改広聲他検求危清彼經未在起葉控靴所差內造寄南望尺換向展備眠點完約ぎ裡分説申童優伝島机須塊日立拉,鉄軽單気信很転識支布数紙此迎受心輸坊モ處「訳三曇兄野顔戰增ナ伊列又髪両有取左毛至困吧昔赤狀相夠整別士経頼然簡ホ会發隨営需脱ヨば接永居冬迫圍甘醫誰部充消連弱宇會咲覚姉麼的増首统帶糖朋術商担移景功育庫曲總劃牛程駅犬報ロ學責因パ嚴八世後平負公げ曜陸專午之閉ぬ談ご災昨冷職悪謝對它近射敢意運船臉局難什産頗!球真記ま但蔵究制機案湖臺ひ害券男留内木驗雨施種特復句末濟キ色訴依せ百型る石牠討呢时任執飯歐宅組傳配小活ゆべ暖ズ漸站素らボ束価チ浅回女片独妹英目從認生違策僕楚ペ米こ掛む爸六状落漢プ投カ校做啊洗声探あ割体項履触々訓技ハ低工映是標速善点人デ口次可廿节宵植树端阳旦腊妇费愚劳动儿军师庆圣诞闰".encode('utf-8'))
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 盗提陽帯鼻画輕ッ冊ェル写父ぁフ結想正四O夫源庭場天續鳥れ講猿苦階給了製守8祝己妳薄泣塩帰ぺ吃変輪那着仍嗯爭熱創味保字宿捨準查達肯ァ薬得査障該降察ね網加昼料等図邪秋コ態品屬久原殊候路願楽確針上被怕悲風份重歡っ附ぷ既4黨價娘朝凍僅際洋止右航よ专角應酸師個比則響健昇豐筆歷適修據細忙跟管長令家ザ期般花越ミ域泳通些油乏ラ。營ス返調農叫樹刊愛間包知把ヤ貧橋拡普聞前ジ建当繰ネ送習渇用補ィ覺體法遊宙ョ酔余利壊語くつ払皆時辺追奇そ們只胸械勝住全沈力光ん深溝二類北面社值試9和五勵ゃ貿幾逐打課ゲて領3鼓辦発評渉詳暇込计駄供嘛郵頃腦反構絵お容規借身妻国慮剛急乗静必議置克土オ乎荷更肉還混古渡授合主離條値決季晴東大尚央州が嗎験流先医亦林田星晩拿60旅婦量為痛テ孫う環友況玩務其ぼち揺坐一肩腰犯タょ希即果ぶ物練待み高九找やヶ都グ去」サ、气仮雑酒許終企笑録形リ銀切ギ快問滿役単黄集森毎實研喜蘇司鉛洲川条媽才兩話言雖媒出客づ卻現異故り誌逮同訊已視本題ぞを横開音第席費持眾怎選元退限ー賽処喝就残無いガ多ケ沒義遠歌隣錢某雪析嬉採自透き側員予ゼ白婚电へ顯呀始均畫似懸格車騒度わ親店週維億締慣免帳電甚來園浴ゅ愈京と杯各海怒ぜ排敗挙老買7極模実紀ヒ携隻告シ並屋這孩讓質ワブ富賃争康由辞マ火於短樣削弟材注節另室ダ招擁ぃ若套底波行勤關著泊背疲狭作念推ぐ民貸祖介說ビ代温契你我レ入描變再札ソ派頭智遅私聽舉灣山伸放直安ト誕煙付符幅ふ絡她届耳飲忘参革團仕様載ど歩獲嫌息の汚交興魚指資雙與館初学年幸史位柱族走括び考青也共腕Lで販擔理病イ今逃當寺猫邊菓係ム秘示解池影ド文例斷曾事茶寫明科桃藝売便え導禁財飛替而亡到し具空寝辛業ウ府セ國何基菜厳市努張缺雲根外だ断万砂ゴ超使台实ぽ礼最慧算軟界段律像夕丈窓助刻月夏政呼ぴざ擇趣除動従涼方勉名線対存請子氏將5少否諸論美感或西者定食御表は參歳緑命進易性錯房も捕皿判中觀戦ニ緩町ピ番ず金千ろ?不た象治関ャ每看徒卒統じ手範訪押座步号ベ旁以母すほ密減成往歲件緒読歯效院种七謂凝濃嵌震喉繼クュ拭死円2積水欲如ポにさ寒道區精啦姐ア聯能足及停思壓春且メ裏株官答概黒過氷柿戻厚ぱ党祭織引計け委暗複誘港バ失下村較続神ぇ尤強秀膝兒来績十書済化服破新廠1紹您情半式產系好教暑早め樂地休協良な哪常要揮周かエ麗境働避護ンツ香夜太見設非改広聲他検求危清彼經未在起葉控靴所差內造寄南望尺換向展備眠點完約ぎ裡分説申童優伝島机須塊日立拉,鉄軽單気信很転識支布数紙此迎受心輸坊モ處「訳三曇兄野顔戰增ナ伊列又髪両有取左毛至困吧昔赤狀相夠整別士経頼然簡ホ会發隨営需脱ヨば接永居冬迫圍甘醫誰部充消連弱宇會咲覚姉麼的増首统帶糖朋術商担移景功育庫曲總劃牛程駅犬報ロ學責因パ嚴八世後平負公げ曜陸專午之閉ぬ談ご災昨冷職悪謝對它近射敢意運船臉局難什産頗!球真記ま但蔵究制機案湖臺ひ害券男留内木驗雨施種特復句末濟キ色訴依せ百型る石牠討呢时任執飯歐宅組傳配小活ゆべ暖ズ漸站素らボ束価チ浅回女片独妹英目從認生違策僕楚ペ米こ掛む爸六状落漢プ投カ校做啊洗声探あ割体項履触々訓技ハ低工映是標速善点人デ口次可".encode('utf-8'))
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 盗提陽帯鼻画輕ッ冊ェル写父ぁフ結想正四O夫源庭場天續鳥れ講猿苦階給了製守8祝己妳薄泣塩帰ぺ吃変輪那着仍嗯爭熱創味保字宿捨準查達肯ァ薬得査障該降察ね網加昼料等図邪秋コ態品屬久原殊候路願楽確針上被怕悲風份重歡っ附ぷ既4黨價娘朝凍僅際洋止右航よ专角應酸師個比則響健昇豐筆歷適修據細忙跟管長令家ザ期般花越ミ域泳通些油乏ラ。營ス返調農叫樹刊愛間包知把ヤ貧橋拡普聞前ジ建当繰ネ送習渇用補ィ覺體法遊宙ョ酔余利壊語くつ払皆時辺追奇そ們只胸械勝住全沈力光ん深溝二類北面社值試9和五勵ゃ貿幾逐打課ゲて領3鼓辦発評渉詳暇込计駄供嘛郵頃腦反構絵お容規借身妻国慮剛急乗静必議置克土オ乎荷更肉還混古渡授合主離條値決季晴東大尚央州が嗎験流先医亦林田星晩拿60旅婦量為痛テ孫う環友況玩務其ぼち揺坐一肩腰犯タょ希即果ぶ物練待み高九找やヶ都グ去」サ、气仮雑酒許終企笑録形リ銀切ギ快問滿役単黄集森毎實研喜蘇司鉛洲川条媽才兩話言雖媒出客づ卻現異故り誌逮同訊已視本題ぞを横開音第席費持眾怎選元退限ー賽処喝就残無いガ多ケ沒義遠歌隣錢某雪析嬉採自透き側員予ゼ白婚电へ顯呀始均畫似懸格車騒度わ親店週維億締慣免帳電甚來園浴ゅ愈京と杯各海怒ぜ排敗挙老買7極模実紀ヒ携隻告シ並屋這孩讓質ワブ富賃争康由辞マ火於短樣削弟材注節另室ダ招擁ぃ若套底波行勤關著泊背疲狭作念推ぐ民貸祖介說ビ代温契你我レ入描變再札ソ派頭智遅私聽舉灣山伸放直安ト誕煙付符幅ふ絡她届耳飲忘参革團仕様載ど歩獲嫌息の汚交興魚指資雙與館初学年幸史位柱族走括び考青也共腕Lで販擔理病イ今逃當寺猫邊菓係ム秘示解池影ド文例斷曾事茶寫明科桃藝売便え導禁財飛替而亡到し具空寝辛業ウ府セ國何基菜厳市努張缺雲根外だ断万砂ゴ超使台实ぽ礼最慧算軟界段律像夕丈窓助刻月夏政呼ぴざ擇趣除動従涼方勉名線対存請子氏將5少否諸論美感或西者定食御表は參歳緑命進易性錯房も捕皿判中觀戦ニ緩町ピ番ず金千ろ?不た象治関ャ每看徒卒統じ手範訪押座步号ベ旁以母すほ密減成往歲件緒読歯效院种七謂凝濃嵌震喉繼クュ拭死円2積水欲如ポにさ寒道區精啦姐ア聯能足及停思壓春且メ裏株官答概黒過氷柿戻厚ぱ党祭織引計け委暗複誘港バ失下村較続神ぇ尤強秀膝兒来績十書済化服破新廠1紹您情半式產系好教暑早め樂地休協良な哪常要揮周かエ麗境働避護ンツ香夜太見設非改広聲他検求危清彼經未在起葉控靴所差內造寄南望尺換向展備眠點完約ぎ裡分説申童優伝島机須塊日立拉,鉄軽單気信很転識支布数紙此迎受心輸坊モ處「訳三曇兄野顔戰增ナ伊列又髪両有取左毛至困吧昔赤狀相夠整別士経頼然簡ホ会發隨営需脱ヨば接永居冬迫圍甘醫誰部充消連弱宇會咲覚姉麼的増首统帶糖朋術商担移景功育庫曲總劃牛程駅犬報ロ學責因パ嚴八世後平負公げ曜陸專午之閉ぬ談ご災昨冷職悪謝對它近射敢意運船臉局難什産頗!球真記ま但蔵究制機案湖臺ひ害券男留内木驗雨施種特復句末濟キ色訴依せ百型る石牠討呢时任執飯歐宅組傳配小活ゆべ暖ズ漸站素らボ束価チ浅回女片独妹英目從認生違策僕楚ペ米こ掛む爸六状落漢プ投カ校做啊洗声探あ割体項履触々訓技ハ低工映是標速善点人デ口次可廿节宵植树端阳旦腊妇费愚劳动儿军师庆圣诞闰".encode('utf-8'))
print("\nGenerating 8 px unscii")
os.system("lv_font_conv --no-compress --no-prefilter --bpp 1 --size 8 --font unscii-8.ttf -r 0x20-0x7F --format lvgl -o lv_font_unscii_8.c --force-fast-kern-format")

View File

@@ -197,6 +197,17 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#define LV_USE_THORVG (LV_USE_THORVG_INTERNAL || LV_USE_THORVG_EXTERNAL)
#endif
#if LV_USE_OS
#if (LV_USE_FREETYPE || LV_USE_THORVG) && LV_DRAW_THREAD_STACK_SIZE < (32 * 1024)
#warning "Increase LV_DRAW_THREAD_STACK_SIZE to at least 32KB for FreeType or ThorVG."
#endif
#if defined(LV_DRAW_THREAD_STACKSIZE) && !defined(LV_DRAW_THREAD_STACK_SIZE)
#warning "LV_DRAW_THREAD_STACKSIZE was renamed to LV_DRAW_THREAD_STACK_SIZE. Please update lv_conf.h or run menuconfig again."
#define LV_DRAW_THREAD_STACK_SIZE LV_DRAW_THREAD_STACKSIZE
#endif
#endif
/*If running without lv_conf.h add typedefs with default value*/
#ifdef LV_CONF_SKIP
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /*Disable warnings for Visual Studio*/

View File

@@ -390,7 +390,7 @@ props = [
'dsc': "Set the base direction of the object. The possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`."},
{'name': 'BITMAP_MASK_SRC',
'style_type': 'ptr', 'var_type': 'const lv_image_dsc_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'style_type': 'ptr', 'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
'dsc': "If set a layer will be created for the widget and the layer will be masked with this A8 bitmap mask."},
{'name': 'ROTARY_SENSITIVITY',

View File

@@ -100,16 +100,12 @@ typedef struct _lv_global_t {
lv_tick_state_t tick_state;
lv_draw_buf_handlers_t draw_buf_handlers;
lv_draw_buf_handlers_t font_draw_buf_handlers;
lv_ll_t img_decoder_ll;
#if LV_CACHE_DEF_SIZE > 0
lv_cache_t * img_cache;
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
lv_cache_t * img_header_cache;
#endif
lv_draw_global_info_t draw_info;
#if defined(LV_DRAW_SW_SHADOW_CACHE_SIZE) && LV_DRAW_SW_SHADOW_CACHE_SIZE > 0

View File

@@ -258,14 +258,14 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent);
/**
* Set one or more flags
* @param obj pointer to an object
* @param f R-ed values from `lv_obj_flag_t` to set.
* @param f OR-ed values from `lv_obj_flag_t` to set.
*/
void lv_obj_add_flag(lv_obj_t * obj, lv_obj_flag_t f);
/**
* Remove one or more flags
* @param obj pointer to an object
* @param f OR-ed values from `lv_obj_flag_t` to set.
* @param f OR-ed values from `lv_obj_flag_t` to clear.
*/
void lv_obj_remove_flag(lv_obj_t * obj, lv_obj_flag_t f);

View File

@@ -33,7 +33,7 @@
**********************/
static void scroll_x_anim(void * obj, int32_t v);
static void scroll_y_anim(void * obj, int32_t v);
static void scroll_completed_completed_cb(lv_anim_t * a);
static void scroll_end_cb(lv_anim_t * a);
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value,
lv_anim_enable_t anim_en);
@@ -309,7 +309,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t a
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, obj);
lv_anim_set_completed_cb(&a, scroll_completed_completed_cb);
lv_anim_set_deleted_cb(&a, scroll_end_cb);
if(dx) {
uint32_t t = lv_anim_speed_clamped((lv_display_get_horizontal_resolution(d)) >> 1, SCROLL_ANIM_TIME_MIN,
@@ -675,7 +675,7 @@ static void scroll_y_anim(void * obj, int32_t v)
_lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
}
static void scroll_completed_completed_cb(lv_anim_t * a)
static void scroll_end_cb(lv_anim_t * a)
{
lv_obj_send_event(a->var, LV_EVENT_SCROLL_END, NULL);
}
@@ -776,13 +776,8 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
}
/*Remove any pending scroll animations.*/
bool y_del = lv_anim_delete(parent, scroll_y_anim);
bool x_del = lv_anim_delete(parent, scroll_x_anim);
if(y_del || x_del) {
lv_result_t res;
res = lv_obj_send_event(parent, LV_EVENT_SCROLL_END, NULL);
if(res != LV_RESULT_OK) return;
}
lv_anim_delete(parent, scroll_y_anim);
lv_anim_delete(parent, scroll_x_anim);
if((scroll_dir & LV_DIR_LEFT) == 0 && x_scroll < 0) x_scroll = 0;
if((scroll_dir & LV_DIR_RIGHT) == 0 && x_scroll > 0) x_scroll = 0;

View File

@@ -429,6 +429,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t
_lv_obj_style_t * style_trans = get_trans_style(obj, part);
lv_style_set_prop((lv_style_t *)style_trans->style, tr_dsc->prop, v1); /*Be sure `trans_style` has a valid value*/
lv_obj_refresh_style(obj, tr_dsc->selector, tr_dsc->prop);
if(tr_dsc->prop == LV_STYLE_RADIUS) {
if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) {
@@ -906,8 +907,9 @@ static void trans_anim_start_cb(lv_anim_t * a)
tr->prop = prop_tmp;
_lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->selector);
lv_style_set_prop((lv_style_t *)style_trans->style, tr->prop,
tr->start_value); /*Be sure `trans_style` has a valid value*/
/*Be sure `trans_style` has a valid value*/
lv_style_set_prop((lv_style_t *)style_trans->style, tr->prop, tr->start_value);
lv_obj_refresh_style(tr->obj, tr->selector, tr->prop);
}

View File

@@ -690,7 +690,8 @@ void lv_obj_set_style_opa_layered(lv_obj_t * obj, lv_opa_t value, lv_style_selec
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA_LAYERED, v, selector);
}
void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value,
lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value
@@ -754,7 +755,7 @@ void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_sel
lv_obj_set_local_style_prop(obj, LV_STYLE_BASE_DIR, v, selector);
}
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const lv_image_dsc_t * value, lv_style_selector_t selector)
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector)
{
lv_style_value_t v = {
.ptr = value

View File

@@ -230,7 +230,8 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, ui
static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_BG_GRAD_COLOR));
return v.color;
}
@@ -290,7 +291,8 @@ static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj,
static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_BG_IMAGE_RECOLOR));
return v.color;
}
@@ -314,7 +316,8 @@ static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, uin
static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_BORDER_COLOR));
return v.color;
}
@@ -356,7 +359,8 @@ static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, ui
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_OUTLINE_COLOR));
return v.color;
}
@@ -404,7 +408,8 @@ static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, uin
static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_SHADOW_COLOR));
return v.color;
}
@@ -428,7 +433,8 @@ static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, ui
static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR));
lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part,
LV_STYLE_IMAGE_RECOLOR));
return v.color;
}
@@ -636,10 +642,10 @@ static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, uint
return (lv_base_dir_t)v.num;
}
static inline const lv_image_dsc_t * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, uint32_t part)
static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BITMAP_MASK_SRC);
return (const lv_image_dsc_t *)v.ptr;
return (const void *)v.ptr;
}
static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, uint32_t part)
@@ -829,7 +835,8 @@ void lv_obj_set_style_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t
void lv_obj_set_style_clip_corner(lv_obj_t * obj, bool value, lv_style_selector_t selector);
void lv_obj_set_style_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_opa_layered(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value,
lv_style_selector_t selector);
void lv_obj_set_style_color_filter_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
void lv_obj_set_style_anim(lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector);
void lv_obj_set_style_anim_duration(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
@@ -837,7 +844,7 @@ void lv_obj_set_style_transition(lv_obj_t * obj, const lv_style_transition_dsc_t
void lv_obj_set_style_blend_mode(lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
void lv_obj_set_style_layout(lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
void lv_obj_set_style_base_dir(lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const lv_image_dsc_t * value, lv_style_selector_t selector);
void lv_obj_set_style_bitmap_mask_src(lv_obj_t * obj, const void * value, lv_style_selector_t selector);
void lv_obj_set_style_rotary_sensitivity(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
#if LV_USE_FLEX
void lv_obj_set_style_flex_flow(lv_obj_t * obj, lv_flex_flow_t value, lv_style_selector_t selector);

View File

@@ -484,8 +484,13 @@ static void lv_obj_delete_async_cb(void * obj)
static void obj_indev_reset(lv_indev_t * indev, lv_obj_t * obj)
{
/*Wait for release to avoid accidentally triggering other obj to be clicked*/
lv_indev_wait_release(indev);
/* If the input device is already in the release state,
* there is no need to wait for the input device to be released
*/
if(lv_indev_get_state(indev) != LV_INDEV_STATE_RELEASED) {
/*Wait for release to avoid accidentally triggering other obj to be clicked*/
lv_indev_wait_release(indev);
}
/*Reset the input device*/
lv_indev_reset(indev, obj);

View File

@@ -959,7 +959,7 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj)
layer_draw_dsc.blend_mode = lv_obj_get_style_blend_mode(obj, 0);
layer_draw_dsc.antialias = disp_refr->antialiasing;
layer_draw_dsc.bitmap_mask_src = lv_obj_get_style_bitmap_mask_src(obj, 0);
layer_draw_dsc.original_area = obj_draw_size;
layer_draw_dsc.image_area = obj_draw_size;
layer_draw_dsc.src = new_layer;
lv_draw_layer(layer, &layer_draw_dsc, &layer_area_act);

View File

@@ -457,6 +457,8 @@ void lv_display_set_color_format(lv_display_t * disp, lv_color_format_t color_fo
disp->color_format = color_format;
disp->layer_head->color_format = color_format;
if(disp->buf_1) disp->buf_1->header.cf = color_format;
if(disp->buf_2) disp->buf_2->header.cf = color_format;
lv_display_send_event(disp, LV_EVENT_COLOR_FORMAT_CHANGED, NULL);
}

View File

@@ -14,7 +14,8 @@
/*********************
* DEFINES
*********************/
#define handlers LV_GLOBAL_DEFAULT()->draw_buf_handlers
#define default_handlers LV_GLOBAL_DEFAULT()->draw_buf_handlers
#define font_draw_buf_handlers LV_GLOBAL_DEFAULT()->font_draw_buf_handlers
/**********************
* TYPEDEFS
@@ -26,8 +27,9 @@
static void * buf_malloc(size_t size, lv_color_format_t color_format);
static void buf_free(void * buf);
static void * buf_align(void * buf, lv_color_format_t color_format);
static void * draw_buf_malloc(size_t size_bytes, lv_color_format_t color_format);
static void draw_buf_free(void * buf);
static void * draw_buf_malloc(const lv_draw_buf_handlers_t * handler, size_t size_bytes,
lv_color_format_t color_format);
static void draw_buf_free(const lv_draw_buf_handlers_t * handler, void * buf);
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
static uint32_t _calculate_draw_buf_size(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride);
@@ -45,34 +47,67 @@ static uint32_t _calculate_draw_buf_size(uint32_t w, uint32_t h, lv_color_format
void _lv_draw_buf_init_handlers(void)
{
lv_memzero(&handlers, sizeof(lv_draw_buf_handlers_t));
handlers.buf_malloc_cb = buf_malloc;
handlers.buf_free_cb = buf_free;
handlers.align_pointer_cb = buf_align;
handlers.invalidate_cache_cb = NULL;
handlers.width_to_stride_cb = width_to_stride;
lv_draw_buf_init_with_default_handlers(&default_handlers);
lv_draw_buf_init_with_default_handlers(&font_draw_buf_handlers);
}
void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers)
{
lv_draw_buf_init_handlers(handlers, buf_malloc, buf_free, buf_align, NULL, width_to_stride);
}
void lv_draw_buf_init_handlers(lv_draw_buf_handlers_t * handlers,
lv_draw_buf_malloc_cb buf_malloc_cb,
lv_draw_buf_free_cb buf_free_cb,
lv_draw_buf_align_cb align_pointer_cb,
lv_draw_buf_invalidate_cache_cb invalidate_cache_cb,
lv_draw_buf_width_to_stride_cb width_to_stride_cb)
{
lv_memzero(handlers, sizeof(lv_draw_buf_handlers_t));
handlers->buf_malloc_cb = buf_malloc_cb;
handlers->buf_free_cb = buf_free_cb;
handlers->align_pointer_cb = align_pointer_cb;
handlers->invalidate_cache_cb = invalidate_cache_cb;
handlers->width_to_stride_cb = width_to_stride_cb;
}
lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void)
{
return &handlers;
return &default_handlers;
}
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format)
{
if(handlers.width_to_stride_cb) return handlers.width_to_stride_cb(w, color_format);
return lv_draw_buf_width_to_stride_user(&default_handlers, w, color_format);
}
uint32_t lv_draw_buf_width_to_stride_user(const lv_draw_buf_handlers_t * handlers, uint32_t w,
lv_color_format_t color_format)
{
if(handlers->width_to_stride_cb) return handlers->width_to_stride_cb(w, color_format);
else return 0;
}
void * lv_draw_buf_align(void * data, lv_color_format_t color_format)
{
if(handlers.align_pointer_cb) return handlers.align_pointer_cb(data, color_format);
return lv_draw_buf_align_user(&default_handlers, data, color_format);
}
void * lv_draw_buf_align_user(const lv_draw_buf_handlers_t * handlers, void * data, lv_color_format_t color_format)
{
if(handlers->align_pointer_cb) return handlers->align_pointer_cb(data, color_format);
else return NULL;
}
void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area)
{
if(handlers.invalidate_cache_cb) {
lv_draw_buf_invalidate_cache_user(&default_handlers, draw_buf, area);
}
void lv_draw_buf_invalidate_cache_user(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf,
const lv_area_t * area)
{
if(handlers->invalidate_cache_cb) {
LV_ASSERT_NULL(draw_buf);
const lv_image_header_t * header = &draw_buf->header;
lv_area_t full;
@@ -82,7 +117,7 @@ void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_
};
area = &full;
}
handlers.invalidate_cache_cb(draw_buf, area);
handlers->invalidate_cache_cb(draw_buf, area);
}
}
@@ -201,6 +236,12 @@ lv_result_t lv_draw_buf_init(lv_draw_buf_t * draw_buf, uint32_t w, uint32_t h, l
}
lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride)
{
return lv_draw_buf_create_user(&default_handlers, w, h, cf, stride);
}
lv_draw_buf_t * lv_draw_buf_create_user(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h,
lv_color_format_t cf, uint32_t stride)
{
lv_draw_buf_t * draw_buf = lv_malloc_zeroed(sizeof(lv_draw_buf_t));
LV_ASSERT_MALLOC(draw_buf);
@@ -209,7 +250,7 @@ lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf,
uint32_t size = _calculate_draw_buf_size(w, h, cf, stride);
void * buf = draw_buf_malloc(size, cf);
void * buf = draw_buf_malloc(handlers, size, cf);
/*Do not assert here as LVGL or the app might just want to try creating a draw_buf*/
if(buf == NULL) {
LV_LOG_WARN("No memory: %"LV_PRIu32"x%"LV_PRIu32", cf: %d, stride: %"LV_PRIu32", %"LV_PRIu32"Byte, ",
@@ -272,12 +313,17 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
}
void lv_draw_buf_destroy(lv_draw_buf_t * buf)
{
lv_draw_buf_destroy_user(&default_handlers, buf);
}
void lv_draw_buf_destroy_user(const lv_draw_buf_handlers_t * handlers, lv_draw_buf_t * buf)
{
LV_ASSERT_NULL(buf);
if(buf == NULL) return;
if(buf->header.flags & LV_IMAGE_FLAGS_ALLOCATED) {
draw_buf_free(buf->unaligned_data);
draw_buf_free(handlers, buf->unaligned_data);
lv_free(buf);
}
else {
@@ -490,15 +536,17 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
return (width_byte + LV_DRAW_BUF_STRIDE_ALIGN - 1) & ~(LV_DRAW_BUF_STRIDE_ALIGN - 1);
}
static void * draw_buf_malloc(size_t size_bytes, lv_color_format_t color_format)
static void * draw_buf_malloc(const lv_draw_buf_handlers_t * handlers, size_t size_bytes,
lv_color_format_t color_format)
{
if(handlers.buf_malloc_cb) return handlers.buf_malloc_cb(size_bytes, color_format);
if(handlers->buf_malloc_cb) return handlers->buf_malloc_cb(size_bytes, color_format);
else return NULL;
}
static void draw_buf_free(void * buf)
static void draw_buf_free(const lv_draw_buf_handlers_t * handlers, void * buf)
{
if(handlers.buf_free_cb) handlers.buf_free_cb(buf);
if(handlers->buf_free_cb)
handlers->buf_free_cb(buf);
}
/**

View File

@@ -97,6 +97,30 @@ typedef struct {
*/
void _lv_draw_buf_init_handlers(void);
/**
* Initialize the draw buffer with the default handlers.
*
* @param handlers the draw buffer handlers to set
*/
void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers);
/**
* Initialize the draw buffer with given handlers.
*
* @param handlers the draw buffer handlers to set
* @param buf_malloc_cb the callback to allocate memory for the buffer
* @param buf_free_cb the callback to free memory of the buffer
* @param align_pointer_cb the callback to align the buffer
* @param invalidate_cache_cb the callback to invalidate the cache of the buffer
* @param width_to_stride_cb the callback to calculate the stride based on the width and color format
*/
void lv_draw_buf_init_handlers(lv_draw_buf_handlers_t * handlers,
lv_draw_buf_malloc_cb buf_malloc_cb,
lv_draw_buf_free_cb buf_free_cb,
lv_draw_buf_align_cb align_pointer_cb,
lv_draw_buf_invalidate_cache_cb invalidate_cache_cb,
lv_draw_buf_width_to_stride_cb width_to_stride_cb);
/**
* Get the struct which holds the callbacks for draw buf management.
* Custom callback can be set on the returned value
@@ -112,6 +136,15 @@ lv_draw_buf_handlers_t * lv_draw_buf_get_handlers(void);
*/
void * lv_draw_buf_align(void * buf, lv_color_format_t color_format);
/**
* Align the address of a buffer. The buffer needs to be large enough for the real data after alignment
* @param handlers the draw buffer handlers
* @param buf the data to align
* @param color_format the color format of the buffer
* @return the aligned buffer
*/
void * lv_draw_buf_align_user(const lv_draw_buf_handlers_t * handlers, void * buf, lv_color_format_t color_format);
/**
* Invalidate the cache of the buffer
* @param draw_buf the draw buffer needs to be invalidated
@@ -120,6 +153,15 @@ void * lv_draw_buf_align(void * buf, lv_color_format_t color_format);
*/
void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_t * area);
/**
* Invalidate the cache of the buffer using the user-defined callback
* @param handlers the draw buffer handlers
* @param draw_buf the draw buffer needs to be invalidated
* @param area the area to invalidate in the buffer,
*/
void lv_draw_buf_invalidate_cache_user(const lv_draw_buf_handlers_t * handlers, const lv_draw_buf_t * draw_buf,
const lv_area_t * area);
/**
* Calculate the stride in bytes based on a width and color format
* @param w the width in pixels
@@ -128,6 +170,16 @@ void lv_draw_buf_invalidate_cache(const lv_draw_buf_t * draw_buf, const lv_area_
*/
uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format);
/**
* Calculate the stride in bytes based on a width and color format
* @param handlers the draw buffer handlers
* @param w the width in pixels
* @param color_format the color format
* @return the stride in bytes
*/
uint32_t lv_draw_buf_width_to_stride_user(const lv_draw_buf_handlers_t * handlers, uint32_t w,
lv_color_format_t color_format);
/**
* Clear an area on the buffer
* @param draw_buf pointer to draw buffer
@@ -162,6 +214,23 @@ void lv_draw_buf_copy(lv_draw_buf_t * dest, const lv_area_t * dest_area,
*/
lv_draw_buf_t * lv_draw_buf_create(uint32_t w, uint32_t h, lv_color_format_t cf, uint32_t stride);
/**
* Note: Eventually, lv_draw_buf_malloc/free will be kept as private.
* For now, we use `create` to distinguish with malloc.
*
* Create an draw buf by allocating struct for `lv_draw_buf_t` and allocating a buffer for it
* that meets specified requirements.
*
* @param handlers the draw buffer handlers
* @param w the buffer width in pixels
* @param h the buffer height in pixels
* @param cf the color format for image
* @param stride the stride in bytes for image. Use 0 for automatic calculation based on
* w, cf, and global stride alignment configuration.
*/
lv_draw_buf_t * lv_draw_buf_create_user(const lv_draw_buf_handlers_t * handlers, uint32_t w, uint32_t h,
lv_color_format_t cf, uint32_t stride);
/**
* Initialize a draw buf with the given buffer and parameters.
* @param draw_buf the draw buf to initialize
@@ -198,9 +267,20 @@ lv_draw_buf_t * lv_draw_buf_reshape(lv_draw_buf_t * draw_buf, lv_color_format_t
/**
* Destroy a draw buf by free the actual buffer if it's marked as LV_IMAGE_FLAGS_ALLOCATED in header.
* Then free the lv_draw_buf_t struct.
*
* @param buf the draw buffer to destroy
*/
void lv_draw_buf_destroy(lv_draw_buf_t * buf);
/**
* Destroy a draw buf by free the actual buffer if it's marked as LV_IMAGE_FLAGS_ALLOCATED in header.
* Then free the lv_draw_buf_t struct.
*
* @param handlers the draw buffer handlers
* @param buf the draw buffer to destroy
*/
void lv_draw_buf_destroy_user(const lv_draw_buf_handlers_t * handlers, lv_draw_buf_t * buf);
/**
* Return pointer to the buffer at the given coordinates
*/

View File

@@ -51,7 +51,7 @@ void lv_draw_image_dsc_init(lv_draw_image_dsc_t * dsc)
dsc->scale_x = LV_SCALE_NONE;
dsc->scale_y = LV_SCALE_NONE;
dsc->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
dsc->original_area.x2 = LV_COORD_MIN; /*Indicate invalid area by default by setting a negative size*/
dsc->image_area.x2 = LV_COORD_MIN; /*Indicate invalid area by default by setting a negative size*/
dsc->base.dsc_size = sizeof(lv_draw_image_dsc_t);
}
@@ -185,7 +185,7 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image
int32_t img_w = draw_dsc->header.w;
int32_t img_h = draw_dsc->header.h;
lv_area_t tile_area = *coords;
lv_area_t tile_area = draw_dsc->image_area;
lv_area_set_width(&tile_area, img_w);
lv_area_set_height(&tile_area, img_h);
@@ -198,11 +198,11 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image
.y2 = LV_COORD_MIN,
};
while(tile_area.y1 <= draw_unit->clip_area->y2) {
while(tile_area.x1 <= draw_unit->clip_area->x2) {
while(tile_area.y1 <= coords->y2) {
while(tile_area.x1 <= coords->x2) {
lv_area_t clipped_img_area;
if(_lv_area_intersect(&clipped_img_area, &tile_area, draw_unit->clip_area)) {
if(_lv_area_intersect(&clipped_img_area, &tile_area, coords)) {
img_decode_and_draw(draw_unit, draw_dsc, &decoder_dsc, &relative_decoded_area, &tile_area, &clipped_img_area,
draw_core_cb);
}

View File

@@ -59,9 +59,12 @@ typedef struct _lv_draw_image_dsc_t {
uint16_t tile : 1;
lv_draw_image_sup_t * sup;
/** Might be used to indicate the original size of the image if only a small portion is rendered now.
* Used when a part of a layer is rendered to show the total layer size*/
lv_area_t original_area;
/** Used to indicate the entire original, non-clipped area where the image is to be drawn.
* This is important for:
* 1. Layer rendering, where it might happen that only a smaller area of the layer is rendered.
* 2. Tiled images, where the target draw area is larger than the image to be tiled.
*/
lv_area_t image_area;
const lv_image_dsc_t * bitmap_mask_src;
} lv_draw_image_dsc_t;
@@ -100,6 +103,9 @@ lv_draw_image_dsc_t * lv_draw_task_get_image_dsc(lv_draw_task_t * task);
* @param layer pointer to a layer
* @param dsc pointer to an initialized draw descriptor
* @param coords the coordinates of the image
* @note `coords` can be small than the real image area
* (if only a part of the image is rendered)
* or can be larger (in case of tiled images). .
*/
void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords);
@@ -107,7 +113,9 @@ void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv
* Create a draw task to blend a layer to an other layer
* @param layer pointer to a layer
* @param dsc pointer to an initialized draw descriptor
* @param coords the coordinates of the layer
* @param coords the coordinates of the layer.
* @note `coords` can be small than the total widget area from which the layer is created
* (if only a part of the widget was rendered to a layer)
*/
void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv_area_t * coords);

View File

@@ -11,9 +11,11 @@
#include "../misc/lv_math.h"
#include "../core/lv_obj_event.h"
#include "../misc/lv_bidi.h"
#include "../misc/lv_text_private.h"
#include "../misc/lv_assert.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"
#include "../core/lv_global.h"
/*********************
* DEFINES
@@ -21,6 +23,8 @@
#define LABEL_RECOLOR_PAR_LENGTH 6
#define LV_LABEL_HINT_UPDATE_TH 1024 /*Update the "hint" if the label's y coordinates have changed more then this*/
#define font_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->font_draw_buf_handlers)
/**********************
* TYPEDEFS
**********************/
@@ -107,7 +111,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_character(lv_layer_t * layer, lv_draw_label_d
return;
}
if(_lv_text_is_marker(unicode_letter)) return;
if(lv_text_is_marker(unicode_letter)) return;
LV_PROFILER_BEGIN;
@@ -122,7 +126,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_character(lv_layer_t * layer, lv_draw_label_d
/*lv_draw_label needs UTF8 text so convert the Unicode character to an UTF8 string */
uint32_t letter_buf[2];
letter_buf[0] = _lv_text_unicode_to_encoded(unicode_letter);
letter_buf[0] = lv_text_unicode_to_encoded(unicode_letter);
letter_buf[1] = '\0';
const char * letter_buf_char = (const char *)letter_buf;
@@ -198,14 +202,14 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
pos.y += dsc->hint->y;
}
uint32_t line_end = line_start + _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL,
dsc->flag);
uint32_t line_end = line_start + lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL,
dsc->flag);
/*Go the first visible line*/
while(pos.y + line_height_font < draw_unit->clip_area->y1) {
/*Go to next line*/
line_start = line_end;
line_end += _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
pos.y += line_height;
/*Save at the threshold coordinate*/
@@ -273,17 +277,17 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
uint32_t logical_char_pos = 0;
if(sel_start != 0xFFFF && sel_end != 0xFFFF) {
#if LV_USE_BIDI
logical_char_pos = _lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = _lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start);
uint32_t t = lv_text_encoded_get_char_id(bidi_txt, i);
logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL);
#else
logical_char_pos = _lv_text_encoded_get_char_id(dsc->text, line_start + i);
logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start + i);
#endif
}
uint32_t letter;
uint32_t letter_next;
_lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i);
lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i);
letter_w = lv_font_get_glyph_width(font, letter, letter_next);
@@ -338,7 +342,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
#endif
/*Go to next line*/
line_start = line_end;
line_end += _lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
line_end += lv_text_get_next_line(&dsc->text[line_start], font, dsc->letter_space, w, NULL, dsc->flag);
pos.x = coords->x1;
/*Align to middle*/
@@ -361,7 +365,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_
if(pos.y > draw_unit->clip_area->y2) break;
}
if(draw_letter_dsc._draw_buf) lv_draw_buf_destroy(draw_letter_dsc._draw_buf);
if(draw_letter_dsc._draw_buf) lv_draw_buf_destroy_user(font_draw_buf_handlers, draw_letter_dsc._draw_buf);
LV_ASSERT_MEM_INTEGRITY();
}
@@ -375,7 +379,7 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
{
lv_font_glyph_dsc_t g;
if(_lv_text_is_marker(letter)) /*Markers are valid letters but should not be rendered.*/
if(lv_text_is_marker(letter)) /*Markers are valid letters but should not be rendered.*/
return;
LV_PROFILER_BEGIN;
@@ -410,18 +414,18 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
/*Only check draw buf for bitmap glyph*/
draw_buf = lv_draw_buf_reshape(dsc->_draw_buf, 0, g.box_w, g.box_h, LV_STRIDE_AUTO);
if(draw_buf == NULL) {
if(dsc->_draw_buf) lv_draw_buf_destroy(dsc->_draw_buf);
if(dsc->_draw_buf) lv_draw_buf_destroy_user(font_draw_buf_handlers, dsc->_draw_buf);
uint32_t h = g.box_h;
if(h * g.box_w < 64) h *= 2; /*Alloc a slightly larger buffer*/
draw_buf = lv_draw_buf_create(g.box_w, h, LV_COLOR_FORMAT_A8, LV_STRIDE_AUTO);
draw_buf = lv_draw_buf_create_user(font_draw_buf_handlers, g.box_w, h, LV_COLOR_FORMAT_A8, LV_STRIDE_AUTO);
LV_ASSERT_MALLOC(draw_buf);
draw_buf->header.h = g.box_h;
dsc->_draw_buf = draw_buf;
}
}
dsc->glyph_data = (void *)lv_font_get_glyph_bitmap(&g, letter, draw_buf);
dsc->glyph_data = (void *) lv_font_get_glyph_bitmap(&g, draw_buf);
dsc->format = dsc->glyph_data ? g.format : LV_FONT_GLYPH_FORMAT_NONE;
}
else {
@@ -432,8 +436,7 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc,
dsc->g = &g;
cb(draw_unit, dsc, NULL, NULL);
if(g.resolved_font && font->release_glyph) {
font->release_glyph(font, &g);
}
lv_font_glyph_release_draw_data(&g);
LV_PROFILER_END;
}

View File

@@ -50,6 +50,9 @@ lv_draw_line_dsc_t * lv_draw_task_get_line_dsc(lv_draw_task_t * task)
void LV_ATTRIBUTE_FAST_MEM lv_draw_line(lv_layer_t * layer, const lv_draw_line_dsc_t * dsc)
{
if(dsc->width == 0) return;
if(dsc->opa <= LV_OPA_MIN) return;
LV_PROFILER_BEGIN;
lv_area_t a;
a.x1 = (int32_t)LV_MIN(dsc->p1.x, dsc->p2.x) - dsc->width;

View File

@@ -118,7 +118,10 @@ void lv_draw_rect(lv_layer_t * layer, const lv_draw_rect_dsc_t * dsc, const lv_a
if(dsc->bg_image_opa <= LV_OPA_MIN || dsc->bg_image_src == NULL) has_bg_img = false;
else has_bg_img = true;
if(dsc->border_opa <= LV_OPA_MIN || dsc->border_width == 0 || dsc->border_post == true) has_border = false;
if(dsc->border_opa <= LV_OPA_MIN
|| dsc->border_width == 0
|| dsc->border_post == true
|| dsc->border_side == LV_BORDER_SIDE_NONE) has_border = false;
else has_border = true;
if(dsc->outline_opa <= LV_OPA_MIN || dsc->outline_width == 0) has_outline = false;

View File

@@ -56,6 +56,8 @@ lv_draw_triangle_dsc_t * lv_draw_task_get_triangle_dsc(lv_draw_task_t * task)
void lv_draw_triangle(lv_layer_t * layer, const lv_draw_triangle_dsc_t * dsc)
{
if(dsc->bg_opa <= LV_OPA_MIN) return;
LV_PROFILER_BEGIN;
lv_area_t a;
a.x1 = (int32_t)LV_MIN3(dsc->p[0].x, dsc->p[1].x, dsc->p[2].x);

View File

@@ -38,9 +38,7 @@ static uint32_t img_width_to_stride(lv_image_header_t * header);
*/
static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_header_t * header);
#if LV_CACHE_DEF_SIZE > 0
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc);
#endif
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc);
/**********************
* STATIC VARIABLES
@@ -57,18 +55,13 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
/**
* Initialize the image decoder module
*/
void _lv_image_decoder_init(void)
void _lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count)
{
_lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t));
/*Initialize the cache*/
#if LV_CACHE_DEF_SIZE > 0
lv_image_cache_init();
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
lv_image_header_cache_init();
#endif
lv_image_cache_init(image_cache_size);
lv_image_header_cache_init(image_header_count);
}
/**
@@ -76,13 +69,9 @@ void _lv_image_decoder_init(void)
*/
void _lv_image_decoder_deinit(void)
{
#if LV_CACHE_DEF_SIZE > 0
lv_cache_destroy(img_cache_p, NULL);
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
lv_cache_destroy(img_header_cache_p, NULL);
#endif
_lv_ll_clear(img_decoder_ll_p);
}
@@ -102,16 +91,16 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
dsc->src = src;
dsc->src_type = lv_image_src_get_type(src);
#if LV_CACHE_DEF_SIZE > 0
dsc->cache = img_cache_p;
/*Try cache first, unless we are told to ignore cache.*/
if(!(args && args->no_cache)) {
/*
* Check the cache first
* If the image is found in the cache, just return it.*/
if(try_cache(dsc) == LV_RESULT_OK) return LV_RESULT_OK;
if(lv_image_cache_is_enabled()) {
dsc->cache = img_cache_p;
/*Try cache first, unless we are told to ignore cache.*/
if(!(args && args->no_cache)) {
/*
* Check the cache first
* If the image is found in the cache, just return it.*/
if(try_cache(dsc) == LV_RESULT_OK) return LV_RESULT_OK;
}
}
#endif
/*Find the decoder that can open the image source, and get the header info in the same time.*/
dsc->decoder = image_decoder_get_info(src, &dsc->header);
@@ -201,7 +190,6 @@ void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decode
decoder->close_cb = close_cb;
}
#if LV_CACHE_DEF_SIZE > 0
lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder,
lv_image_cache_data_t * search_key,
const lv_draw_buf_t * decoded, void * user_data)
@@ -224,7 +212,6 @@ lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder,
return cache_entry;
}
#endif
lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_draw_buf_t * decoded)
{
@@ -290,10 +277,13 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
if(img_dsc->data == NULL) return NULL;
}
lv_image_decoder_t * decoder;
if(src_type == LV_IMAGE_SRC_FILE) LV_LOG_INFO("Try to find decoder for %s", (const char *)src);
else LV_LOG_INFO("Try to find decoder for %p", src);
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
if(src_type == LV_IMAGE_SRC_FILE) {
lv_image_decoder_t * decoder;
bool is_header_cache_enabled = lv_image_header_cache_is_enabled();
if(is_header_cache_enabled && src_type == LV_IMAGE_SRC_FILE) {
lv_image_header_cache_data_t search_key;
search_key.src_type = src_type;
search_key.src = src;
@@ -305,15 +295,21 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
*header = cached_data->header;
decoder = cached_data->decoder;
lv_cache_release(img_header_cache_p, entry, NULL);
LV_LOG_INFO("Found decoder %s in header cache", decoder->name);
return decoder;
}
}
#endif
/*Search the decoders*/
lv_image_decoder_t * decoder_prev = NULL;
_LV_LL_READ(img_decoder_ll_p, decoder) {
/*Info and Open callbacks are required*/
if(decoder->info_cb && decoder->open_cb) {
lv_result_t res = decoder->info_cb(decoder, src, header);
if(decoder_prev) LV_LOG_INFO("Can't open image with decoder %s. Trying next decoder.", decoder_prev->name);
if(res == LV_RESULT_OK) {
if(header->stride == 0) {
LV_LOG_INFO("Image decoder didn't set stride. Calculate it from width.");
@@ -321,11 +317,15 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
}
break;
}
decoder_prev = decoder;
}
}
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
if(src_type == LV_IMAGE_SRC_FILE && decoder) {
if(decoder == NULL) LV_LOG_INFO("No decoder found");
else LV_LOG_INFO("Found decoder %s", decoder->name);
if(is_header_cache_enabled && src_type == LV_IMAGE_SRC_FILE && decoder) {
lv_cache_entry_t * entry;
lv_image_header_cache_data_t search_key;
search_key.src_type = src_type;
@@ -341,7 +341,6 @@ static lv_image_decoder_t * image_decoder_get_info(const void * src, lv_image_he
lv_cache_release(img_header_cache_p, entry, NULL);
}
#endif
return decoder;
}
@@ -356,7 +355,6 @@ static uint32_t img_width_to_stride(lv_image_header_t * header)
}
}
#if LV_CACHE_DEF_SIZE > 0
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc)
{
lv_cache_t * cache = dsc->cache;
@@ -377,4 +375,3 @@ static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc)
return LV_RESULT_INVALID;
}
#endif

View File

@@ -82,15 +82,14 @@ typedef lv_result_t (*lv_image_decoder_info_f_t)(lv_image_decoder_t * decoder, c
typedef lv_result_t (*lv_image_decoder_open_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc);
/**
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
* Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` values to `LV_COORD_MIN` on first call.
* Required only if the "open" function can't return with the whole decoded pixel array.
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
* @param x start x coordinate
* @param y start y coordinate
* @param len number of pixels to decode
* @param buf a buffer to store the decoded pixels
* @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed
* @param full_area input parameter. the full area to decode after enough subsequent calls
* @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding.
* the decoded area is stored here after each call.
* @return LV_RESULT_OK: ok; LV_RESULT_INVALID: failed or there is nothing left to decode
*/
typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(lv_image_decoder_t * decoder,
lv_image_decoder_dsc_t * dsc,
@@ -109,6 +108,8 @@ struct _lv_image_decoder_t {
lv_image_decoder_get_area_cb_t get_area_cb;
lv_image_decoder_close_f_t close_cb;
const char * name;
void * user_data;
};
@@ -178,8 +179,10 @@ struct _lv_image_decoder_dsc_t {
/**
* Initialize the image decoder module
* @param image_cache_size Image cache size in bytes. 0 to disable cache.
* @param image_header_count Number of header cache entries. 0 to disable header cache.
*/
void _lv_image_decoder_init(void);
void _lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count);
/**
* Deinitialize the image decoder module
@@ -213,12 +216,13 @@ lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * head
*/
lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src, const lv_image_decoder_args_t * args);
/**
* Decode an area of the opened image
/***
* Decode `full_area` pixels incrementally by calling in a loop. Set `decoded_area` to `LV_COORD_MIN` on first call.
* @param dsc image decoder descriptor
* @param full_area start X coordinate (from left)
* @param decoded_area start Y coordinate (from top)
* @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred
* @param full_area input parameter. the full area to decode after enough subsequent calls
* @param decoded_area input+output parameter. set the values to `LV_COORD_MIN` for the first call and to reset decoding.
* the decoded area is stored here after each call.
* @return LV_RESULT_OK: success; LV_RESULT_INVALID: an error occurred or there is nothing left to decode
*/
lv_result_t lv_image_decoder_get_area(lv_image_decoder_dsc_t * dsc, const lv_area_t * full_area,
lv_area_t * decoded_area);
@@ -276,11 +280,9 @@ void lv_image_decoder_set_get_area_cb(lv_image_decoder_t * decoder, lv_image_dec
*/
void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decoder_close_f_t close_cb);
#if LV_CACHE_DEF_SIZE > 0
lv_cache_entry_t * lv_image_decoder_add_to_cache(lv_image_decoder_t * decoder,
lv_image_cache_data_t * search_key,
const lv_draw_buf_t * decoded, void * user_data);
#endif
/**
* Check the decoded image, make any modification if decoder `args` requires.

View File

@@ -214,9 +214,6 @@ static int32_t _vglite_evaluate(lv_draw_unit_t * u, lv_draw_task_t * t)
case LV_DRAW_TASK_TYPE_BORDER: {
const lv_draw_border_dsc_t * draw_dsc = (lv_draw_border_dsc_t *) t->draw_dsc;
if(draw_dsc->side != (lv_border_side_t)LV_BORDER_SIDE_FULL)
return 0;
if(t->preference_score > 90) {
t->preference_score = 90;
t->preferred_draw_unit_id = DRAW_UNIT_ID_VGLITE;

View File

@@ -30,6 +30,9 @@
* DEFINES
*********************/
/*** Define maximum numbers of rectangles needed to clip partial borders ***/
#define MAX_NUM_RECTANGLES 4
/**********************
* TYPEDEFS
**********************/
@@ -132,6 +135,49 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip
vg_lite_identity(&matrix);
int32_t line_width = dsc->width;
lv_border_side_t border_side = dsc->side;
if(border_side == LV_BORDER_SIDE_FULL)
border_side = LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM | LV_BORDER_SIDE_LEFT | LV_BORDER_SIDE_RIGHT;
uint32_t num_rect = 0;
vg_lite_rectangle_t rect[MAX_NUM_RECTANGLES];
if(border_side & LV_BORDER_SIDE_TOP) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = coords->x2 - coords->x1 + line_width;
rect[num_rect].height = line_width;
num_rect++;
}
if(border_side & LV_BORDER_SIDE_LEFT) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = line_width;
rect[num_rect].height = coords->y2 - coords->y1 + line_width;
num_rect++;
}
if(border_side & LV_BORDER_SIDE_RIGHT) {
rect[num_rect].x = coords->x2 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y1 - ceil(line_width / 2.0f);
rect[num_rect].width = line_width;
rect[num_rect].height = coords->y2 - coords->y1 + line_width;
num_rect++;
}
if(border_side & LV_BORDER_SIDE_BOTTOM) {
rect[num_rect].x = coords->x1 - ceil(line_width / 2.0f);
rect[num_rect].y = coords->y2 - ceil(line_width / 2.0f);
rect[num_rect].width = coords->x2 - coords->x1 + line_width;
rect[num_rect].height = line_width;
num_rect++;
}
/*** Enable scissor and apply scissor rects ***/
VGLITE_CHECK_ERROR(vg_lite_enable_scissor());
VGLITE_CHECK_ERROR(vg_lite_scissor_rects(vgbuf, num_rect, rect));
/*** Draw border ***/
VGLITE_CHECK_ERROR(vg_lite_set_draw_path_type(&path, VG_LITE_DRAW_STROKE_PATH));
@@ -145,6 +191,9 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip
vglite_run();
VGLITE_CHECK_ERROR(vg_lite_clear_path(&path));
/*** Disable scissor ***/
VGLITE_CHECK_ERROR(vg_lite_disable_scissor());
}
#endif /*LV_USE_DRAW_VGLITE*/

View File

@@ -142,10 +142,8 @@ static void _draw_vglite_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t
break;
case LV_FONT_GLYPH_FORMAT_IMAGE: {
#if LV_USE_IMGFONT
lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc);
img_dsc.angle = 0;
img_dsc.zoom = LV_ZOOM_NONE;
lv_draw_image_dsc_t img_dsc;
lv_draw_image_dsc_init(&img_dsc);
img_dsc.opa = glyph_draw_dsc->opa;
img_dsc.src = glyph_draw_dsc->glyph_data;
lv_draw_vglite_img(draw_unit, &img_dsc, glyph_draw_dsc->letter_coords);

View File

@@ -224,10 +224,41 @@ static bool draw_to_texture(lv_draw_sdl_unit_t * u, cache_data_t * data)
break;
case LV_DRAW_TASK_TYPE_IMAGE: {
lv_draw_image_dsc_t * image_dsc = task->draw_dsc;
const char * path = image_dsc->src;
SDL_Surface * surface = IMG_Load(&path[2]);
if(surface == NULL) {
fprintf(stderr, "could not load image: %s\n", IMG_GetError());
lv_image_src_t type = lv_image_src_get_type(image_dsc->src);
SDL_Surface * surface = NULL;
if(type == LV_IMAGE_SRC_FILE) {
const char * path = image_dsc->src;
surface = IMG_Load(&path[2]);
if(surface == NULL) {
LV_LOG_ERROR("could not load image from file: %s", IMG_GetError());
return false;
}
}
else if(type == LV_IMAGE_SRC_VARIABLE) {
lv_image_dsc_t * lvd = image_dsc->src;
surface = SDL_CreateRGBSurfaceFrom(lvd->data,
lvd->header.w, lvd->header.h,
LV_COLOR_FORMAT_GET_BPP(lvd->header.cf),
lvd->header.stride,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x00FF0000,
0x0000FF00,
0x000000FF,
0xFF000000
#else
0x0000FF00,
0x00FF0000,
0xFF000000,
0x000000FF
#endif
);
if(surface == NULL) {
LV_LOG_ERROR("could not load image from variable");
return false;
}
}
else {
LV_LOG_WARN("image source type unknown");
return false;
}

View File

@@ -143,7 +143,7 @@ void lv_draw_sw_init(void)
draw_sw_unit->base_unit.delete_cb = LV_USE_OS ? lv_draw_sw_delete : NULL;
#if LV_USE_OS
lv_thread_init(&draw_sw_unit->thread, LV_THREAD_PRIO_HIGH, render_thread_cb, 8 * 1024, draw_sw_unit);
lv_thread_init(&draw_sw_unit->thread, LV_THREAD_PRIO_HIGH, render_thread_cb, LV_DRAW_THREAD_STACK_SIZE, draw_sw_unit);
#endif
}

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