Compare commits

..

25 Commits

Author SHA1 Message Date
Gabor Kiss-Vamosi
d0a9e8b817 update lv_conf_internal.h 2024-04-22 18:13:02 +02:00
Gabor Kiss-Vamosi
08087cccd8 fix test build error 2024-04-17 10:55:53 +02:00
Gabor Kiss-Vamosi
de366cc4aa enable sysmon in CI 2024-04-17 10:02:03 +02:00
Gabor Kiss-Vamosi
f3ab9dfeb0 fix warnings 2024-04-16 09:34:39 +02:00
Gabor Kiss-Vamosi
2bfa8ae1f5 works with multi display 2024-04-15 21:06:42 +02:00
Gabor Peresztegi
75e759e3ba fix(sysmon): fix CI build 2024-03-24 10:09:00 +01:00
Gabor Peresztegi
4b914a3f10 fix(sysmon): add sysmon prototype 2024-03-24 10:01:55 +01:00
Gabor Peresztegi
db2605064e fix(sysmon): fix system monitor CI build 2024-03-24 09:51:40 +01:00
Gabor Peresztegi
2b0b3bdaad chore(sysmon): fix code formatting 2024-03-22 15:27:13 +01:00
Gabor Peresztegi
ec8012dd61 fix(sysmon): add sysmon performance and memory show/hide functions 2024-03-22 13:30:12 +01:00
Gabor Peresztegi
f7acf1e4ce fix(sysmon): fix system monitor CI build error 2024-03-21 17:57:45 +01:00
Gabor Peresztegi
57ad8017dd fix(sysmon): fix MicroPython compilation error when system monitor is enabled 2024-03-21 17:48:54 +01:00
Peter Bee
f37aebf332 feat(draw): optimize helium asm (#5702)
Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2024-03-21 13:41:28 +01:00
Johannes Marbach
1b97f0f2c0 feat(fbdev,sdl): support display rotation (#5703)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
2024-03-21 19:36:38 +08:00
lhdjply
910257fa8a docs(changelog): fixed changelog displaying no line breaks (#5931)
Signed-off-by: lhdjply <lhdjply@126.com>
2024-03-21 19:22:45 +08:00
Xu Xingliang
49053e9d96 feat(libpng): use I8 format if png is 8bit mode
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-03-21 18:26:20 +08:00
Xu Xingliang
3116dc469e feat(libpng): let png handle stride alignment
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-03-21 18:26:20 +08:00
liamHowatt
4b41590cf1 fix(flex): LV_FLEX_ALIGN_SPACE_BETWEEN align single item left (#5915) 2024-03-20 23:31:53 +01:00
Gabor Kiss-Vamosi
905de3d7c8 fix(platformio): fix CI to automatically publish release (#5924) 2024-03-20 21:24:57 +08:00
GoT
f4226cd7de feat(fs): add Arduino ESP LittleFS driver (#5905) 2024-03-20 13:51:20 +01:00
Benign X
8691574c5b chore(cache): adjust includes (#5921) 2024-03-20 12:04:28 +01:00
VIFEXT
4d4bb340c0 feat(vg_lite): add radial gradient support (#5836)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-03-20 12:03:45 +01:00
Gabor Kiss-Vamosi
3c2a1935c8 docs: update changelog (#5923) 2024-03-20 10:43:01 +01:00
Michael Simon
352420cd54 refacter(conf): use defines for standard includes (#5767)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>
2024-03-20 12:10:33 +08:00
Benign X
393c24c6e9 refactor(image_decoder): refactor image decoder and image cache (#5890) 2024-03-20 10:20:32 +08:00
153 changed files with 2511 additions and 977 deletions

View File

@@ -19,4 +19,4 @@ jobs:
- name: Switch to the development version
run: pio upgrade --dev
- name: Publish
run: pio pkg publish --owner lvgl .
run: pio pkg publish --no-interactive --owner lvgl .

21
Kconfig
View File

@@ -335,6 +335,20 @@ 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
int "VG-Lite linear gradient image maximum cache number."
default 32
depends on LV_USE_DRAW_VG_LITE
help
The memory usage of a single gradient image is 4K bytes.
config LV_VG_LITE_RADIAL_GRAD_CACHE_CNT
int "VG-Lite radial gradient image maximum cache number."
default 32
depends on LV_USE_DRAW_VG_LITE
help
The memory usage of a single gradient image is radial grad radius * 4 bytes.
config LV_USE_VECTOR_GRAPHIC
bool "Use Vector Graphic APIs"
default n
@@ -1066,6 +1080,13 @@ menu "LVGL configuration"
default 0
depends on LV_USE_FS_LITTLEFS
config LV_USE_FS_ARDUINO_ESP_LITTLEFS
bool "File system on top of Arduino ESP littlefs API"
config LV_FS_ARDUINO_ESP_LITTLEFS_LETTER
int "Set an upper cased letter on which the drive will accessible (e.g. 'A' i.e. 65)"
default 0
depends on LV_USE_FS_ARDUINO_ESP_LITTLEFS
config LV_USE_LODEPNG
bool "PNG decoder library"

View File

@@ -20,7 +20,9 @@ extern "C" {
* DEFINES
*********************/
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
/**********************
* TYPEDEFS

View File

@@ -203,7 +203,7 @@ static void ta_event_cb(lv_event_t * e)
lv_keyboard_set_textarea(kb, ta);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
lv_group_focus_obj(kb);
lv_group_set_editing(lv_obj_get_group(kb), kb);
lv_group_set_editing(lv_obj_get_group(kb), kb != NULL);
lv_obj_set_height(tv, LV_VER_RES / 2);
lv_obj_align(kb, LV_ALIGN_BOTTOM_MID, 0, 0);
}

View File

@@ -12,7 +12,7 @@
#include "lvgl/lvgl.h"
#endif
#if LV_USE_DEMO_MULTILANG
#if defined(LV_USE_DEMO_MULTILANG) || defined(LV_USE_DEMO_TRANSFORM)
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN

View File

@@ -3,150 +3,319 @@
Changelog
=========
v9.0.0
~~~~~~
`v9.1.0 <https://github.com/lvgl/lvgl/compare/v9.0.0...v9.1.0>`__ 20 March 2024
----------------------------------------------------------------------------------------------
Migration guide
^^^^^^^^^^^^^^^
New Features
~~~~~~~~~~~~
As v9 is a major version it contains API breaking changes too. Most of the conceptual changes in v9 were internal, however the API was affected some widgets reword and refactoring as well.
- **feat(indev) Add crown support to pointer input device** `5057 <https://github.com/lvgl/lvgl/pull/5057>`__
- **feat(test): test bin image loaded to RAM or not** `5895 <https://github.com/lvgl/lvgl/pull/5895>`__
- **feat(script): change trace_filter default trace log file to log_file.systrace** `5900 <https://github.com/lvgl/lvgl/pull/5900>`__
- **feat(vg_lite): automatically select path type based on opa** `5896 <https://github.com/lvgl/lvgl/pull/5896>`__
- **feat(freertos): support Espressif's FreeRTOS flavor** `5862 <https://github.com/lvgl/lvgl/pull/5862>`__
- **feat(tests): add freetype font stress tests** `5828 <https://github.com/lvgl/lvgl/pull/5828>`__
- **feat(vg_lite): add stroke path support** `5831 <https://github.com/lvgl/lvgl/pull/5831>`__
- **feat(docs): add Chinese translation (jump link)** `5839 <https://github.com/lvgl/lvgl/pull/5839>`__
- **feat(ci): update distro to ubuntu 22.02 to fix freetype build problem** `5834 <https://github.com/lvgl/lvgl/pull/5834>`__
- **feat(image_cache): add resize function to image cache** `5829 <https://github.com/lvgl/lvgl/pull/5829>`__
- **feat(nuttx): add cpu idle getter** `5814 <https://github.com/lvgl/lvgl/pull/5814>`__
- **feat(test): add multiple color formats to stride adjust test** `5690 <https://github.com/lvgl/lvgl/pull/5690>`__
- **feat(libjpeg_turbo): add JPEG image EXIF data parsing** `5263 <https://github.com/lvgl/lvgl/pull/5263>`__
- **feat(freetype): change the tilt of freetype fonts in italics** `5812 <https://github.com/lvgl/lvgl/pull/5812>`__
- **feat(vg_lite): add matrix assert** `5766 <https://github.com/lvgl/lvgl/pull/5766>`__
- **feat(vg_lite): add grad cache size config and auto release cache** `5731 <https://github.com/lvgl/lvgl/pull/5731>`__
- **feat(draw_buf): support indexed image in draw_buf_copy** `5686 <https://github.com/lvgl/lvgl/pull/5686>`__
- **feat(nuttx): update display driver** `5752 <https://github.com/lvgl/lvgl/pull/5752>`__
- **feat(fs): implement littlefs lfs.h driver support** `5562 <https://github.com/lvgl/lvgl/pull/5562>`__
- **feat(test_keyboard): add keyboard test** `5739 <https://github.com/lvgl/lvgl/pull/5739>`__
- **feat(x11): add LV_KEYs** `5704 <https://github.com/lvgl/lvgl/pull/5704>`__
- **feat(display): add save screenshot to file support** `5481 <https://github.com/lvgl/lvgl/pull/5481>`__
- **feat(decoder): do not even try cache if 'no_cache' is set** `5688 <https://github.com/lvgl/lvgl/pull/5688>`__
- **feat(event): return event dsc for later to remove** `5630 <https://github.com/lvgl/lvgl/pull/5630>`__
- **feat(keyboard) add Home and End keys mapping** `5675 <https://github.com/lvgl/lvgl/pull/5675>`__
- **feat(draw_buf): distinguish between lv_image_dsc_t and lv_draw_buf_t** `5496 <https://github.com/lvgl/lvgl/pull/5496>`__
- **feat(indev): remove the PRESSED state on scroll** `5660 <https://github.com/lvgl/lvgl/pull/5660>`__
- **feat(sysmon): show max memory usage** `5661 <https://github.com/lvgl/lvgl/pull/5661>`__
- **feat(image_decoder): add stride warning** `5471 <https://github.com/lvgl/lvgl/pull/5471>`__
- **feat(image, layer): add bitmap mask feature** `5545 <https://github.com/lvgl/lvgl/pull/5545>`__
- **feat(draw-sw): add simple Helium acceleration** `5596 <https://github.com/lvgl/lvgl/pull/5596>`__
- **feat(cache): use unified cache entry free callback** `5612 <https://github.com/lvgl/lvgl/pull/5612>`__
- **feat(draw_buf): use draw_buf as parameter of invalidate_cache API** `5602 <https://github.com/lvgl/lvgl/pull/5602>`__
- **feat(script): add ARGB8565 format support** `5593 <https://github.com/lvgl/lvgl/pull/5593>`__
- **feat(vg_lite): add ARGB8565 support** `5592 <https://github.com/lvgl/lvgl/pull/5592>`__
- **feat(vg_lite): add gpu idle flush** `5571 <https://github.com/lvgl/lvgl/pull/5571>`__
- **feat(vg_lite_tvg): add buffer address alignment config** `5576 <https://github.com/lvgl/lvgl/pull/5576>`__
- **feat(vg_lite/vector): add compatible processing for non-scissor support** `5572 <https://github.com/lvgl/lvgl/pull/5572>`__
- **feat(vg_lite): remove support for RGB565A8** `5574 <https://github.com/lvgl/lvgl/pull/5574>`__
- **feat(vg_lite_label): upgrade path quality to HIGH** `5556 <https://github.com/lvgl/lvgl/pull/5556>`__
- **feat(font_glyph_format): refactor draw and font format into `lv_font_glyph_format_t`** `5540 <https://github.com/lvgl/lvgl/pull/5540>`__
- **feat(vg_lite): add index format decode support** `5476 <https://github.com/lvgl/lvgl/pull/5476>`__
- **feat(vector): add API to append arc** `5510 <https://github.com/lvgl/lvgl/pull/5510>`__
- **feat(nuttx_image_cache): add independent image cache heap support** `5528 <https://github.com/lvgl/lvgl/pull/5528>`__
- **feat(cache): refactor cache framework and add new APIs** `5501 <https://github.com/lvgl/lvgl/pull/5501>`__
- **feat(drivers): add libinput/xkb driver** `5486 <https://github.com/lvgl/lvgl/pull/5486>`__
- **feat(draw_buf): misc update** `5498 <https://github.com/lvgl/lvgl/pull/5498>`__
- **feat(draw): add convenience methods for safely getting correct draw descriptor** `5505 <https://github.com/lvgl/lvgl/pull/5505>`__
- **feat(profiler): add multithreading support and testcase** `5490 <https://github.com/lvgl/lvgl/pull/5490>`__
- **feat(doc): Update display-related documentation to new API** `5489 <https://github.com/lvgl/lvgl/pull/5489>`__
- **feat(image_cache): add image header cache drop** `5472 <https://github.com/lvgl/lvgl/pull/5472>`__
- **feat(fbdev): add docs and allow forcing refresh** `5444 <https://github.com/lvgl/lvgl/pull/5444>`__
- **feat(script): add tool to view bin image** `5451 <https://github.com/lvgl/lvgl/pull/5451>`__
- **feat(vg_lite): add profiler instrumentation** `5434 <https://github.com/lvgl/lvgl/pull/5434>`__
- **feat(draw_letter): adapt `lv_font_glyph_format_t` for draw_letter process** `3c1a765 <https://github.com/lvgl/lvgl/commit/3c1a76506e8d948d5c8e029f3467139bdddf7e16>`__
- **feat(color): add color format ARGB8565** `86016a8 <https://github.com/lvgl/lvgl/commit/86016a819a134b2d71777406cfacb3a25d7685cc>`__
Performance
~~~~~~~~~~~
IMPORTANT
---------
- **perf(draw): minor optimization on rgb565 color blending** `5603 <https://github.com/lvgl/lvgl/pull/5603>`__
- **perf(draw): use the simpler layer clear method** `5470 <https://github.com/lvgl/lvgl/pull/5470>`__
- **perf(vg_lite): add asynchronous rendering support** `5398 <https://github.com/lvgl/lvgl/pull/5398>`__
If you are updating a v8 project to v9, special care must be taken as some parts
Fixes
~~~~~
- will not result in compiler error, but LVGL might not work due to related issues
- will result in hard to understand compiler errors
- **fix(obj_tree): fix unintended click triggers on object deletion** `5907 <https://github.com/lvgl/lvgl/pull/5907>`__
- **fix(monkey): add missing include** `5903 <https://github.com/lvgl/lvgl/pull/5903>`__
- **fix(demo/vector_graphic): add missing buffer clear** `5898 <https://github.com/lvgl/lvgl/pull/5898>`__
- **fix(image): fix the image decoder if LV_BIN_DECODER_RAM_LOAD == 0** `5892 <https://github.com/lvgl/lvgl/pull/5892>`__
- **fix(indev): Fix scroll obj cannot be cleared when waiting until release** `5833 <https://github.com/lvgl/lvgl/pull/5833>`__
- **fix(vglite): update NXP's VGLite implementation** `5887 <https://github.com/lvgl/lvgl/pull/5887>`__
- **fix(imagebutton): clipped area of mid part** `5849 <https://github.com/lvgl/lvgl/pull/5849>`__
- **fix(drm): default to XRGB8888 framebuffer** `5851 <https://github.com/lvgl/lvgl/pull/5851>`__
- **fix(vg_lite): fix stroke path memory leak** `5883 <https://github.com/lvgl/lvgl/pull/5883>`__
- **fix(ci): workaround ASAN error in CI with Ubuntu 22.04 image** `5867 <https://github.com/lvgl/lvgl/pull/5867>`__
- **fix(conf): fix typo cause thorvg not enabled** `5837 <https://github.com/lvgl/lvgl/pull/5837>`__
- **fix(indev): always save the last key** `5795 <https://github.com/lvgl/lvgl/pull/5795>`__
- **fix(fsdrv/fatfs): fix does not detect the end of entries in fs_dir_read** `5826 <https://github.com/lvgl/lvgl/pull/5826>`__
- **fix(layer): update the cached layer type on state change** `5801 <https://github.com/lvgl/lvgl/pull/5801>`__
- **fix(file_explorer): fix quick access compiler error** `5783 <https://github.com/lvgl/lvgl/pull/5783>`__
- **fix(msgbox): return the footer in lv_msgbox_get_footer** `5804 <https://github.com/lvgl/lvgl/pull/5804>`__
- **fix(x11): fix assert on delete** `5799 <https://github.com/lvgl/lvgl/pull/5799>`__
- **fix(demo_music): fix the previous button in the music demo is not clickable** `5808 <https://github.com/lvgl/lvgl/pull/5808>`__
- **fix(draw): fix non antialiased rgb565a8 transformation** `5782 <https://github.com/lvgl/lvgl/pull/5782>`__
- **fix(freetpye): fix the problem of incomplete font drawing when setting with italic** `5807 <https://github.com/lvgl/lvgl/pull/5807>`__
- **fix(fsdrv): add missing lv_fs_littlefs_init function declaration** `5778 <https://github.com/lvgl/lvgl/pull/5778>`__
- **fix(vg_lite):fix bug for wrong rendering in vertical or horizontal dir** `5789 <https://github.com/lvgl/lvgl/pull/5789>`__
- **fix(env): added *.cpp glob in ESP configuration** `5761 <https://github.com/lvgl/lvgl/pull/5761>`__
- **fix(draw): fix the invalidation of scaled areas** `5548 <https://github.com/lvgl/lvgl/pull/5548>`__
- **fix(warning): variable set but unused.** `5757 <https://github.com/lvgl/lvgl/pull/5757>`__
- **fix(draw): fix rgb565 with LV_BLEND_MODE_MULTIPLY** `5749 <https://github.com/lvgl/lvgl/pull/5749>`__
- **fix(api_map_v8): add some missing functions** `5710 <https://github.com/lvgl/lvgl/pull/5710>`__
- **fix(refr): fix ARGB8888 buffer clearing in DIRECT mode (#5741)** `5758 <https://github.com/lvgl/lvgl/pull/5758>`__
- **fix(draw_buf): init struct member in order** `5753 <https://github.com/lvgl/lvgl/pull/5753>`__
- **fix(refr): fix clearing the partial buffers in case of ARGB8888 format** `5741 <https://github.com/lvgl/lvgl/pull/5741>`__
- **fix(x11): fix typo** `5742 <https://github.com/lvgl/lvgl/pull/5742>`__
- **fix(draw_vector): check the point length of path in lv_vector_path_get_bounding** `5734 <https://github.com/lvgl/lvgl/pull/5734>`__
- **fix(vg_lite): fix draw layer drawing is incomplete** `5729 <https://github.com/lvgl/lvgl/pull/5729>`__
- **fix(test_span): fix an issue where img has span_1.png, but it is not in the code** `5736 <https://github.com/lvgl/lvgl/pull/5736>`__
- **fix(vg_lite): fix drawing command accumulation** `5730 <https://github.com/lvgl/lvgl/pull/5730>`__
- **fix(vg_lite): fix vector rendering fill dsc matrix not taking effect** `5728 <https://github.com/lvgl/lvgl/pull/5728>`__
- **fix(stdlib): fix issues when using LVGL TLSF memory pool to manage more than 4 GiB of memory** `5720 <https://github.com/lvgl/lvgl/pull/5720>`__
- **fix(vg_lite): remove redundant MOVE_TO operations** `5713 <https://github.com/lvgl/lvgl/pull/5713>`__
- **fix(nuttx): fix compile warning** `5701 <https://github.com/lvgl/lvgl/pull/5701>`__
- **fix(draw_vector): remove redundant MOVE_TO operations** `5715 <https://github.com/lvgl/lvgl/pull/5715>`__
- **fix(draw_buf): use height as loop condition instead of checking data pointers** `5687 <https://github.com/lvgl/lvgl/pull/5687>`__
- **fix(vg_lite): fix the loss of display accuracy of rounded rectangles** `5714 <https://github.com/lvgl/lvgl/pull/5714>`__
- **fix(test): check compiler flag should not contain '_'** `5706 <https://github.com/lvgl/lvgl/pull/5706>`__
- **fix(imagebutton): fix the example** `5719 <https://github.com/lvgl/lvgl/pull/5719>`__
- **fix(drm): eliminate use of non-existent lv_api_map.h and enable smoke tests** `5694 <https://github.com/lvgl/lvgl/pull/5694>`__
- **fix(test): enable -Wpedantic** `5676 <https://github.com/lvgl/lvgl/pull/5676>`__
- **fix(pxp): fix issues in pxp cache management callback** `5685 <https://github.com/lvgl/lvgl/pull/5685>`__
- **fix(windows): improve graphic performance via using high resolution tick count and timer delay implementation** `5711 <https://github.com/lvgl/lvgl/pull/5711>`__
- **fix(windows): improve the document** `5699 <https://github.com/lvgl/lvgl/pull/5699>`__
- **fix(example): fix lv_example_obj_2** `5697 <https://github.com/lvgl/lvgl/pull/5697>`__
- **fix(draw): fix compiler error when LV_DRAW_SW_COMPLEX is disabled** `5695 <https://github.com/lvgl/lvgl/pull/5695>`__
- **fix(test): allow to run test locally on mac** `5672 <https://github.com/lvgl/lvgl/pull/5672>`__
- **fix(sdl): fix buf memleak on lv_display_delete** `5692 <https://github.com/lvgl/lvgl/pull/5692>`__
- **fix(decoder): decoded image should always have same w,h as original image** `5689 <https://github.com/lvgl/lvgl/pull/5689>`__
- **fix(cache): fix warnings** `5671 <https://github.com/lvgl/lvgl/pull/5671>`__
- **fix(dave2d): follow lvgl changes** `5659 <https://github.com/lvgl/lvgl/pull/5659>`__
- **fix(vg_lite): fix typo in decoder_close** `5683 <https://github.com/lvgl/lvgl/pull/5683>`__
- **fix(vg_lite): use float instead of int to avoid type conversion** `5682 <https://github.com/lvgl/lvgl/pull/5682>`__
- **fix(formatting): fix code formatting** `5673 <https://github.com/lvgl/lvgl/pull/5673>`__
- **fix(freetype): fix build break when disable LV_USE_FS_MEMFS** `5651 <https://github.com/lvgl/lvgl/pull/5651>`__
- **fix(array): use memmove instead of memcopy** `5656 <https://github.com/lvgl/lvgl/pull/5656>`__
- **fix(image): fix wrong log level statement** `5655 <https://github.com/lvgl/lvgl/pull/5655>`__
- **fix(tests): fix test_img_emoji_F617.c error include path** `5652 <https://github.com/lvgl/lvgl/pull/5652>`__
- **fix(FreeRTOS): Stacksize calculation** `5647 <https://github.com/lvgl/lvgl/pull/5647>`__
- **fix(benchmark): fix FPS calculation** `5646 <https://github.com/lvgl/lvgl/pull/5646>`__
- **fix(label): consider max-width** `5644 <https://github.com/lvgl/lvgl/pull/5644>`__
- **fix(demo): fix memory leak in vector demo** `5643 <https://github.com/lvgl/lvgl/pull/5643>`__
- **fix(calendar): fix crash when no default is set** `5621 <https://github.com/lvgl/lvgl/pull/5621>`__
- **fix(freetype): fix using memfs to create a FT font** `5627 <https://github.com/lvgl/lvgl/pull/5627>`__
- **fix(indev): fix variable name in preprocessor warning** `5637 <https://github.com/lvgl/lvgl/pull/5637>`__
- **fix(rle): avoid buffer overflow when compressed data is not in pixel unit** `5619 <https://github.com/lvgl/lvgl/pull/5619>`__
- **fix(LVGLImage): use lv_image_dsc_t instead of lv_img_dsc_t** `5629 <https://github.com/lvgl/lvgl/pull/5629>`__
- **fix(vg_lite): fix linear image use after free** `5618 <https://github.com/lvgl/lvgl/pull/5618>`__
- **fix(kconfig): skip lv_conf.h by default** `5617 <https://github.com/lvgl/lvgl/pull/5617>`__
- **fix(image): add data_size filed to all c-array images** `5608 <https://github.com/lvgl/lvgl/pull/5608>`__
- **fix(doc): wrong code for Displays transparency** `5607 <https://github.com/lvgl/lvgl/pull/5607>`__
- **fix(refr): take stride into consideration in partial update mode** `5583 <https://github.com/lvgl/lvgl/pull/5583>`__
- **fix(test): fix typo related to #5559** `5594 <https://github.com/lvgl/lvgl/pull/5594>`__
- **fix(sysmon): fix build error when LV_USE_PERF_MONITOR_LOG_MODE is enabled** `5597 <https://github.com/lvgl/lvgl/pull/5597>`__
- **fix(sdl): use the new draw buffer structure in the layers** `5578 <https://github.com/lvgl/lvgl/pull/5578>`__
- **fix(benchmark): improve the benchmark** `5558 <https://github.com/lvgl/lvgl/pull/5558>`__
- **fix(ffmpeg): add missing stride setting to ffmpeg image** `5580 <https://github.com/lvgl/lvgl/pull/5580>`__
- **fix(sysmon): fix build break** `5585 <https://github.com/lvgl/lvgl/pull/5585>`__
- **fix(tileview): on size change auto. update the pos. of the tiles** `5577 <https://github.com/lvgl/lvgl/pull/5577>`__
- **fix(sdl): fix keyboard handling** `5575 <https://github.com/lvgl/lvgl/pull/5575>`__
- **fix(lv_conf): minor typo fixes in lv_conf_template.h** `5570 <https://github.com/lvgl/lvgl/pull/5570>`__
- **fix(vg_lite): fix arc img not move to arc center** `5554 <https://github.com/lvgl/lvgl/pull/5554>`__
- **fix(vg_lite): add grad image buffer check** `5552 <https://github.com/lvgl/lvgl/pull/5552>`__
- **fix(obj): fix cover change with semi transparent gradients** `5531 <https://github.com/lvgl/lvgl/pull/5531>`__
- **fix(vg_lite): path matrix should use main vector matrix** `5538 <https://github.com/lvgl/lvgl/pull/5538>`__
- **fix(vg_lite): fix LV_RADIUS_CIRCLE not round** `5543 <https://github.com/lvgl/lvgl/pull/5543>`__
- **fix(vg_lite): add config to disable draw shadow** `5534 <https://github.com/lvgl/lvgl/pull/5534>`__
- **fix(neon): update stride from px to bytes** `5526 <https://github.com/lvgl/lvgl/pull/5526>`__
- **fix(script): Remove TRUECOLOR for LVGLImage.py** `5523 <https://github.com/lvgl/lvgl/pull/5523>`__
- **fix(sysmon): support starting LVGL without having a display** `5518 <https://github.com/lvgl/lvgl/pull/5518>`__
- **fix(chart): set the series id correctly** `5482 <https://github.com/lvgl/lvgl/pull/5482>`__
- **fix(vg_lite): fix clip corner image display error** `5517 <https://github.com/lvgl/lvgl/pull/5517>`__
- **fix(arduino): update example LVGL_Arduino.ino for v9** `5499 <https://github.com/lvgl/lvgl/pull/5499>`__
- **fix(fb): set DPI to correctly** `5508 <https://github.com/lvgl/lvgl/pull/5508>`__
- **fix(layer): Update calculation for overlay used memory** `5504 <https://github.com/lvgl/lvgl/pull/5504>`__
- **fix(bin_decoder): fix potential free garbage address** `5509 <https://github.com/lvgl/lvgl/pull/5509>`__
- **fix(decoder): treat ALLOCATED c-array image as draw buffer** `5483 <https://github.com/lvgl/lvgl/pull/5483>`__
- **fix(vg_lite_tvg): fix use after free when change target canvas** `5497 <https://github.com/lvgl/lvgl/pull/5497>`__
- **fix(keyboard): in the example set Arabic font if enabled** `5457 <https://github.com/lvgl/lvgl/pull/5457>`__
- **fix(codespaces): fix the issue where lv_conf.h in codespaces is not enable** `5484 <https://github.com/lvgl/lvgl/pull/5484>`__
- **fix(textarea): fix accepted chars issue on big endian systems** `5479 <https://github.com/lvgl/lvgl/pull/5479>`__
- **fix(draw_line): fix the issue where dash_dap equals 1 and cannot display properly when the line is a horizontal line** `5473 <https://github.com/lvgl/lvgl/pull/5473>`__
- **fix: removed LV_ATTRIBUTE_FAST_MEM function attribute from prototypes** `5467 <https://github.com/lvgl/lvgl/pull/5467>`__
- **fix(arm2d): apply a temporary patch to arm-2d acceleration** `5466 <https://github.com/lvgl/lvgl/pull/5466>`__
- **fix(snapshot): update the layout of the component before the screenshot** `5475 <https://github.com/lvgl/lvgl/pull/5475>`__
- **fix(vg_lite): add missing 24bit color support check** `5469 <https://github.com/lvgl/lvgl/pull/5469>`__
- **fix(display): set last_activity_time to the current time in lv_display** `5463 <https://github.com/lvgl/lvgl/pull/5463>`__
- **fix(observer): fixed lv_subject_remove_all_obj** `5464 <https://github.com/lvgl/lvgl/pull/5464>`__
- **fix(image_decoder): fix decoder not close** `5437 <https://github.com/lvgl/lvgl/pull/5437>`__
- **fix(nuttx): fix build break** `5440 <https://github.com/lvgl/lvgl/pull/5440>`__
- **fix: fix warnings with -flto on GCC 11** `5433 <https://github.com/lvgl/lvgl/pull/5433>`__
- **fix(assert): add new macro to format assert message** `5453 <https://github.com/lvgl/lvgl/pull/5453>`__
- **fix(decoder): if draw unit supports indexed image, don't add to cache** `5438 <https://github.com/lvgl/lvgl/pull/5438>`__
- **fix(bar): mask the background to fix it on value adjustment** `5426 <https://github.com/lvgl/lvgl/pull/5426>`__
- **fix(lvgl.mk): fix vg_lite_tvg.cpp not compiling** `5435 <https://github.com/lvgl/lvgl/pull/5435>`__
- **fix(ci): use the dev branch of PlatformIO** `5432 <https://github.com/lvgl/lvgl/pull/5432>`__
- **fix(vector) : add path bounding and matrix transform functions.** `5389 <https://github.com/lvgl/lvgl/pull/5389>`__
- **fix(warning): fix shadown variable warning** `47750f1 <https://github.com/lvgl/lvgl/commit/47750f1b866e5ea0617035fd208c727878bebc44>`__
- **fix(thorvg): link lvgl_thorvgl with lvgl** `9b09182 <https://github.com/lvgl/lvgl/commit/9b09182fc76032ef0bc8a2d930fa1cf4fd081431>`__
- **fix(warning): error: no newline at end of file** `9a6a194 <https://github.com/lvgl/lvgl/commit/9a6a194680db9ea12f59e94eab6e812cb28d504f>`__
- **fix(color): treat RGB565A8 bpp same as RGB565** `52426ec <https://github.com/lvgl/lvgl/commit/52426ec1919274e282889129f00e00a9a2a9ce60>`__
- **fix(warning): error: a function declaration without a prototype is deprecated in all versions of C** `c81f654 <https://github.com/lvgl/lvgl/commit/c81f654026501ba37d8df2d8ec02c58bd14eb1c3>`__
So pay extra attention to these:
Examples
~~~~~~~~
- :cpp:func:`lv_display_set_buffers(display, buf1, buf2, buf_size_byte, mode)` is more or less the equivalent of ``lv_disp_draw_buf_init(&draw_buf_dsc, buf1, buf2, buf_size_px)`` from v8, however in **v9 the buffer size is set in bytes**.
- In v9 ``lv_color_t`` is always RGB888 regardless of ``LV_COLOR_DEPTH``.
- ``lv_conf.h`` has been changed a lot, so don't forget to update it from ``lv_conf_template.h``
- Be sure ``<stdint.h>`` is **not** included in ``lv_conf.h``. In v9 we have some assembly parts for even better performance and a random include there would mess up the assembly part.
- The online image converter in not updated yet. Until that use `LVGLImage.py <https://github.com/lvgl/lvgl/blob/master/scripts/LVGLImage.py>`__ .
- Run time dithering is rendering due its complexity and lack of GPU support. Smaller dithered and tiled images can be used as background images as a replacement.
- STM32's DMA2D (Chrom-ART) support is removed for now. It will be added again when an official partnership starts with ST too.
- SJPG was removed as the original TJPGD support decoding tile-by-tile. (typically a tile is 8x8 pixels)
- ``LV_COLOR_DEPTH 8`` is not supported yet. In v8 it meant RGB332, in v9 it will be used for L8.
Docs
~~~~
Main new features
-----------------
- **docs: update README** `5841 <https://github.com/lvgl/lvgl/pull/5841>`__
- **docs: make it easy to add more other translations** `5874 <https://github.com/lvgl/lvgl/pull/5874>`__
- **docs: ignore the READMEs when building the docs** `5840 <https://github.com/lvgl/lvgl/pull/5840>`__
- **docs(st7789): updated the docs + added code example and step-by-step guide for STM32** `5511 <https://github.com/lvgl/lvgl/pull/5511>`__
- **docs(arduino): update tick setup** `5832 <https://github.com/lvgl/lvgl/pull/5832>`__
- **docs(display): use lv_display_delete_refr_timer to delete display timer** `5835 <https://github.com/lvgl/lvgl/pull/5835>`__
- **docs(lv_conf): show how to include something in lv_conf.h** `5740 <https://github.com/lvgl/lvgl/pull/5740>`__
- **docs(tick): simplify and promote lv_tick_set_cb** `5781 <https://github.com/lvgl/lvgl/pull/5781>`__
- **docs(style): output the style properties to style-props.rst** `5802 <https://github.com/lvgl/lvgl/pull/5802>`__
- **docs(changelog): mention that LV_COLOR_DEPTH 8 is not supported yet** `5796 <https://github.com/lvgl/lvgl/pull/5796>`__
- **docs(image): update align to inner_align** `5721 <https://github.com/lvgl/lvgl/pull/5721>`__
- **docs(README_Zh): remove mentions of SquareLine Studio** `5640 <https://github.com/lvgl/lvgl/pull/5640>`__
- **docs(profiler): fix my_get_cpu_cb implementation** `5641 <https://github.com/lvgl/lvgl/pull/5641>`__
- **docs(demos): remove inconsistent READMEs** `5626 <https://github.com/lvgl/lvgl/pull/5626>`__
- **docs(README): remove mentions of SquareLine Studio** `5638 <https://github.com/lvgl/lvgl/pull/5638>`__
- **docs(changelog): mention more features removed in v9** `5632 <https://github.com/lvgl/lvgl/pull/5632>`__
- **docs(micropython): update MicroPython examples in documentation** `5622 <https://github.com/lvgl/lvgl/pull/5622>`__
- **docs(contributing): fix links** `5615 <https://github.com/lvgl/lvgl/pull/5615>`__
- **docs(porting): add missing colon in porting docs** `5613 <https://github.com/lvgl/lvgl/pull/5613>`__
- **docs(contributing): update the feature development workflow** `5601 <https://github.com/lvgl/lvgl/pull/5601>`__
- **docs(tabview): fix tabview doc** `5588 <https://github.com/lvgl/lvgl/pull/5588>`__
- **docs(indev): Document the relation between LV_INDEV_MODE_EVENT and data-&gt;continue_reading** `5586 <https://github.com/lvgl/lvgl/pull/5586>`__
- **docs(pc-simulator): Document how to set up SDL manually, without IDE** `5563 <https://github.com/lvgl/lvgl/pull/5563>`__
- **docs(disp): document lv_refr_now** `5480 <https://github.com/lvgl/lvgl/pull/5480>`__
- **docs(disp): Fix pointer cast in flush_cb example** `5439 <https://github.com/lvgl/lvgl/pull/5439>`__
- **docs(font): about "base dir"** `5429 <https://github.com/lvgl/lvgl/pull/5429>`__
- Run time display color format adjustment with RGB888 support
- Built-in support ``pthread``, ``FreeRTOS`` and other (RT)OSes which are used during rendering
- Built-in support LVGL's, C library, and other ``stdlib``s
- Better parallel rendering architecture. See the details :ref:`here <porting_draw>`
- Built in display and touch driver: SDL, Linux Frame buffer, NuttX LCD and touch drivers, ST7789 and ILI9341 driver are available and more will come soon
- :ref:`observer` allows to bind data to UI elements and create a uniform and easy to maintain API
- GitHub CodeSpace integration makes possible to run LVGL in an Online VSCode editor with 3 click. See more `here <https://blog.lvgl.io/2023-04-13/monthly-newsletter>`__
- Add vector graphics support via ThorVG. It can be used to draw vector graphics to a `Canvas <https://github.com/lvgl/lvgl/blob/master/examples/widgets/canvas/lv_example_canvas_8.c>`__
- :ref:`lv_image` supports aligning, stretching or tiling the image source if the widget is larger or smaller.
CI and tests
~~~~~~~~~~~~
General API changes
-------------------
Although `lv_api_map.h <https://github.com/lvgl/lvgl/blob/master/src/lv_api_map.h>`__ address most of the refactoring we encourage you to use the latest API directly.
- ``lv_disp_...`` is renamed to ``lv_display_...``
- ``btn_...`` is renamed to ``button_...``
- ``btnmatrix_...`` is renamed to ``buttonmatrix_...``
- ``img_...`` is renamed to ``image_...``
- ``zoom`` is renamed to ``scale``
- ``angle`` is renamed to ``rotation``
- ``scr`` is renamed to ``screen``
- ``act`` is renamed to ``active``
- ``del`` is renamed to ``delete``
- ``col`` is renamed to ``column``
- ``lv_obj_clear_flag`` is renamed to ``lv_obj_remove_flag``
- ``lv_obj_clear_state`` is renamed to ``lv_obj_remove_state``
- ``lv_coord_t`` was removed and replaced by ``int32_t``
New color format management
---------------------------
- ``LV_IMG_CF_...`` was replaced by ``LV_COLOR_FORMAT_...``
- ``LV_COLOR_DEPTH 24`` is supported for RGB888 rendering
- ``lv_color_t`` always means RGB888
Display API
-----------
- ``lv_disp_drv_t`` and ``lv_disp_draw_buf_t`` was removed
- To create a display and set it up:
.. code:: c
lv_display_t * disp = lv_display_create(hor_res, ver_res)
lv_display_set_flush_cb(disp, flush_cb);
lv_display_set_buffers(disp, buf1, buf2, buf_size_in_bytes, mode);
- Note that now **buf size is in bytes and not pixels**
- ``mode`` can be:
- ``LV_DISPLAY_RENDER_MODE_PARTIAL`` This way the buffers can be
smaller then the display to save RAM. At least 1/10 screen sized
buffer(s) are recommended.
- ``LV_DISPLAY_RENDER_MODE_DIRECT`` The buffer(s) has to be screen
sized and LVGL will render into the correct location of the
buffer. This way the buffer always contain the whole image. With 2
buffers the buffers content are kept in sync automatically. (Old
v7 behavior)
- ``LV_DISPLAY_RENDER_MODE_FULL`` Just always redraw the whole
screen. With 2 buffers is a standard double buffering.
- Similarly to the widgets, now you can attach events to the display
too, using ``lv_display_add_event()``
- ``monitor_cb`` is removed and ``LV_EVENT_RENDER_READY`` event is
fired instead
- Instead of having display background color and image,
``lv_layer_bottom()`` is added where any color can be set or any
widget can be created.
- The target color format can be adjusted in the display in runtime by calling
``lv_display_set_color_format(disp, LV_COLOR_FORMAT_...)``
- ``LV_COLOR_16_SWAP`` is removed and ``lv_draw_sw_rgb565_swap()`` can be called manually
in the ``flush_cb`` if needed to swap the in-place.
- ``disp_drv.scr_transp`` was removed and
``lv_display_set_color_format(disp, LV_COLOR_FORMAT_NATIVE_ALPHA)``
can be used instead
- ``set_px_cb`` is removed. You can can convert the rendered image in the ``flush_cb``.
- For more details check out the docs
`here /porting/display>`__ and
`here /overview/display>`__.
Indev API
---------
- Similarly to the display ``lv_indev_drv_t`` was removed and an input
device can be created like this:
- Similarly to the widgets, now you can attach events to the indevs
too, using ``lv_indev_add_event()``
- The ``feedback_cb`` was removed, instead ``LV_EVENT_PRESSED/CLICKED/etc``
events are sent to the input device
.. code:: c
lv_indev_t * indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_...);
lv_indev_set_read_cb(indev, read_cb);
- **test(conf): update conf and remove deprecated configs** `5881 <https://github.com/lvgl/lvgl/pull/5881>`__
- **tests(freetype): refactor code structure** `5871 <https://github.com/lvgl/lvgl/pull/5871>`__
- **ci(micropython): catch event failure in the test** `5787 <https://github.com/lvgl/lvgl/pull/5787>`__
- **ci(ref_imgs): automatically generate the missing reference image folders** `5696 <https://github.com/lvgl/lvgl/pull/5696>`__
- **ci(assets): add LV_BUILD_TEST guard** `5616 <https://github.com/lvgl/lvgl/pull/5616>`__
- **ci(codecov): disable CodeCov** `5623 <https://github.com/lvgl/lvgl/pull/5623>`__
- **test(asset): add guard to test_img_emoji_F617** `5559 <https://github.com/lvgl/lvgl/pull/5559>`__
- **ci(micropython): use the master branch** `5460 <https://github.com/lvgl/lvgl/pull/5460>`__
- **test(snapshot): add testcase for #5475** `5478 <https://github.com/lvgl/lvgl/pull/5478>`__
Others
~~~~~~
- ``lv_msg`` is removed and replaced by
`lv_observer <https://docs.lvgl.io/master/others/observer.html>`__
- ``lv_chart`` ticks support was removed,
`lv_scale <https://docs.lvgl.io/master/widgets/scale.html>`__ can be
used instead
- ``lv_msgbox`` is update to be more flexible. It uses normal button instead of button matrix
- ``lv_tabview`` was updated to user real button instead of a button matrix
- **chore(cmsis-pack): prepare for v9.1.0** `5917 <https://github.com/lvgl/lvgl/pull/5917>`__
- **chore: fix header files include recursion** `5844 <https://github.com/lvgl/lvgl/pull/5844>`__
- **chore(group): avoid null pointer access** `5863 <https://github.com/lvgl/lvgl/pull/5863>`__
- **refactor(conf): rename LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE to LV_DRAW_LAYER_SIMPLE_BUF_SIZE** `5798 <https://github.com/lvgl/lvgl/pull/5798>`__
- **chore(freetype): remove unused codes** `5885 <https://github.com/lvgl/lvgl/pull/5885>`__
- **chore: fix compile time warnings** `5872 <https://github.com/lvgl/lvgl/pull/5872>`__
- **adds `extern "C"` to the header files that were missing it.** `5857 <https://github.com/lvgl/lvgl/pull/5857>`__
- **chore(stdlib): remove duplicate function declaration** `5845 <https://github.com/lvgl/lvgl/pull/5845>`__
- **chore(benchmark): add warning for probably low memory** `5797 <https://github.com/lvgl/lvgl/pull/5797>`__
- **chore(group): add assertion to avoid null pointer access** `5769 <https://github.com/lvgl/lvgl/pull/5769>`__
- **refact(Kconfig): update as per lv_conf_template.h** `5780 <https://github.com/lvgl/lvgl/pull/5780>`__
- **Fix the compilation error problem of lvgl9.x on rtthread** `5794 <https://github.com/lvgl/lvgl/pull/5794>`__
- **refact(vg_lite): abstract common pending release logic** `5756 <https://github.com/lvgl/lvgl/pull/5756>`__
- **doc(stm32): fix typo** `5772 <https://github.com/lvgl/lvgl/pull/5772>`__
- **doc(cache): add doc strings for cache APIs** `5718 <https://github.com/lvgl/lvgl/pull/5718>`__
- **chore(docs): fix typo** `5738 <https://github.com/lvgl/lvgl/pull/5738>`__
- **chore(font): remove unused defines** `5716 <https://github.com/lvgl/lvgl/pull/5716>`__
- **chore: add stride information in the image resource file** `5653 <https://github.com/lvgl/lvgl/pull/5653>`__
- **chore(draw_buf): remove unnecessary info logs** `5634 <https://github.com/lvgl/lvgl/pull/5634>`__
- **chore(cmsis-pack): catchup update** `5611 <https://github.com/lvgl/lvgl/pull/5611>`__
- **More chore work in indev files** `5604 <https://github.com/lvgl/lvgl/pull/5604>`__
- **Stride adjust in place** `5423 <https://github.com/lvgl/lvgl/pull/5423>`__
- **chore(conf): use EXTERNAL and INTERNAL macro to config libs** `5046 <https://github.com/lvgl/lvgl/pull/5046>`__
- **chore(vg_lite): use pointer to access matrix element** `5591 <https://github.com/lvgl/lvgl/pull/5591>`__
- **refactor(image): rename align to inner_align** `5560 <https://github.com/lvgl/lvgl/pull/5560>`__
- **chore(deps): bump codecov/codecov-action from 3 to 4** `5567 <https://github.com/lvgl/lvgl/pull/5567>`__
- **chore(deps): bump carlosperate/arm-none-eabi-gcc-action from 1.8.0 to 1.8.1** `5565 <https://github.com/lvgl/lvgl/pull/5565>`__
- **chore(deps): bump mymindstorm/setup-emsdk from 13 to 14** `5566 <https://github.com/lvgl/lvgl/pull/5566>`__
- **chore(deps): bump actions/cache from 3 to 4** `5568 <https://github.com/lvgl/lvgl/pull/5568>`__
- **chore(deps): bump uraimo/run-on-arch-action from 2.6.0 to 2.7.1** `5569 <https://github.com/lvgl/lvgl/pull/5569>`__
- **optionally install demos and libs as well** `5387 <https://github.com/lvgl/lvgl/pull/5387>`__
- **chore(arc): fix typo** `5553 <https://github.com/lvgl/lvgl/pull/5553>`__
- **Revert "feat(font_glyph_format): refactor draw and font format into `lv_font_glyph_format_t`"** `5550 <https://github.com/lvgl/lvgl/pull/5550>`__
- **chore(thorvg): fix warning** `5535 <https://github.com/lvgl/lvgl/pull/5535>`__
- **refactor(snapshot): use draw buffer interface** `5487 <https://github.com/lvgl/lvgl/pull/5487>`__
- **chore(vg_lite): fix typo** `5525 <https://github.com/lvgl/lvgl/pull/5525>`__
- **demo(music): add png assets** `5520 <https://github.com/lvgl/lvgl/pull/5520>`__
- **chore(indev): Cleanup before working in double and triple click support** `5512 <https://github.com/lvgl/lvgl/pull/5512>`__
- **chore(demos): Remove unused definitions** `5506 <https://github.com/lvgl/lvgl/pull/5506>`__
- **chore(obj_draw): remove duplicate invalidate** `5503 <https://github.com/lvgl/lvgl/pull/5503>`__
- **chore(widgets): add parentheses to MY_CLASS definition** `5485 <https://github.com/lvgl/lvgl/pull/5485>`__
- **chore(draw-sw-transform): remove duplicated code** `5488 <https://github.com/lvgl/lvgl/pull/5488>`__
- **chore(README): Fixed #5491 Typo** `5492 <https://github.com/lvgl/lvgl/pull/5492>`__
- **chore(vg_lite): remove 64-bytes alignment requirement** `5477 <https://github.com/lvgl/lvgl/pull/5477>`__
- **chore(refr): fix typo** `5474 <https://github.com/lvgl/lvgl/pull/5474>`__
- **chore(array): use array_front and use it like an array** `5448 <https://github.com/lvgl/lvgl/pull/5448>`__
- **chore(cache): only cache header info for file type of image** `5455 <https://github.com/lvgl/lvgl/pull/5455>`__
- **refactor(indev_scroll): refactor code** `5456 <https://github.com/lvgl/lvgl/pull/5456>`__
- **chore(draw_buf): add header magic to draw buff** `5449 <https://github.com/lvgl/lvgl/pull/5449>`__
- **chore(Kconfig): add missing profiler trace buffer size config** `5436 <https://github.com/lvgl/lvgl/pull/5436>`__
- **chore(libpng): fix warning** `5431 <https://github.com/lvgl/lvgl/pull/5431>`__
Others
~~~~~~
v8.3
~~~~
- **refactor(freetype): refactor freetype params** `0c84cc0 <https://github.com/lvgl/lvgl/commit/0c84cc0b3b9b1ea37bd6aa5300e91eee0f2feb98>`__
- **refactor(freetype): refactor glyph_index acquire method** `0b3016c <https://github.com/lvgl/lvgl/commit/0b3016c0e5b5d57141220c030c0aadd9d9c3387e>`__
- **chore(README): Fixed #5491 Typo (#5492)** `9c025d3 <https://github.com/lvgl/lvgl/commit/9c025d357f358c281db441a96a27ce2a01434a8d>`__
For Other v8.3.x releases visit the `Changelog in the release/v8.3 branch <https://github.com/lvgl/lvgl/blob/release/v8.3/docs/CHANGELOG.md>`__ .
v9.0
----
For Other v9.0.x releases visit the `Changelog in the release/v9.0 branch <https://github.com/lvgl/lvgl/blob/release/v9.0/docs/CHANGELOG.rst>`__ .

View File

@@ -0,0 +1,22 @@
.. _arduino_esp_littlefs:
====================
Arduino ESP littlefs
====================
LittleFS is a little fail-safe filesystem designed for microcontrollers and integrated in the Arduino framework
when used with ESP32 and ESP8266.
Detailed introduction:
- https://github.com/esp8266/Arduino
- https://github.com/espressif/arduino-esp32
Usage
-----
Enable :c:macro:`LV_USE_FS_ARDUINO_ESP_LITTLEFS` and define a :c:macro`LV_FS_ARDUINO_ESP_LITTLEFS_LETTER` in ``lv_conf.h``.
API
---

View File

@@ -15,6 +15,7 @@ LVG has built in support for:
- WIN32 (Windows using Win32 API function .e.g ``CreateFileA``, ``ReadFile``)
- MEMFS (read a file from a memory buffer)
- LITTLEFS (a little fail-safe filesystem designed for microcontrollers)
- Arduino ESP LITTLEFS (a little fail-safe filesystem designed for Arduino ESP)
You still need to provide the drivers and libraries, this extension
provides only the bridge between FATFS, STDIO, POSIX, WIN32 and LVGL.

View File

@@ -22,4 +22,5 @@
rlottie
ffmpeg
rle
arduino_esp_littlefs
lfs

View File

@@ -152,6 +152,17 @@ reconfiguring the hardware. In lack of hardware display rotation support
:cpp:expr:`lv_draw_sw_rotate` can be used to rotate the buffer in the
``flush_cb``.
:cpp:expr:`lv_display_rotate_area(display, &area)` rotates the rendered area
according to the current rotation settings of the display.
Note that in :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_DIRECT` the small changed areas
are rendered directly in the frame buffer so they cannot be
rotated later. Therefore in direct mode only the whole frame buffer can be rotated.
The same is true for :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_FULL`.
In the case of :cpp:enumerator:`LV_DISPLAY_RENDER_MODE_PARTIAL`the small rendered areas
can be rotated on their own before flushing to the frame buffer.
Color format
------------

View File

@@ -184,10 +184,15 @@
* but does not guarantee the same rendering quality as the software. */
#define LV_VG_LITE_USE_BOX_SHADOW 0
/* VG-Lite gradient image maximum cache number.
/* VG-Lite linear gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_GRAD_CACHE_SIZE 32
#define LV_VG_LITE_LINEAER_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.
*/
#define LV_VG_LITE_RADIAL_GRAD_CACHE_CNT 32
#endif

View File

@@ -1,5 +1,6 @@
#include "../../lv_examples.h"
#if LV_USE_QRCODE && LV_BUILD_EXAMPLES
#include <string.h>
/**
* Create a QR Code

View File

@@ -59,7 +59,7 @@ static lv_subject_t auth_state_subject;
static void textarea_event_cb(lv_event_t * e)
{
lv_obj_t * ta = lv_event_get_target(e);
if(strcmp(lv_textarea_get_text(ta), "hello") == 0) {
if(lv_strcmp(lv_textarea_get_text(ta), "hello") == 0) {
lv_subject_set_int(&auth_state_subject, LOGGED_IN);
}
else {

View File

@@ -14,8 +14,8 @@ static void btnm_event_handler(lv_event_t * e)
lv_obj_t * ta = lv_event_get_user_data(e);
const char * txt = lv_buttonmatrix_get_button_text(obj, lv_buttonmatrix_get_selected_button(obj));
if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_delete_char(ta);
else if(strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_obj_send_event(ta, LV_EVENT_READY, NULL);
if(lv_strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) lv_textarea_delete_char(ta);
else if(lv_strcmp(txt, LV_SYMBOL_NEW_LINE) == 0) lv_obj_send_event(ta, LV_EVENT_READY, NULL);
else lv_textarea_add_text(ta, txt);
}

View File

@@ -44,6 +44,12 @@
#define LV_USE_STDLIB_STRING LV_STDLIB_BUILTIN
#define LV_USE_STDLIB_SPRINTF LV_STDLIB_BUILTIN
#define LV_STDINT_INCLUDE <stdint.h>
#define LV_STDDEF_INCLUDE <stddef.h>
#define LV_STDBOOL_INCLUDE <stdbool.h>
#define LV_INTTYPES_INCLUDE <inttypes.h>
#define LV_LIMITS_INCLUDE <limits.h>
#define LV_STDARG_INCLUDE <stdarg.h>
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
@@ -192,10 +198,15 @@
* but does not guarantee the same rendering quality as the software. */
#define LV_VG_LITE_USE_BOX_SHADOW 0
/* VG-Lite gradient image maximum cache number.
/* VG-Lite linear gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#define LV_VG_LITE_GRAD_CACHE_SIZE 32
#define LV_VG_LITE_LINEAER_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.
*/
#define LV_VG_LITE_RADIAL_GRAD_CACHE_CNT 32
#endif
@@ -657,6 +668,12 @@
#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. */
#define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0
#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
/*LODEPNG decoder library*/
#define LV_USE_LODEPNG 0

View File

@@ -6,144 +6,117 @@
~~~~~~~~~~~~~~~~
{{#commit-list merges heading='' message='BREAKING CHANGE'}}
- .. warning: {{message}}
`{{id}} <{{href}}>`__
- .. warning: {{message}} `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='BREAKING CHANGE'}}
- .. warning: {{subject}}
`{{shorthash}} <{{href}}>`__
- .. warning: {{subject}} `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='BREAKING CHANGE'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
Architectural
~~~~~~~~~~~~~
{{#commit-list merges heading='' message='^arch' exclude='BREAKING CHANGE'}}
- **{{message}}**
`{{id}} <{{href}}>`__
- **{{message}}** `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='^arch' exclude='BREAKING CHANGE'}}
- **{{subject}}**
`{{shorthash}} <{{href}}>`__
- **{{subject}}** `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='^arch' exclude='BREAKING CHANGE'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
New Features
~~~~~~~~~~~~
{{#commit-list merges heading='' message='^feat' exclude='BREAKING CHANGE'}}
- **{{message}}**
`{{id}} <{{href}}>`__
- **{{message}}** `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='^feat' exclude='BREAKING CHANGE'}}
- **{{subject}}**
`{{shorthash}} <{{href}}>`__
- **{{subject}}** `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='^feat' exclude='BREAKING CHANGE'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
Performance
~~~~~~~~~~~
{{#commit-list merges heading='' message='^perf' exclude='BREAKING CHANGE'}}
- **{{message}}**
`{{id}} <{{href}}>`__
- **{{message}}** `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='^perf' exclude='BREAKING CHANGE'}}
- **{{subject}}**
`{{shorthash}} <{{href}}>`__
- **{{subject}}** `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='^perf' exclude='BREAKING CHANGE'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
Fixes
~~~~~
{{#commit-list merges heading='' message='^fix' exclude='(^fix conflict|^fix warning|BREAKING CHANGE)'}}
- **{{message}}**
`{{id}} <{{href}}>`__
- **{{message}}** `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='^fix' exclude='(^fix conflict|^fix warning|BREAKING CHANGE)'}}
- **{{subject}}**
`{{shorthash}} <{{href}}>`__
- **{{subject}}** `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='^fix' exclude='(^fix conflict|^fix warning|BREAKING CHANGE)'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
Examples
~~~~~~~~
{{#commit-list merges heading='' message='^example'}}
- **{{message}}**
`{{id}} <({{href}})>`__
- **{{message}}** `{{id}} <({{href}})>`__
{{/commit-list}}
{{#commit-list commits heading='' message='^example'}}
- **{{subject}}**
`{{shorthash}} <{{href}}>`__
- **{{subject}}** `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='^example'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
Docs
~~~~
{{#commit-list merges heading='' message='^docs'}}
- **{{message}}**
`{{id}} <{{href}}>`__
- **{{message}}** `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='^docs'}}
- **{{subject}}**
`{{shorthash}} <{{href}}>`__
- **{{subject}}** `{{shorthash}} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='^docs'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
CI and tests
~~~~~~~~~~~~
{{#commit-list merges heading='' message='(^ci|^test)'}}
- **{{message}}**
`{{id}} <{{href}}>`__
- **{{message}}** `{{id}} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' message='(^ci|^test)'}}
- **{{subject}}**
`{{shorthash }} <{{href}}>`__
- **{{subject}}** `{{shorthash }} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' message='(^ci|^test)'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
Others
~~~~~~
{{#commit-list merges heading='' exclude='(^fix|^feat|^perf|^docs|^example|^ci|^test)'}}
- **{{message}}**
`{{id }} <{{href}}>`__
- **{{message}}** `{{id }} <{{href}}>`__
{{/commit-list}}
{{#commit-list commits heading='' exclude='(^fix|^feat|^perf|^docs|^example|^ci|^test)'}}
- **{{subject}}**
`{{shorthash }} <{{href}}>`__
- **{{subject}}** `{{shorthash }} <{{href}}>`__
{{/commit-list}}
{{#commit-list fixes heading='' exclude='(^fix|^feat|^perf|^docs|^example|^ci|^test)'}}
- **{{commit.subject}}**
`{{commit.shorthash}} <{{commit.href}}>`__
- **{{commit.subject}}** `{{commit.shorthash}} <{{commit.href}}>`__
{{/commit-list}}
{{/each}}

View File

@@ -189,6 +189,11 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#define LV_LOG_TRACE_ANIM 0
#endif /*LV_USE_LOG*/
#if LV_USE_SYSMON == 0
#define LV_USE_PERF_MONITOR 0
#define LV_USE_MEM_MONITOR 0
#endif /*LV_USE_SYSMON*/
#ifndef LV_USE_LZ4
#define LV_USE_LZ4 (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL)
#endif

View File

@@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h"
#if LV_USE_DRAW_SW
@@ -39,6 +37,8 @@ extern "C" {
#include "../tick/lv_tick.h"
#include "../layouts/lv_layout.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES
*********************/
@@ -163,6 +163,10 @@ typedef struct _lv_global_t {
lv_fs_drv_t littlefs_fs_drv;
#endif
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
lv_fs_drv_t arduino_esp_littlefs_fs_drv;
#endif
#if LV_USE_FREETYPE
struct _lv_freetype_context_t * ft_context;
#endif
@@ -187,11 +191,11 @@ typedef struct _lv_global_t {
lv_style_t fe_list_button_style;
#endif
#if LV_USE_SYSMON && LV_USE_PERF_MONITOR
#if LV_USE_PERF_MONITOR
lv_sysmon_backend_data_t sysmon_perf;
#endif
#if LV_USE_SYSMON && LV_USE_MEM_MONITOR
#if LV_USE_MEM_MONITOR
lv_sysmon_backend_data_t sysmon_mem;
#endif

View File

@@ -6,12 +6,11 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_group.h"
#include "../core/lv_obj.h"
#include "../core/lv_global.h"
#include "../indev/lv_indev.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -13,11 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_ll.h"

View File

@@ -17,10 +17,9 @@
#include "../misc/lv_assert.h"
#include "../misc/lv_math.h"
#include "../misc/lv_log.h"
#include "../misc/lv_types.h"
#include "../tick/lv_tick.h"
#include "../stdlib/lv_string.h"
#include <stdint.h>
#include <string.h>
/*********************
* DEFINES

View File

@@ -15,8 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_style.h"
#include "../misc/lv_area.h"

View File

@@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_area.h"
#include "lv_obj_property.h"

View File

@@ -13,7 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_event.h"
#include "../indev/lv_indev.h"

View File

@@ -13,10 +13,9 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../misc/lv_bidi.h"
#include "../misc/lv_style.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -6,8 +6,6 @@
/*********************
* INCLUDES
*********************/
#include <stdlib.h>
#include "lv_obj.h"
#include "../indev/lv_indev.h"
#include "../indev/lv_indev_private.h"

View File

@@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "../misc/lv_anim.h"
#include "../display/lv_display.h"

View File

@@ -6,7 +6,6 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_refr.h"
#include "../display/lv_display.h"
#include "../display/lv_display_private.h"
@@ -14,6 +13,7 @@
#include "../misc/lv_timer.h"
#include "../misc/lv_math.h"
#include "../misc/lv_profiler.h"
#include "../misc/lv_types.h"
#include "../draw/lv_draw.h"
#include "../font/lv_font_fmt_txt.h"
#include "../stdlib/lv_string.h"
@@ -331,7 +331,7 @@ void _lv_display_refr_timer(lv_timer_t * tmr)
/* Ensure the timer does not run again automatically.
* This is done before refreshing in case refreshing invalidates something else.
* However if the performance monitor is enabled keep the timer running to count the FPS.*/
#if !(defined(LV_USE_PERF_MONITOR) && LV_USE_PERF_MONITOR)
#if LV_USE_PERF_MONITOR
lv_timer_pause(tmr);
#endif
}

View File

@@ -15,7 +15,7 @@ extern "C" {
*********************/
#include "lv_obj.h"
#include "../display/lv_display.h"
#include <stdbool.h>
#include "../misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -13,6 +13,7 @@
#include "../stdlib/lv_string.h"
#include "../themes/lv_theme.h"
#include "../core/lv_global.h"
#include "../others/sysmon/lv_sysmon.h"
#if LV_USE_DRAW_SW
#include "../draw/sw/lv_draw_sw.h"
@@ -139,6 +140,14 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res)
lv_timer_ready(disp->refr_timer); /*Be sure the screen will be refreshed immediately on start up*/
#if LV_USE_PERF_MONITOR
lv_sysmon_show_performance(disp);
#endif
#if LV_USE_MEM_MONITOR
lv_sysmon_show_memory(disp);
#endif
return disp;
}
@@ -924,6 +933,37 @@ lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp)
return disp->buf_act;
}
void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area)
{
lv_display_rotation_t rotation = lv_display_get_rotation(disp);
int32_t w = lv_area_get_width(area);
int32_t h = lv_area_get_height(area);
switch(rotation) {
case LV_DISPLAY_ROTATION_0:
return;
case LV_DISPLAY_ROTATION_90:
area->y2 = disp->ver_res - area->x1 - 1;
area->x1 = area->y1;
area->x2 = area->x1 + h - 1;
area->y1 = area->y2 - w + 1;
break;
case LV_DISPLAY_ROTATION_180:
area->y2 = disp->ver_res - area->y1 - 1;
area->y1 = area->y2 - h + 1;
area->x2 = disp->hor_res - area->x1 - 1;
area->x1 = area->x2 - w + 1;
break;
case LV_DISPLAY_ROTATION_270:
area->x1 = disp->hor_res - area->y2 - 1;
area->y2 = area->x2;
area->x2 = area->x1 + h - 1;
area->y1 = area->y2 - w + 1;
break;
}
}
/**********************
* STATIC FUNCTIONS
**********************/

View File

@@ -536,6 +536,13 @@ void * lv_display_get_user_data(lv_display_t * disp);
void * lv_display_get_driver_data(lv_display_t * disp);
lv_draw_buf_t * lv_display_get_buf_active(lv_display_t * disp);
/**
* Rotate an area in-place according to the display's rotation
* @param disp pointer to a display
* @param area pointer to an area to rotate
*/
void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area);
/**********************
* MACROS
**********************/

View File

@@ -18,6 +18,10 @@ extern "C" {
#include "../draw/lv_draw.h"
#include "lv_display.h"
#if LV_USE_PERF_MONITOR
#include "../others/sysmon/lv_sysmon.h"
#endif
/*********************
* DEFINES
*********************/
@@ -148,6 +152,17 @@ struct _lv_display_t {
/** The area being refreshed*/
lv_area_t refreshed_area;
#if LV_USE_PERF_MONITOR
lv_obj_t * perf_label;
lv_sysmon_backend_data_t perf_sysmon_backend;
lv_sysmon_perf_info_t perf_sysmon_info;
#endif
#if LV_USE_MEM_MONITOR
lv_obj_t * mem_label;
#endif
};
/**********************

View File

@@ -6,9 +6,9 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../core/lv_refr.h"
#include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
/*********************

View File

@@ -6,10 +6,10 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_draw_mask.h"
#include "../core/lv_refr.h"
#include "../misc/lv_math.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
/*********************

View File

@@ -11,8 +11,8 @@
#if LV_USE_VECTOR_GRAPHIC
#include "../misc/lv_ll.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include <stdbool.h>
#include <math.h>
#include <float.h>

View File

@@ -38,19 +38,10 @@ 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_IMAGE_HEADER_CACHE_DEF_CNT > 0
static lv_cache_compare_res_t image_decoder_header_cache_compare_cb(const lv_image_header_cache_data_t * lhs,
const lv_image_header_cache_data_t * rhs);
static void image_decoder_header_cache_free_cb(lv_image_header_cache_data_t * entry, void * user_data);
#endif
#if LV_CACHE_DEF_SIZE > 0
static lv_cache_compare_res_t image_decoder_cache_compare_cb(const lv_image_cache_data_t * lhs,
const lv_image_cache_data_t * rhs);
static void image_decoder_cache_free_cb(lv_image_cache_data_t * entry, void * user_data);
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc);
#endif
/**********************
* STATIC VARIABLES
**********************/
@@ -70,23 +61,13 @@ void _lv_image_decoder_init(void)
{
_lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t));
/*Initialize the cache*/
#if LV_CACHE_DEF_SIZE > 0
img_cache_p = lv_cache_create(&lv_cache_class_lru_rb_size,
sizeof(lv_image_cache_data_t), LV_CACHE_DEF_SIZE, (lv_cache_ops_t) {
.compare_cb = (lv_cache_compare_cb_t)image_decoder_cache_compare_cb,
.create_cb = NULL,
.free_cb = (lv_cache_free_cb_t)image_decoder_cache_free_cb,
});
lv_image_cache_init();
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
img_header_cache_p = lv_cache_create(&lv_cache_class_lru_rb_count,
sizeof(lv_image_header_cache_data_t), LV_IMAGE_HEADER_CACHE_DEF_CNT, (lv_cache_ops_t) {
.compare_cb = (lv_cache_compare_cb_t)image_decoder_header_cache_compare_cb,
.create_cb = NULL,
.free_cb = (lv_cache_free_cb_t)image_decoder_header_cache_free_cb
});
lv_image_header_cache_init();
#endif
}
@@ -220,11 +201,6 @@ void lv_image_decoder_set_close_cb(lv_image_decoder_t * decoder, lv_image_decode
decoder->close_cb = close_cb;
}
void lv_image_decoder_set_cache_free_cb(lv_image_decoder_t * decoder, lv_cache_free_cb_t cache_free_cb)
{
decoder->cache_free_cb = cache_free_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,
@@ -380,73 +356,7 @@ static uint32_t img_width_to_stride(lv_image_header_t * header)
}
}
#if LV_CACHE_DEF_SIZE > 0 || LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
inline static lv_cache_compare_res_t image_decoder_common_compare(const void * lhs_src, lv_image_src_t lhs_src_type,
const void * rhs_src, lv_image_src_t rhs_src_type)
{
if(lhs_src_type == rhs_src_type) {
if(lhs_src_type == LV_IMAGE_SRC_FILE) {
int32_t cmp_res = lv_strcmp(lhs_src, rhs_src);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
}
}
else if(lhs_src_type == LV_IMAGE_SRC_VARIABLE) {
if(lhs_src != rhs_src) {
return lhs_src > rhs_src ? 1 : -1;
}
}
return 0;
}
return lhs_src_type > rhs_src_type ? 1 : -1;
}
#endif
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
static lv_cache_compare_res_t image_decoder_header_cache_compare_cb(
const lv_image_header_cache_data_t * lhs,
const lv_image_header_cache_data_t * rhs)
{
return image_decoder_common_compare(lhs->src, lhs->src_type, rhs->src, rhs->src_type);
}
static void image_decoder_header_cache_free_cb(lv_image_header_cache_data_t * entry, void * user_data)
{
LV_UNUSED(user_data); /*Unused*/
if(entry->src_type == LV_IMAGE_SRC_FILE) lv_free((void *)entry->src);
}
#endif
#if LV_CACHE_DEF_SIZE > 0
static lv_cache_compare_res_t image_decoder_cache_compare_cb(
const lv_image_cache_data_t * lhs,
const lv_image_cache_data_t * rhs)
{
return image_decoder_common_compare(lhs->src, lhs->src_type, rhs->src, rhs->src_type);
}
static void image_decoder_cache_free_cb(lv_image_cache_data_t * entry, void * user_data)
{
const lv_image_decoder_t * decoder = entry->decoder;
if(decoder == NULL) return; /* Why ? */
if(decoder->cache_free_cb) {
/* Decoder wants to free the cache by itself. */
decoder->cache_free_cb(entry, user_data);
}
else {
/* Destroy the decoded draw buffer if necessary. */
lv_draw_buf_t * decoded = (lv_draw_buf_t *)entry->decoded;
if(lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_ALLOCATED)) {
lv_draw_buf_destroy(decoded);
}
/*Free the duplicated file name*/
if(entry->src_type == LV_IMAGE_SRC_FILE) lv_free((void *)entry->src);
}
}
static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc)
{
lv_cache_t * cache = dsc->cache;

View File

@@ -15,7 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_draw_buf.h"
#include "../misc/lv_fs.h"
#include "../misc/lv_types.h"
@@ -110,7 +109,6 @@ struct _lv_image_decoder_t {
lv_image_decoder_get_area_cb_t get_area_cb;
lv_image_decoder_close_f_t close_cb;
lv_cache_free_cb_t cache_free_cb;
void * user_data;
};
@@ -278,17 +276,6 @@ 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);
/**
* Set a custom method to free cache data.
* Normally this is not needed. If the custom decoder allocates additional memory other than dsc->decoded
* draw buffer, then you need to register your own method to free it. By default the cache entry is free'ed
* in `image_decoder_cache_free_cb`.
*
* @param decoder pointer to the image decoder
* @param cache_free_cb the custom callback to free cache data. Refer to `image_decoder_cache_free_cb`.
*/
void lv_image_decoder_set_cache_free_cb(lv_image_decoder_t * decoder, lv_cache_free_cb_t cache_free_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,

View File

@@ -17,7 +17,6 @@ reciprocal:
.text
.syntax unified
.altmacro
.p2align 2
TMP .req r0
@@ -32,118 +31,158 @@ MASK_STRIDE .req r8
H .req r9
OPA .req r10
RCP .req r11
S_B .qn q0
S_G .qn q1
S_R .qn q2
S_A .qn q3
D_B .qn q4
D_G .qn q5
D_R .qn q6
D_A .qn q7
N .qn q0
V .qn q1
R .qn q2
L .qn q4
.macro conv_888_to_565 reg
vsri.8 reg&_R, reg&_G, #5
vshr.u8 reg&_G, reg&_G, #2
vshr.u8 reg&_B, reg&_B, #3
vsli.8 reg&_B, reg&_G, #5
.endm
S_B .req q0
S_G .req q1
S_R .req q2
S_A .req q3
D_B .req q4
D_G .req q5
D_R .req q6
D_A .req q7
N .req q0
V .req q1
R .req q2
L .req q4
S_565 .req q0
D_565 .req q1
S_L .req q2
D_L .req q4
D_T .req q5
BITMASK .req q6
@ 16bpp is stored on R & B
.macro ldst op, bpp, mem, reg, areg, cvt, alt_index, wb
.if bpp == 0
.if (reg == S) || (wb&1) @ exclude reg == D and !
ldr TMP, [mem&_ADDR]
vdup.8 reg&_B, TMP
.macro ldst st, op, bpp, mem, reg, areg, cvt, alt_index, wb, aligned
.if \bpp == 0
.if \cvt
ldr TMP, [\mem\()_ADDR]
bfi TMP, TMP, #2, #8
bfi TMP, TMP, #3, #16
lsr TMP, TMP, #8
vdup.16 \reg\()_565, TMP
.else
ldr TMP, [\mem\()_ADDR]
vdup.8 \reg\()_B, TMP
lsr TMP, #8
vdup.8 reg&_G, TMP
vdup.8 \reg\()_G, TMP
lsr TMP, #8
vdup.8 reg&_R, TMP
.if cvt && (wb&1)
conv_888_to_565 reg
vdup.8 \reg\()_R, TMP
.endif
.endif
.elseif bpp == 8
v&op&rb.8 reg&_A, [mem&_ADDR], #16
.elseif bpp == 16
.if cvt && (op == st)
conv_888_to_565 reg
.endif
.if alt_index
v&op&rb.8 reg&_B, [mem&_ADDR, areg&_A]
add mem&_ADDR, #1
v&op&rb.8 reg&_R, [mem&_ADDR, areg&_A]
.elseif \bpp == 8
.if \cvt
v\op\()rb.u16 \reg\()_A, [\mem\()_ADDR], #8
.else
v&op&rb.8 reg&_B, [mem&_ADDR, reg&_A]
add mem&_ADDR, #1
v&op&rb.8 reg&_R, [mem&_ADDR, reg&_A]
v\op\()rb.8 \reg\()_A, [\mem\()_ADDR], #16
.endif
.if cvt && (op == ld)
vshl.u8 reg&_G, reg&_R, #5
vsri.u8 reg&_G, reg&_B, #3
vshl.u8 reg&_B, reg&_B, #3
vsri.u8 reg&_R, reg&_R, #5
vsri.u8 reg&_G, reg&_G, #6
vsri.u8 reg&_B, reg&_B, #5
.elseif \bpp == 16
.if \cvt
.if \st
vsri.8 \reg\()_R, \reg\()_G, #5
vshr.u8 \reg\()_G, \reg\()_G, #2
vshr.u8 \reg\()_B, \reg\()_B, #3
vsli.8 \reg\()_B, \reg\()_G, #5
.endif
.if wb&0
add mem&_ADDR, #31
.if \alt_index
v\op\()rb.8 \reg\()_B, [\mem\()_ADDR, S_B]
v\op\()rb.8 \reg\()_R, [\mem\()_ADDR, S_G]
.else
sub mem&_ADDR, #1
v\op\()rb.8 \reg\()_B, [\mem\()_ADDR, \reg\()_A]
add \mem\()_ADDR, #1
v\op\()rb.8 \reg\()_R, [\mem\()_ADDR, \reg\()_A]
.endif
.elseif bpp >= 24
.if alt_index || (bpp >= 31)
v&op&rb.8 reg&_B, [mem&_ADDR, areg&_A]
add mem&_ADDR, #1
v&op&rb.8 reg&_G, [mem&_ADDR, areg&_A]
add mem&_ADDR, #1
v&op&rb.8 reg&_R, [mem&_ADDR, areg&_A]
.if \st == 0
vshl.u8 \reg\()_G, \reg\()_R, #5
vsri.u8 \reg\()_G, \reg\()_B, #3
vshl.u8 \reg\()_B, \reg\()_B, #3
vsri.u8 \reg\()_R, \reg\()_R, #5
vsri.u8 \reg\()_G, \reg\()_G, #6
vsri.u8 \reg\()_B, \reg\()_B, #5
.endif
.ifc \wb, !
.if \alt_index
add \mem\()_ADDR, #32
.else
v&op&rb.8 reg&_B, [mem&_ADDR, reg&_A]
add mem&_ADDR, #1
v&op&rb.8 reg&_G, [mem&_ADDR, reg&_A]
add mem&_ADDR, #1
v&op&rb.8 reg&_R, [mem&_ADDR, reg&_A]
add \mem\()_ADDR, #31
.endif
.if (bpp == 32) || (bpp == 31) && (op == st)
add mem&_ADDR, #1
v&op&rb.8 reg&_A, [mem&_ADDR, areg&_A]
.elseif \alt_index == 0
sub \mem\()_ADDR, #1
.endif
.if wb&0
.if bpp == 24
add mem&_ADDR, #46
.elseif (bpp == 32) || (bpp == 31) && (op == st)
add mem&_ADDR, #61
.else @ cvt
.ifc \wb, !
v\op\()rh.16 \reg\()_565, [\mem\()_ADDR], #16
.else
add mem&_ADDR, #62
v\op\()rh.16 \reg\()_565, [\mem\()_ADDR]
.endif
.endif
.elseif \bpp == 24
.if \alt_index == 1
v\op\()rb.8 \reg\()_B, [\mem\()_ADDR, S_B]
v\op\()rb.8 \reg\()_G, [\mem\()_ADDR, S_G]
v\op\()rb.8 \reg\()_R, [\mem\()_ADDR, S_R]
.elseif \alt_index == 2
v\op\()rb.8 \reg\()_B, [\mem\()_ADDR, S_R]
v\op\()rb.8 \reg\()_G, [\mem\()_ADDR, S_A]
v\op\()rb.8 \reg\()_R, [\mem\()_ADDR, D_A]
.else
v\op\()rb.8 \reg\()_B, [\mem\()_ADDR, \reg\()_A]
add \mem\()_ADDR, #1
v\op\()rb.8 \reg\()_G, [\mem\()_ADDR, \reg\()_A]
add \mem\()_ADDR, #1
v\op\()rb.8 \reg\()_R, [\mem\()_ADDR, \reg\()_A]
.endif
.ifc \wb, !
.if \alt_index
add \mem\()_ADDR, #48
.else
add \mem\()_ADDR, #46
.endif
.elseif \alt_index == 0
sub \mem\()_ADDR, #2
.endif
.elseif \aligned
v\op\()40.8 {\reg\()_B, \reg\()_G, \reg\()_R, \reg\()_A}, [\mem\()_ADDR]
v\op\()41.8 {\reg\()_B, \reg\()_G, \reg\()_R, \reg\()_A}, [\mem\()_ADDR]
v\op\()42.8 {\reg\()_B, \reg\()_G, \reg\()_R, \reg\()_A}, [\mem\()_ADDR]
v\op\()43.8 {\reg\()_B, \reg\()_G, \reg\()_R, \reg\()_A}, [\mem\()_ADDR]\wb
.else
v\op\()rb.8 \reg\()_B, [\mem\()_ADDR, \areg\()_A]
add \mem\()_ADDR, #1
v\op\()rb.8 \reg\()_G, [\mem\()_ADDR, \areg\()_A]
add \mem\()_ADDR, #1
v\op\()rb.8 \reg\()_R, [\mem\()_ADDR, \areg\()_A]
.if (\bpp == 32) || (\bpp == 31) && \st
add \mem\()_ADDR, #1
v\op\()rb.8 \reg\()_A, [\mem\()_ADDR, \areg\()_A]
.endif
.ifc \wb, !
.if (\bpp == 32) || (\bpp == 31) && \st
add \mem\()_ADDR, #61
.else
add \mem\()_ADDR, #62
.endif
.else
.if (bpp == 32) || (bpp == 31) && (op == st)
sub mem&_ADDR, #3
.if (\bpp == 32) || (\bpp == 31) && \st
sub \mem\()_ADDR, #3
.else
sub mem&_ADDR, #2
sub \mem\()_ADDR, #2
.endif
.endif
.endif
.endm
.macro load_index bpp, reg, areg
.if bpp > 0
.macro load_index bpp, reg, areg, aligned
.if (\bpp > 0) && ((\bpp < 31) || (\aligned == 0))
mov TMP, #0
.endif
.if bpp == 8
vidup.u8 reg&_A, TMP, #1
.elseif bpp == 16
vidup.u8 reg&_A, TMP, #2
.elseif bpp == 24
vidup.u8 reg&_A, TMP, #1
.if \bpp == 8
vidup.u8 \reg\()_A, TMP, #1
.elseif \bpp == 16
vidup.u8 \reg\()_A, TMP, #2
.elseif \bpp == 24
vidup.u8 \reg\()_A, TMP, #1
mov TMP, #3
vmul.i8 reg&_A, reg&_A, TMP
.elseif bpp >= 31
vidup.u8 areg&_A, TMP, #4
vmul.u8 \reg\()_A, \reg\()_A, TMP
.else
vidup.u8 \areg\()_A, TMP, #4
.endif
.endif
.endm
@@ -153,89 +192,227 @@ L .qn q4
ldr DST_H, [r0, #12]
ldr DST_STRIDE, [r0, #16]
ldr SRC_ADDR, [r0, #20]
.if src_bpp > 0
.if \src_bpp > 0
ldr SRC_STRIDE, [r0, #24]
.endif
.if mask
.if \mask
ldr MASK_ADDR, [r0, #28]
ldr MASK_STRIDE, [r0, #32]
.endif
.if opa
.if \opa
ldr OPA, [r0]
.else
mov OPA, #0xFF
.endif
.if (\src_bpp <= 16) && (\dst_bpp == 16)
.if \opa || \mask
mov TMP, #0xF81F
movt TMP, #0x7E0
vdup.32 BITMASK, TMP
.endif
add TMP, DST_W, #0x7
bic TMP, TMP, #0x7
.else
add TMP, DST_W, #0xF
bic TMP, TMP, #0xF
.if dst_bpp == 32
.endif
.if \dst_bpp == 32
ldr RCP, =(reciprocal - 8)
.endif
.if dst_bpp == 16
.if \dst_bpp == 16
sub DST_STRIDE, DST_STRIDE, TMP, lsl #1
.elseif dst_bpp == 24
.elseif \dst_bpp == 24
sub DST_STRIDE, DST_STRIDE, TMP
sub DST_STRIDE, DST_STRIDE, TMP, lsl #1
.elseif dst_bpp >= 31
.elseif \dst_bpp >= 31
sub DST_STRIDE, DST_STRIDE, TMP, lsl #2
.endif
.if mask
.if \mask
sub MASK_STRIDE, MASK_STRIDE, TMP
.endif
.if src_bpp == 0
.if mask || opa
ldst ld, src_bpp, SRC, S, D, 0, 0
.if \src_bpp == 0
.if \mask || \opa
.if \dst_bpp > 16
ldst 0, ld, \src_bpp, SRC, S, D, 0, 0
vmov.u8 S_A, #0xFF
.else
ldst ld, src_bpp, SRC, D, S, (dst_bpp == 16), 0
vmov.u8 D_A, #0xFF
ldst 0, ld, \src_bpp, SRC, S, D, 1, 0
vmovlb.u16 S_L, S_565
vsli.32 S_L, S_L, #16
vand S_L, S_L, BITMASK
.endif
.else
.if src_bpp == 16
.if \dst_bpp > 16
ldst 0, ld, \src_bpp, SRC, D, S, 0, 0
.else
ldst 0, ld, \src_bpp, SRC, D, S, 1, 0
.endif
.endif
.else
.if \src_bpp == 16
sub SRC_STRIDE, SRC_STRIDE, TMP, lsl #1
.elseif src_bpp == 24
.elseif \src_bpp == 24
sub SRC_STRIDE, SRC_STRIDE, TMP
sub SRC_STRIDE, SRC_STRIDE, TMP, lsl #1
.elseif src_bpp >= 31
.elseif \src_bpp >= 31
sub SRC_STRIDE, SRC_STRIDE, TMP, lsl #2
.endif
.endif
.if (src_bpp < 32) && (mask == 0) && (opa == 0)
.if (src_bpp == 31) || (dst_bpp < 31)
load_index src_bpp, S, S
.if (\src_bpp < 32) && (\mask == 0) && (\opa == 0) && !((\src_bpp <= 16) && (\dst_bpp == 16))
@ 16 to 31/32 or reverse: index @ q0, q1
@ 24 to 31/32 or reverse: index @ q0, q1, q2
@ 16 to 24 or reverse: 16 index @ q0, q1, 24 index @ q2, q3, q7
@ 31 to 31/32: index @ q3 (tail only)
mov TMP, #0
.if (\src_bpp == 16) || (\dst_bpp == 16)
vidup.u8 S_B, TMP, #2
mov TMP, #1
vadd.u8 S_G, S_B, TMP
.if (\src_bpp == 24) || (\dst_bpp == 24)
vshl.u8 S_R, S_B, #1
vadd.u8 S_R, S_R, S_B
vshr.u8 S_R, S_R, #1
vadd.u8 S_A, S_R, TMP
vadd.u8 D_A, S_A, TMP
.endif
.if (dst_bpp < 31) && (dst_bpp != src_bpp)
load_index dst_bpp, D, D
.else
load_index dst_bpp, S, S
.elseif (\src_bpp == 24) || (\dst_bpp == 24)
vidup.u8 S_B, TMP, #1
mov TMP, #3
vmul.u8 S_B, S_B, TMP
mov TMP, #1
vadd.u8 S_G, S_B, TMP
vadd.u8 S_R, S_G, TMP
.endif
.if \dst_bpp >= 31
load_index \dst_bpp, D, S, 0
vmov.u8 D_A, #0xFF
.endif
.endif
.endm
.macro vqrdmulh_u8 Qd, Qn, Qm @ 1 bit precision loss
vmulh.u8 Qd, Qn, Qm
vqshl.u8 Qd, Qd, #1
vmulh.u8 \Qd, \Qn, \Qm
vqshl.u8 \Qd, \Qd, #1
.endm
.macro premult mem, alpha
vrmulh.u8 mem&_B, mem&_B, alpha
vrmulh.u8 mem&_G, mem&_G, alpha
vrmulh.u8 mem&_R, mem&_R, alpha
vrmulh.u8 \mem\()_B, \mem\()_B, \alpha
vrmulh.u8 \mem\()_G, \mem\()_G, \alpha
vrmulh.u8 \mem\()_R, \mem\()_R, \alpha
.endm
.macro blend_565 p
vmovl\p\().u16 D_L, D_565
vsli.32 D_L, D_L, #16
vand D_L, D_L, BITMASK
vsub.u32 D_T, S_L, D_L
vmovl\p\().u16 D_A, S_A
vmul.u32 D_T, D_T, D_A
vshr.u32 D_T, D_T, #5
vadd.u32 D_L, D_L, D_T
vand D_L, D_L, BITMASK
vshr.u32 D_T, D_L, #16
vorr D_L, D_L, D_T
vmovn\p\().u32 D_565, D_L
.endm
.macro late_init src_bpp, dst_bpp, mask, opa, mode
.if (\src_bpp <= 16) && (\dst_bpp == 16) && (\mask == 0)
.if \opa == 2
mov TMP, #0x7BEF
vdup.16 BITMASK, TMP
.if \src_bpp == 0
vshr.u16 S_L, S_565, #1
vand S_L, S_L, BITMASK
.endif
.elseif \opa == 1
vdup.16 S_A, OPA
mov TMP, #4
vadd.u16 S_A, S_A, TMP
vshr.u16 S_A, S_A, #3
.endif
.endif
.endm
.macro blend src_bpp, dst_bpp, mask, opa, mode
.if (mask == 0) && (opa == 2) && (dst_bpp < 32)
.if (\mask == 0) && (\opa == 2)
.if (\src_bpp <= 16) && (\dst_bpp == 16)
.if \src_bpp > 0
vshr.u16 S_L, S_565, #1
vand S_L, S_L, BITMASK
.endif
vshr.u16 D_L, D_565, #1
vand D_L, D_L, BITMASK
vadd.u16 D_565, S_L, D_L
.else
vhadd.u8 D_B, D_B, S_B
vhadd.u8 D_G, D_G, S_G
vhadd.u8 D_R, D_R, S_R
.endif
.elseif (\src_bpp <= 16) && (\dst_bpp == 16)
lsl lr, #1
.if \src_bpp > 0
vmovlb.u16 S_L, S_565
vsli.32 S_L, S_L, #16
vand S_L, S_L, BITMASK
.endif
blend_565 b
.if \src_bpp > 0
vmovlt.u16 S_L, S_565
vsli.32 S_L, S_L, #16
vand S_L, S_L, BITMASK
.endif
blend_565 t
lsr lr, #1
.else
.if dst_bpp < 32
.if \dst_bpp < 32
.if (\opa == 0) && (\mask == 0)
vmov.u8 D_A, #0xFF
mov TMP, #0
vabav.u8 TMP, S_A, D_A
cbnz TMP, 91f
vmov D_B, S_B
vmov D_G, S_G
vmov D_R, S_R
b 88f
91:
.endif
vmvn D_A, S_A
premult S, S_A
premult D, D_A
.else
vpush {d0-d5}
vmov.u8 S_B, #0xFF
vmov.u8 S_G, #0
mov TMP, #0
vabav.u8 TMP, S_A, S_B
cbz TMP, 91f @ if(fg.alpha == 255
mov TMP, #0
vabav.u8 TMP, D_A, S_G
cbnz TMP, 90f @ || bg.alpha == 0)
91:
vpop {d8-d13} @ return fg;
vmov.u8 D_A, #0xFF
b 88f
90:
mov TMP, #0
vabav.u8 TMP, S_A, S_G
cmp TMP, #2 @ if(fg.alpha <= LV_OPA_MIN)
itt le @ return bg;
vpople {d0-d5}
ble 88f
mov TMP, #0
vabav.u8 TMP, D_A, S_B @ if (bg.alpha == 255)
cbnz TMP, 89f @ return lv_color_mix32(fg, bg);
vpop {d0-d5}
vmvn D_A, S_A
premult S, S_A
premult D, D_A
vqadd.u8 D_B, D_B, S_B
vqadd.u8 D_G, D_G, S_G
vqadd.u8 D_R, D_R, S_R
vmov.u8 D_A, #0xFF
b 88f
89:
vmvn N, S_A
vmvn D_A, D_A
vrmulh.u8 D_A, N, D_A
@@ -261,191 +438,242 @@ L .qn q4
vqadd.u8 D_G, D_G, S_G
vqadd.u8 D_R, D_R, S_R
.endif
.if dst_bpp == 31
.if \dst_bpp == 31
vmov.u8 D_A, #0xFF
.endif
88:
.endm
.macro blend_line src_bpp, dst_bpp, mask, opa, mode
wlstp.8 lr, DST_W, 1f
.if (\src_bpp < 31) && (\dst_bpp < 31)
blend_block \src_bpp, \dst_bpp, \mask, \opa, \mode, DST_W, 0
.else
bics TMP, DST_W, #0xF
beq 87f
blend_block \src_bpp, \dst_bpp, \mask, \opa, \mode, TMP, 1
87:
ands TMP, DST_W, #0xF
beq 86f
blend_block \src_bpp, \dst_bpp, \mask, \opa, \mode, TMP, 0
86:
.endif
.endm
.macro blend_block src_bpp, dst_bpp, mask, opa, mode, w, aligned
.if (\src_bpp <= 16) && (\dst_bpp == 16)
wlstp.16 lr, \w, 1f
.else
wlstp.8 lr, \w, 1f
.endif
2:
.if (src_bpp < 32) && (mask == 0) && (opa == 0)
.if (\src_bpp < 32) && (\mask == 0) && (\opa == 0)
@ no blend
@ dst index: db < 31 ? (db == sb ? S : D) : S
@ src index: sb < 31 && db >= 31 ? D(reload) : S
.if (src_bpp < 31) && (dst_bpp >= 31)
load_index src_bpp, D, D
.endif
.if src_bpp == 0
ldst st, dst_bpp, DST, D, S, 0, 0, !
.elseif (src_bpp == dst_bpp) || (src_bpp == 31) && (dst_bpp == 32)
.if dst_bpp < 31
.if src_bpp < 31
ldst ld, src_bpp, SRC, D, S, 0, 1, !
.if \src_bpp == 0
ldst 1, st, \dst_bpp, DST, D, S, 0, 1, !, \aligned
.elseif (\src_bpp == \dst_bpp) || (\src_bpp == 31) && (\dst_bpp == 32)
.if \dst_bpp < 31
.if \src_bpp < 31
ldst 0, ld, \src_bpp, SRC, D, S, 0, 1, !, \aligned
.else
ldst ld, src_bpp, SRC, D, S, 0, 0, !
ldst 0, ld, \src_bpp, SRC, D, S, 0, 1, !, \aligned
.endif
ldst st, dst_bpp, DST, D, S, 0, 1, !
ldst 1, st, \dst_bpp, DST, D, S, 0, 1, !, \aligned
.else
ldst ld, src_bpp, SRC, D, S, 0, 0, !
ldst st, dst_bpp, DST, D, S, 0, 0, !
ldst 0, ld, \src_bpp, SRC, D, S, 0, 1, !, \aligned
ldst 1, st, \dst_bpp, DST, D, S, 0, 1, !, \aligned
.endif
.else
.if (dst_bpp < 31) && (src_bpp < 31)
ldst ld, src_bpp, SRC, D, S, 1, 1, !
.if (\dst_bpp < 31) && (\src_bpp < 31)
ldst 0, ld, \src_bpp, SRC, D, S, 1, 2, !, \aligned
ldst 1, st, \dst_bpp, DST, D, S, 1, 2, !, \aligned
.else
ldst ld, src_bpp, SRC, D, S, 1, 0, !
ldst 0, ld, \src_bpp, SRC, D, S, 1, 1, !, \aligned
ldst 1, st, \dst_bpp, DST, D, S, 1, 1, !, \aligned
.endif
.if (src_bpp < 31) && (dst_bpp >= 31)
vmov.u8 D_A, #0xFF
.endif
ldst st, dst_bpp, DST, D, S, 1, 0, !
.elseif (\src_bpp <= 16) && (\dst_bpp == 16)
.if \src_bpp > 0
ldst 0, ld, \src_bpp, SRC, S, D, 0, 0, !, \aligned
.endif
.elseif src_bpp < 32
ldst 0, ld, \dst_bpp, DST, D, S, 0, 0, , \aligned
.if \mask
ldst 0, ld, 8, MASK, S, D, 1, 0, !
.if \opa == 2
vshr.u16 S_A, S_A, #1
.elseif \opa == 1
vmul.u16 S_A, S_A, OPA
vshr.u16 S_A, S_A, #8
.endif
mov TMP, #4
vadd.u16 S_A, S_A, TMP
vshr.u16 S_A, S_A, #3
.endif
blend \src_bpp, \dst_bpp, \mask, \opa, \mode
ldst 1, st, \dst_bpp, DST, D, S, 0, 0, !, \aligned
.elseif \src_bpp < 32
@ no src_a
load_index src_bpp, S, D
ldst ld, src_bpp, SRC, S, D, 1, 0, !
load_index dst_bpp, D, S
ldst ld, dst_bpp, DST, D, S, 1, 0
.if mask
ldst ld, 8, MASK, S, D, 1, 0, !
.if opa == 2
.if \src_bpp > 0
load_index \src_bpp, S, D, \aligned
ldst 0, ld, \src_bpp, SRC, S, D, 1, 0, !, \aligned
.elseif (\opa == 1) || \mask
vpush {d0-d5}
.endif
load_index \dst_bpp, D, S, \aligned
ldst 0, ld, \dst_bpp, DST, D, S, 1, 0, , \aligned
.if \mask
ldst 0, ld, 8, MASK, S, D, 0, 0, !, \aligned
.if \opa == 2
vshr.u8 S_A, S_A, #1
.elseif opa == 1
.if dst_bpp == 32
.elseif \opa == 1
.if \dst_bpp == 32
vpush {d14-d15}
.endif
vdup.8 D_A, OPA
vrmulh.u8 S_A, S_A, D_A
.if dst_bpp == 32
.if \dst_bpp == 32
vpop {d14-d15}
.endif
.endif
.elseif opa == 1
.elseif \opa == 1
vdup.8 S_A, OPA
.endif
blend src_bpp, dst_bpp, mask, opa, mode
.if (dst_bpp == 32) || mask || (opa == 1)
load_index dst_bpp, D, S
blend \src_bpp, \dst_bpp, \mask, \opa, \mode
.if (\src_bpp == 0) && ((\opa == 1) || \mask)
vpop {d0-d5}
.endif
ldst st, dst_bpp, DST, D, S, 1, 0, !
.if (\dst_bpp == 32) || \mask || (\opa == 1)
load_index \dst_bpp, D, S, \aligned
.endif
ldst 1, st, \dst_bpp, DST, D, S, 1, 0, !, \aligned
.else
@ src_a (+mask) (+opa)
load_index dst_bpp, D, S
ldst ld, dst_bpp, DST, D, S, 1, 0
.if dst_bpp == 32
@ src_a (+\mask) (+\opa)
load_index \dst_bpp, D, S, \aligned
ldst 0, ld, \dst_bpp, DST, D, S, 1, 0, , \aligned
.if (\dst_bpp == 32) && (\mask || \opa || (\aligned == 0))
vpush {d14-d15}
.endif
load_index src_bpp, S, D
ldst ld, src_bpp, SRC, S, D, 1, 0, !
.if mask == 0
.if opa
load_index \src_bpp, S, D, \aligned
ldst 0, ld, \src_bpp, SRC, S, D, 1, 0, !, \aligned
.if \mask == 0
.if \opa
vdup.8 D_A, OPA
vrmulh.u8 S_A, S_A, D_A
.endif
.else
ldst ld, 8, MASK, D, S, 1, 0, !
ldst 0, ld, 8, MASK, D, S, 0, 0, !, \aligned
vrmulh.u8 S_A, S_A, D_A
.if opa
.if \opa
vdup.8 D_A, OPA
vrmulh.u8 S_A, S_A, D_A
.endif
.endif
.if dst_bpp == 32
.if (\dst_bpp == 32) && (\mask || \opa || (\aligned == 0))
vpop {d14-d15}
.endif
blend src_bpp, dst_bpp, mask, opa, mode
load_index dst_bpp, D, S
ldst st, dst_bpp, DST, D, S, 1, 0, !
blend \src_bpp, \dst_bpp, \mask, \opa, \mode
load_index \dst_bpp, D, S, \aligned
ldst 1, st, \dst_bpp, DST, D, S, 1, 0, !, \aligned
.endif
letp lr, 2b
1:
.endm
.macro enter
.macro enter complex
push {r4-r11, lr}
.if \complex
vpush {d8-d15}
.endif
.endm
.macro exit
.macro exit complex
.if \complex
vpop {d8-d15}
.endif
pop {r4-r11, pc}
.endm
.macro preload mem, bpp
.if bpp >= 31
pld [mem&_ADDR, DST_W, lsl #2]
.elseif bpp == 24
.if \bpp >= 31
pld [\mem\()_ADDR, DST_W, lsl #2]
.elseif \bpp == 24
add TMP, DST_W, DST_W, lsl #1
pld [mem&_ADDR, TMP]
.elseif bpp == 16
pld [mem&_ADDR, DST_W, lsl #1]
.elseif bpp == 8
pld [mem&_ADDR, DST_W]
pld [\mem\()_ADDR, TMP]
.elseif \bpp == 16
pld [\mem\()_ADDR, DST_W, lsl #1]
.elseif \bpp == 8
pld [\mem\()_ADDR, DST_W]
.endif
.endm
.macro next src_bpp, mask
add DST_ADDR, DST_ADDR, DST_STRIDE
.if src_bpp > 0
.if \src_bpp > 0
add SRC_ADDR, SRC_ADDR, SRC_STRIDE
.endif
.if mask
.if \mask
add MASK_ADDR, MASK_ADDR, MASK_STRIDE
.endif
.endm
.macro blender src_bpp, dst_bpp, mask, opa, mode
enter
init src_bpp, dst_bpp, mask, opa
.if (\src_bpp <= 16) && (\dst_bpp == 16) && (\opa == 0) && (\mask == 0)
enter 0
.else
enter 1
.endif
init \src_bpp, \dst_bpp, \mask, \opa
movs H, DST_H
beq 0f
preload SRC, src_bpp
.if mask || opa || (src_bpp == 32)
preload DST, dst_bpp
preload SRC, \src_bpp
.if \mask || \opa || (\src_bpp == 32)
preload DST, \dst_bpp
.endif
.if opa && (src_bpp < 32) && (dst_bpp < 32)
.if \opa && (\src_bpp < 32) && (\dst_bpp < 32)
4:
@ 50% OPA can be accelerated (OPA == 0x7F/0x80)
add TMP, OPA, #1
tst TMP, #0x7E
bne 3f
blend_line src_bpp, dst_bpp, mask, 2, mode
next src_bpp, mask
late_init \src_bpp, \dst_bpp, \mask, 2, \mode
blend_line \src_bpp, \dst_bpp, \mask, 2, \mode
next \src_bpp, \mask
subs H, #1
bne 4b
b 0f
.endif
3:
blend_line src_bpp, dst_bpp, mask, opa, mode
next src_bpp, mask
late_init \src_bpp, \dst_bpp, \mask, \opa, \mode
blend_line \src_bpp, \dst_bpp, \mask, \opa, \mode
next \src_bpp, \mask
subs H, #1
bne 3b
0:
exit
.if (\src_bpp <= 16) && (\dst_bpp == 16) && (\opa == 0) && (\mask == 0)
exit 0
.else
exit 1
.endif
.ltorg
.endm
.macro export name, src_bpp, dst_bpp, mask, opa, mode
.thumb_func
.func name
.global name
name&:
blender src_bpp, dst_bpp, mask, opa, mode
.endfunc
.global \name
\name\():
blender \src_bpp, \dst_bpp, \mask, \opa, \mode
.endm
.macro export_set src, dst, src_bpp, dst_bpp, mode
.if src == color
export lv_&src&_blend_to_&dst&_helium, src_bpp, dst_bpp, 0, 0, mode
export lv_&src&_blend_to_&dst&_with_opa_helium, src_bpp, dst_bpp, 0, 1, mode
export lv_&src&_blend_to_&dst&_with_mask_helium, src_bpp, dst_bpp, 1, 0, mode
export lv_&src&_blend_to_&dst&_mix_mask_opa_helium, src_bpp, dst_bpp, 1, 1, mode
.ifc \src, color
export lv_\src\()_blend_to_\dst\()_helium, \src_bpp, \dst_bpp, 0, 0, \mode
export lv_\src\()_blend_to_\dst\()_with_opa_helium, \src_bpp, \dst_bpp, 0, 1, \mode
export lv_\src\()_blend_to_\dst\()_with_mask_helium, \src_bpp, \dst_bpp, 1, 0, \mode
export lv_\src\()_blend_to_\dst\()_mix_mask_opa_helium, \src_bpp, \dst_bpp, 1, 1, \mode
.else
export lv_&src&_blend_&mode&_to_&dst&_helium, src_bpp, dst_bpp, 0, 0, mode
export lv_&src&_blend_&mode&_to_&dst&_with_opa_helium, src_bpp, dst_bpp, 0, 1, mode
export lv_&src&_blend_&mode&_to_&dst&_with_mask_helium, src_bpp, dst_bpp, 1, 0, mode
export lv_&src&_blend_&mode&_to_&dst&_mix_mask_opa_helium, src_bpp, dst_bpp, 1, 1, mode
export lv_\src\()_blend_\mode\()_to_\dst\()_helium, \src_bpp, \dst_bpp, 0, 0, \mode
export lv_\src\()_blend_\mode\()_to_\dst\()_with_opa_helium, \src_bpp, \dst_bpp, 0, 1, \mode
export lv_\src\()_blend_\mode\()_to_\dst\()_with_mask_helium, \src_bpp, \dst_bpp, 1, 0, \mode
export lv_\src\()_blend_\mode\()_to_\dst\()_mix_mask_opa_helium, \src_bpp, \dst_bpp, 1, 1, \mode
.endif
.endm

View File

@@ -449,7 +449,7 @@ static void execute_drawing(lv_draw_sw_unit_t * u)
LV_PROFILER_END;
}
static void rotate90_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
static void rotate270_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
int32_t srcStride,
int32_t dstStride)
{
@@ -489,7 +489,7 @@ static void rotate180_argb8888(const uint32_t * src, uint32_t * dst, int32_t wid
}
}
static void rotate270_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
static void rotate90_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
int32_t srcStride,
int32_t dstStride)
{
@@ -510,7 +510,7 @@ static void rotate270_argb8888(const uint32_t * src, uint32_t * dst, int32_t src
}
}
static void rotate90_rgb888(const uint8_t * src, uint8_t * dst, int32_t srcWidth, int32_t srcHeight, int32_t srcStride,
static void rotate270_rgb888(const uint8_t * src, uint8_t * dst, int32_t srcWidth, int32_t srcHeight, int32_t srcStride,
int32_t dstStride)
{
if(LV_RESULT_OK == LV_DRAW_SW_ROTATE90_RGB888(src, dst, srcWidth, srcHeight, srcStride, dstStride)) {
@@ -546,7 +546,7 @@ static void rotate180_rgb888(const uint8_t * src, uint8_t * dst, int32_t width,
}
}
static void rotate270_rgb888(const uint8_t * src, uint8_t * dst, int32_t width, int32_t height, int32_t srcStride,
static void rotate90_rgb888(const uint8_t * src, uint8_t * dst, int32_t width, int32_t height, int32_t srcStride,
int32_t dstStride)
{
if(LV_RESULT_OK == LV_DRAW_SW_ROTATE270_RGB888(src, dst, srcWidth, srcHeight, srcStride, dstStride)) {
@@ -564,7 +564,7 @@ static void rotate270_rgb888(const uint8_t * src, uint8_t * dst, int32_t width,
}
}
static void rotate90_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
static void rotate270_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
int32_t srcStride,
int32_t dstStride)
{
@@ -604,7 +604,7 @@ static void rotate180_rgb565(const uint16_t * src, uint16_t * dst, int32_t width
}
}
static void rotate270_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
static void rotate90_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
int32_t srcStride,
int32_t dstStride)
{

View File

@@ -6,11 +6,12 @@
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_draw_sw.h"
#if LV_USE_DRAW_SW
#include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
#include "../../core/lv_refr.h"
#include "../../stdlib/lv_string.h"

View File

@@ -13,10 +13,10 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "../../misc/lv_area.h"
#include "../../misc/lv_color.h"
#include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -12,6 +12,7 @@
#if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h"
#include <string.h>
/*********************
* DEFINES

View File

@@ -72,7 +72,7 @@ void lv_draw_vg_lite_init(void)
unit->base_unit.delete_cb = draw_delete;
lv_vg_lite_image_dsc_init(unit);
lv_vg_lite_grad_init(unit);
lv_vg_lite_grad_init(unit, LV_VG_LITE_LINEAER_GRAD_CACHE_CNT, LV_VG_LITE_RADIAL_GRAD_CACHE_CNT);
lv_vg_lite_path_init(unit);
lv_vg_lite_decoder_init();
}

View File

@@ -40,9 +40,15 @@ struct _lv_vg_lite_pending_t;
struct _lv_draw_vg_lite_unit_t {
lv_draw_unit_t base_unit;
lv_draw_task_t * task_act;
struct _lv_vg_lite_pending_t * image_dsc_pending;
lv_cache_t * grad_cache;
struct _lv_vg_lite_pending_t * grad_pending;
lv_cache_t * linear_grad_cache;
struct _lv_vg_lite_pending_t * linear_grad_pending;
lv_cache_t * radial_grad_cache;
struct _lv_vg_lite_pending_t * radial_grad_pending;
uint16_t flush_count;
vg_lite_buffer_t target_buffer;
vg_lite_matrix_t global_matrix;

View File

@@ -36,7 +36,6 @@ static void lv_path_opa_to_vg(lv_vg_lite_path_t * dest, const lv_vector_draw_dsc
static void lv_stroke_to_vg(lv_vg_lite_path_t * dest, const lv_vector_stroke_dsc_t * dsc);
static vg_lite_blend_t lv_blend_to_vg(lv_vector_blend_t blend);
static vg_lite_fill_t lv_fill_to_vg(lv_vector_fill_t fill_rule);
static vg_lite_gradient_spreadmode_t lv_spread_to_vg(lv_vector_gradient_spread_t spread);
static vg_lite_cap_style_t lv_stroke_cap_to_vg(lv_vector_stroke_cap_t cap);
static vg_lite_join_style_t lv_stroke_join_to_vg(lv_vector_stroke_join_t join);
@@ -205,8 +204,6 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
case LV_VECTOR_DRAW_STYLE_GRADIENT: {
/* draw gradient */
lv_vector_gradient_style_t style = dsc->fill_dsc.gradient.style;
vg_lite_gradient_spreadmode_t spreadmode = lv_spread_to_vg(dsc->fill_dsc.gradient.spread);
LV_UNUSED(spreadmode);
if(style == LV_VECTOR_GRADIENT_STYLE_LINEAR) {
vg_lite_matrix_t grad_matrix, fill_matrix;
@@ -229,12 +226,23 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
blend);
}
else if(style == LV_VECTOR_GRADIENT_STYLE_RADIAL) {
if(vg_lite_query_feature(gcFEATURE_BIT_VG_RADIAL_GRADIENT)) {
/* TODO: radial gradient */
}
else {
LV_LOG_WARN("radial gradient is not supported");
}
vg_lite_matrix_t grad_matrix;
lv_matrix_to_vg(&grad_matrix, &dsc->fill_dsc.matrix);
/* add min_x, min_y to gradient center */
lv_vector_gradient_t new_grad = dsc->fill_dsc.gradient;
new_grad.cx += min_x;
new_grad.cy += min_y;
lv_vg_lite_draw_radial_grad(
u,
&u->target_buffer,
vg_path,
&new_grad,
&grad_matrix,
&matrix,
fill,
blend);
}
}
break;
@@ -431,20 +439,6 @@ static vg_lite_fill_t lv_fill_to_vg(lv_vector_fill_t fill_rule)
}
}
static vg_lite_gradient_spreadmode_t lv_spread_to_vg(lv_vector_gradient_spread_t spread)
{
switch(spread) {
case LV_VECTOR_GRADIENT_SPREAD_PAD:
return VG_LITE_GRADIENT_SPREAD_PAD;
case LV_VECTOR_GRADIENT_SPREAD_REPEAT:
return VG_LITE_GRADIENT_SPREAD_REPEAT;
case LV_VECTOR_GRADIENT_SPREAD_REFLECT:
return VG_LITE_GRADIENT_SPREAD_REFLECT;
default:
return VG_LITE_GRADIENT_SPREAD_FILL;
}
}
static vg_lite_cap_style_t lv_stroke_cap_to_vg(lv_vector_stroke_cap_t cap)
{
switch(cap) {

View File

@@ -12,6 +12,8 @@
#if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h"
#include <stdlib.h>
#include <string.h>
/*********************
* DEFINES
@@ -63,7 +65,6 @@ void lv_vg_lite_decoder_init(void)
lv_image_decoder_set_info_cb(decoder, decoder_info);
lv_image_decoder_set_open_cb(decoder, decoder_open);
lv_image_decoder_set_close_cb(decoder, decoder_close);
lv_image_decoder_set_cache_free_cb(decoder, NULL); /*Use general cache free method*/
}
void lv_vg_lite_decoder_deinit(void)

View File

@@ -13,6 +13,9 @@
#include "lv_draw_vg_lite_type.h"
#include "lv_vg_lite_pending.h"
#include "lv_vg_lite_math.h"
#include "../../misc/lv_types.h"
#include "../../stdlib/lv_string.h"
/*********************
* DEFINES
@@ -23,22 +26,47 @@
**********************/
typedef struct {
vg_lite_linear_gradient_t vg_grad;
lv_grad_dsc_t lv_grad;
} grad_item_t;
vg_lite_linear_gradient_t vg_grad;
} linear_grad_item_t;
#if LV_USE_VECTOR_GRAPHIC
typedef struct {
lv_vector_gradient_t lv_grad;
vg_lite_radial_gradient_t vg_grad;
} radial_grad_item_t;
#endif /* LV_USE_VECTOR_GRAPHIC */
/**********************
* STATIC PROTOTYPES
**********************/
static vg_lite_linear_gradient_t * lv_vg_lite_linear_grad_get(struct _lv_draw_vg_lite_unit_t * u,
const lv_grad_dsc_t * grad);
static bool grad_create_cb(grad_item_t * item, void * user_data);
static void grad_free_cb(grad_item_t * item, void * user_data);
static lv_cache_compare_res_t grad_compare_cb(const grad_item_t * lhs, const grad_item_t * rhs);
static void grad_cache_release_cb(void * entry, void * user_data);
/* Linear gradient */
static vg_lite_linear_gradient_t * linear_grad_get(struct _lv_draw_vg_lite_unit_t * u,
const lv_grad_dsc_t * grad);
static bool linear_grad_create_cb(linear_grad_item_t * item, void * user_data);
static void linear_grad_free_cb(linear_grad_item_t * item, void * user_data);
static lv_cache_compare_res_t linear_grad_compare_cb(const linear_grad_item_t * lhs, const linear_grad_item_t * rhs);
#if LV_USE_VECTOR_GRAPHIC
/* Radial gradient */
static vg_lite_radial_gradient_t * radial_grad_get(struct _lv_draw_vg_lite_unit_t * u,
const lv_vector_gradient_t * grad);
static bool radial_grad_create_cb(radial_grad_item_t * item, void * user_data);
static void radial_grad_free_cb(radial_grad_item_t * item, void * user_data);
static lv_cache_compare_res_t radial_grad_compare_cb(const radial_grad_item_t * lhs, const radial_grad_item_t * rhs);
static vg_lite_gradient_spreadmode_t lv_spread_to_vg(lv_vector_gradient_spread_t spread);
#endif /* LV_USE_VECTOR_GRAPHIC */
/**********************
* STATIC VARIABLES
**********************/
@@ -51,28 +79,63 @@ static void grad_cache_release_cb(void * entry, void * user_data);
* GLOBAL FUNCTIONS
**********************/
void lv_vg_lite_grad_init(struct _lv_draw_vg_lite_unit_t * u)
void lv_vg_lite_grad_init(
struct _lv_draw_vg_lite_unit_t * u,
uint32_t linear_grad_cache_cnt,
uint32_t radial_grad_cache_cnt)
{
LV_ASSERT_NULL(u);
LV_UNUSED(radial_grad_cache_cnt);
/* Create the cache for linear gradients */
{
lv_cache_ops_t ops = {
.compare_cb = (lv_cache_compare_cb_t)grad_compare_cb,
.create_cb = (lv_cache_create_cb_t)grad_create_cb,
.free_cb = (lv_cache_free_cb_t)grad_free_cb,
.compare_cb = (lv_cache_compare_cb_t)linear_grad_compare_cb,
.create_cb = (lv_cache_create_cb_t)linear_grad_create_cb,
.free_cb = (lv_cache_free_cb_t)linear_grad_free_cb,
};
u->grad_cache = lv_cache_create(&lv_cache_class_lru_rb_count, sizeof(grad_item_t), LV_VG_LITE_GRAD_CACHE_SIZE, ops);
LV_ASSERT_NULL(u->grad_cache);
u->linear_grad_cache = lv_cache_create(&lv_cache_class_lru_rb_count, sizeof(linear_grad_item_t),
linear_grad_cache_cnt,
ops);
u->linear_grad_pending = lv_vg_lite_pending_create(sizeof(lv_cache_entry_t *), 4);
lv_vg_lite_pending_set_free_cb(u->linear_grad_pending, grad_cache_release_cb, u->linear_grad_cache);
}
u->grad_pending = lv_vg_lite_pending_create(sizeof(lv_cache_entry_t *), 4);
lv_vg_lite_pending_set_free_cb(u->grad_pending, grad_cache_release_cb, u->grad_cache);
#if LV_USE_VECTOR_GRAPHIC
/* Create the cache for radial gradients */
if(vg_lite_query_feature(gcFEATURE_BIT_VG_RADIAL_GRADIENT)) {
lv_cache_ops_t ops = {
.compare_cb = (lv_cache_compare_cb_t)radial_grad_compare_cb,
.create_cb = (lv_cache_create_cb_t)radial_grad_create_cb,
.free_cb = (lv_cache_free_cb_t)radial_grad_free_cb,
};
u->radial_grad_cache = lv_cache_create(&lv_cache_class_lru_rb_count, sizeof(radial_grad_item_t),
radial_grad_cache_cnt,
ops);
u->radial_grad_pending = lv_vg_lite_pending_create(sizeof(lv_cache_entry_t *), 4);
lv_vg_lite_pending_set_free_cb(u->radial_grad_pending, grad_cache_release_cb, u->radial_grad_cache);
}
#endif /* LV_USE_VECTOR_GRAPHIC */
}
void lv_vg_lite_grad_deinit(struct _lv_draw_vg_lite_unit_t * u)
{
LV_ASSERT_NULL(u);
lv_vg_lite_pending_destroy(u->grad_pending);
lv_cache_destroy(u->grad_cache, NULL);
lv_vg_lite_pending_destroy(u->linear_grad_pending);
u->linear_grad_pending = NULL;
lv_cache_destroy(u->linear_grad_cache, NULL);
u->linear_grad_cache = NULL;
if(u->radial_grad_pending) {
lv_vg_lite_pending_destroy(u->radial_grad_pending);
u->radial_grad_pending = NULL;
lv_cache_destroy(u->radial_grad_cache, NULL);
u->radial_grad_cache = NULL;
}
}
void lv_vg_lite_grad_area_to_matrix(vg_lite_matrix_t * grad_matrix, const lv_area_t * area, lv_grad_dir_t dir)
@@ -117,20 +180,20 @@ void lv_vg_lite_draw_linear_grad(
LV_PROFILER_BEGIN;
vg_lite_linear_gradient_t * gradient = lv_vg_lite_linear_grad_get(u, grad);
LV_ASSERT_NULL(gradient);
if(!gradient) {
vg_lite_linear_gradient_t * linear_grad = linear_grad_get(u, grad);
LV_ASSERT_NULL(linear_grad);
if(!linear_grad) {
LV_LOG_ERROR("Failed to get linear gradient");
LV_PROFILER_END;
return;
}
vg_lite_matrix_t * grad_mat_p = vg_lite_get_grad_matrix(gradient);
vg_lite_matrix_t * grad_mat_p = vg_lite_get_grad_matrix(linear_grad);
LV_ASSERT_NULL(grad_mat_p);
*grad_mat_p = *grad_matrix;
LV_VG_LITE_ASSERT_DEST_BUFFER(buffer);
LV_VG_LITE_ASSERT_SRC_BUFFER(&gradient->image);
LV_VG_LITE_ASSERT_SRC_BUFFER(&linear_grad->image);
LV_VG_LITE_ASSERT_PATH(path);
LV_VG_LITE_ASSERT_MATRIX(grad_mat_p);
LV_VG_LITE_ASSERT_MATRIX(matrix);
@@ -141,37 +204,101 @@ void lv_vg_lite_draw_linear_grad(
path,
fill,
(vg_lite_matrix_t *)matrix,
gradient,
linear_grad,
blend));
LV_PROFILER_END_TAG("vg_lite_draw_grad");
LV_PROFILER_END;
}
#if LV_USE_VECTOR_GRAPHIC
void lv_vg_lite_draw_radial_grad(
struct _lv_draw_vg_lite_unit_t * u,
vg_lite_buffer_t * buffer,
vg_lite_path_t * path,
const lv_vector_gradient_t * grad,
const vg_lite_matrix_t * grad_matrix,
const vg_lite_matrix_t * matrix,
vg_lite_fill_t fill,
vg_lite_blend_t blend)
{
LV_ASSERT_NULL(u);
LV_ASSERT_NULL(buffer);
LV_ASSERT_NULL(path);
LV_ASSERT_NULL(grad);
LV_ASSERT_NULL(grad_matrix);
LV_ASSERT_NULL(matrix);
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_RADIAL_GRADIENT)) {
LV_LOG_INFO("radial gradient is not supported");
return;
}
if(grad->spread == LV_VECTOR_GRADIENT_SPREAD_REPEAT || grad->spread == LV_VECTOR_GRADIENT_SPREAD_REFLECT) {
if(!vg_lite_query_feature(gcFEATURE_BIT_VG_IM_REPEAT_REFLECT)) {
LV_LOG_INFO("repeat/reflect spread(%d) is not supported", (int)grad->spread);
return;
}
}
LV_PROFILER_BEGIN;
vg_lite_radial_gradient_t * radial_grad = radial_grad_get(u, grad);
vg_lite_matrix_t * grad_mat_p = vg_lite_get_radial_grad_matrix(radial_grad);
LV_ASSERT_NULL(grad_mat_p);
*grad_mat_p = *grad_matrix;
LV_VG_LITE_ASSERT_DEST_BUFFER(buffer);
LV_VG_LITE_ASSERT_SRC_BUFFER(&radial_grad->image);
LV_VG_LITE_ASSERT_PATH(path);
LV_VG_LITE_ASSERT_MATRIX(grad_mat_p);
LV_VG_LITE_ASSERT_MATRIX(matrix);
LV_PROFILER_BEGIN_TAG("vg_lite_draw_radial_grad");
LV_VG_LITE_CHECK_ERROR(
vg_lite_draw_radial_grad(
buffer,
path,
fill,
(vg_lite_matrix_t *)matrix,
radial_grad,
0,
blend,
VG_LITE_FILTER_LINEAR));
LV_PROFILER_END_TAG("vg_lite_draw_radial_grad");
LV_PROFILER_END;
}
#endif /* LV_USE_VECTOR_GRAPHIC */
/**********************
* STATIC FUNCTIONS
**********************/
static vg_lite_linear_gradient_t * lv_vg_lite_linear_grad_get(struct _lv_draw_vg_lite_unit_t * u,
const lv_grad_dsc_t * grad)
static void * grad_get(
struct _lv_draw_vg_lite_unit_t * u,
lv_cache_t * cache,
lv_vg_lite_pending_t * pending,
const void * key)
{
LV_ASSERT_NULL(u);
LV_ASSERT_NULL(grad);
LV_ASSERT_NULL(cache);
LV_ASSERT_NULL(pending);
LV_ASSERT_NULL(key);
grad_item_t search_key;
lv_memzero(&search_key, sizeof(grad_item_t));
search_key.lv_grad = *grad;
lv_cache_entry_t * cache_node_entry = lv_cache_acquire(u->grad_cache, &search_key, NULL);
lv_cache_entry_t * cache_node_entry = lv_cache_acquire(cache, key, NULL);
if(cache_node_entry == NULL) {
/* check if the cache is full */
size_t free_size = lv_cache_get_free_size(u->grad_cache, NULL);
size_t free_size = lv_cache_get_free_size(cache, NULL);
if(free_size == 0) {
LV_LOG_INFO("grad cache is full, release all pending cache entries");
lv_vg_lite_finish(u);
}
cache_node_entry = lv_cache_acquire_or_create(u->grad_cache, &search_key, NULL);
cache_node_entry = lv_cache_acquire_or_create(cache, key, NULL);
if(cache_node_entry == NULL) {
LV_LOG_ERROR("grad cache creating failed");
return NULL;
@@ -179,13 +306,36 @@ static vg_lite_linear_gradient_t * lv_vg_lite_linear_grad_get(struct _lv_draw_vg
}
/* Add the new entry to the pending list */
lv_vg_lite_pending_add(u->grad_pending, &cache_node_entry);
lv_vg_lite_pending_add(pending, &cache_node_entry);
return lv_cache_entry_get_data(cache_node_entry);
}
static void grad_cache_release_cb(void * entry, void * user_data)
{
lv_cache_entry_t ** entry_p = entry;
lv_cache_t * cache = user_data;
lv_cache_release(cache, *entry_p, NULL);
}
/* Linear gradient */
static vg_lite_linear_gradient_t * linear_grad_get(struct _lv_draw_vg_lite_unit_t * u,
const lv_grad_dsc_t * grad)
{
linear_grad_item_t search_key;
lv_memzero(&search_key, sizeof(search_key));
search_key.lv_grad = *grad;
linear_grad_item_t * item = grad_get(u, u->linear_grad_cache, u->linear_grad_pending, &search_key);
if(!item) {
return NULL;
}
grad_item_t * item = lv_cache_entry_get_data(cache_node_entry);
return &item->vg_grad;
}
static bool grad_create_cb(grad_item_t * item, void * user_data)
static bool linear_grad_create_cb(linear_grad_item_t * item, void * user_data)
{
LV_UNUSED(user_data);
@@ -224,19 +374,19 @@ static bool grad_create_cb(grad_item_t * item, void * user_data)
return true;
}
static void grad_free_cb(grad_item_t * item, void * user_data)
static void linear_grad_free_cb(linear_grad_item_t * item, void * user_data)
{
LV_UNUSED(user_data);
LV_VG_LITE_CHECK_ERROR(vg_lite_clear_grad(&item->vg_grad));
}
static lv_cache_compare_res_t grad_compare_cb(const grad_item_t * lhs, const grad_item_t * rhs)
static lv_cache_compare_res_t linear_grad_compare_cb(const linear_grad_item_t * lhs, const linear_grad_item_t * rhs)
{
if(lhs->lv_grad.stops_count != rhs->lv_grad.stops_count) {
return lhs->lv_grad.stops_count > rhs->lv_grad.stops_count ? 1 : -1;
}
int cmp_res = memcmp(lhs->lv_grad.stops, rhs->lv_grad.stops,
int cmp_res = lv_memcmp(lhs->lv_grad.stops, rhs->lv_grad.stops,
sizeof(lv_gradient_stop_t) * lhs->lv_grad.stops_count);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
@@ -245,11 +395,139 @@ static lv_cache_compare_res_t grad_compare_cb(const grad_item_t * lhs, const gra
return 0;
}
static void grad_cache_release_cb(void * entry, void * user_data)
#if LV_USE_VECTOR_GRAPHIC
/* Radial gradient */
static vg_lite_radial_gradient_t * radial_grad_get(struct _lv_draw_vg_lite_unit_t * u,
const lv_vector_gradient_t * grad)
{
lv_cache_entry_t ** entry_p = entry;
lv_cache_t * cache = user_data;
lv_cache_release(cache, *entry_p, NULL);
radial_grad_item_t search_key;
lv_memzero(&search_key, sizeof(search_key));
search_key.lv_grad = *grad;
radial_grad_item_t * item = grad_get(u, u->radial_grad_cache, u->radial_grad_pending, &search_key);
if(!item) {
return NULL;
}
return &item->vg_grad;
}
static bool radial_grad_create_cb(radial_grad_item_t * item, void * user_data)
{
LV_UNUSED(user_data);
LV_PROFILER_BEGIN;
lv_vector_gradient_t * grad = &item->lv_grad;
uint8_t stops_count = grad->grad.stops_count;
vg_lite_color_ramp_t * color_ramp = lv_malloc(sizeof(vg_lite_color_ramp_t) * stops_count);
LV_ASSERT_MALLOC(color_ramp);
if(!color_ramp) {
LV_LOG_ERROR("malloc failed for color_ramp");
return false;
}
for(uint8_t i = 0; i < stops_count; i++) {
color_ramp[i].stop = grad->grad.stops[i].frac / 255.0f;
lv_color_t c = grad->grad.stops[i].color;
color_ramp[i].red = c.red / 255.0f;
color_ramp[i].green = c.green / 255.0f;
color_ramp[i].blue = c.blue / 255.0f;
color_ramp[i].alpha = grad->grad.stops[i].opa / 255.0f;
}
const vg_lite_radial_gradient_parameter_t grad_param = {
.cx = grad->cx,
.cy = grad->cy,
.r = grad->cr,
.fx = grad->cx,
.fy = grad->cy,
};
vg_lite_radial_gradient_t radial_grad;
lv_memzero(&radial_grad, sizeof(radial_grad));
LV_PROFILER_BEGIN_TAG("vg_lite_set_radial_grad");
LV_VG_LITE_CHECK_ERROR(
vg_lite_set_radial_grad(
&radial_grad,
stops_count,
color_ramp,
grad_param,
lv_spread_to_vg(grad->spread),
1));
LV_PROFILER_END_TAG("vg_lite_set_radial_grad");
LV_PROFILER_BEGIN_TAG("vg_lite_update_radial_grad");
vg_lite_error_t err = vg_lite_update_radial_grad(&radial_grad);
LV_PROFILER_END_TAG("vg_lite_update_radial_grad");
if(!err) {
item->vg_grad = radial_grad;
}
else {
LV_LOG_ERROR("update radial grad error(%d): %s", (int)err, lv_vg_lite_error_string(err));
}
lv_free(color_ramp);
LV_PROFILER_END;
return err == VG_LITE_SUCCESS;
}
static void radial_grad_free_cb(radial_grad_item_t * item, void * user_data)
{
LV_UNUSED(user_data);
LV_VG_LITE_CHECK_ERROR(vg_lite_clear_radial_grad(&item->vg_grad));
}
static lv_cache_compare_res_t radial_grad_compare_cb(const radial_grad_item_t * lhs, const radial_grad_item_t * rhs)
{
if(!math_equal(lhs->lv_grad.cx, rhs->lv_grad.cx)) {
return lhs->lv_grad.cx > rhs->lv_grad.cx ? 1 : -1;
}
if(!math_equal(lhs->lv_grad.cy, rhs->lv_grad.cy)) {
return lhs->lv_grad.cy > rhs->lv_grad.cy ? 1 : -1;
}
if(!math_equal(lhs->lv_grad.cr, rhs->lv_grad.cr)) {
return lhs->lv_grad.cr > rhs->lv_grad.cr ? 1 : -1;
}
if(lhs->lv_grad.spread != rhs->lv_grad.spread) {
return lhs->lv_grad.spread > rhs->lv_grad.spread ? 1 : -1;
}
if(lhs->lv_grad.grad.stops_count != rhs->lv_grad.grad.stops_count) {
return lhs->lv_grad.grad.stops_count > rhs->lv_grad.grad.stops_count ? 1 : -1;
}
int cmp_res = lv_memcmp(lhs->lv_grad.grad.stops, rhs->lv_grad.grad.stops,
sizeof(lv_gradient_stop_t) * lhs->lv_grad.grad.stops_count);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
}
return 0;
}
static vg_lite_gradient_spreadmode_t lv_spread_to_vg(lv_vector_gradient_spread_t spread)
{
switch(spread) {
case LV_VECTOR_GRADIENT_SPREAD_PAD:
return VG_LITE_GRADIENT_SPREAD_PAD;
case LV_VECTOR_GRADIENT_SPREAD_REPEAT:
return VG_LITE_GRADIENT_SPREAD_REPEAT;
case LV_VECTOR_GRADIENT_SPREAD_REFLECT:
return VG_LITE_GRADIENT_SPREAD_REFLECT;
default:
return VG_LITE_GRADIENT_SPREAD_FILL;
}
}
#endif /* LV_USE_VECTOR_GRAPHIC */
#endif /*LV_USE_DRAW_VG_LITE*/

View File

@@ -32,7 +32,10 @@ extern "C" {
* GLOBAL PROTOTYPES
**********************/
void lv_vg_lite_grad_init(struct _lv_draw_vg_lite_unit_t * u);
void lv_vg_lite_grad_init(
struct _lv_draw_vg_lite_unit_t * u,
uint32_t linear_grad_cache_cnt,
uint32_t radial_grad_cache_cnt);
void lv_vg_lite_grad_deinit(struct _lv_draw_vg_lite_unit_t * u);
@@ -48,7 +51,19 @@ void lv_vg_lite_draw_linear_grad(
vg_lite_fill_t fill,
vg_lite_blend_t blend);
void lv_vg_lite_linear_grad_release_all(struct _lv_draw_vg_lite_unit_t * u);
#if LV_USE_VECTOR_GRAPHIC
void lv_vg_lite_draw_radial_grad(
struct _lv_draw_vg_lite_unit_t * u,
vg_lite_buffer_t * buffer,
vg_lite_path_t * path,
const lv_vector_gradient_t * grad,
const vg_lite_matrix_t * grad_matrix,
const vg_lite_matrix_t * matrix,
vg_lite_fill_t fill,
vg_lite_blend_t blend);
#endif /* LV_USE_VECTOR_GRAPHIC */
/**********************
* MACROS

View File

@@ -1064,7 +1064,11 @@ void lv_vg_lite_finish(struct _lv_draw_vg_lite_unit_t * u)
LV_VG_LITE_CHECK_ERROR(vg_lite_finish());
/* Clear all gradient caches reference */
lv_vg_lite_pending_remove_all(u->grad_pending);
lv_vg_lite_pending_remove_all(u->linear_grad_pending);
if(u->radial_grad_pending) {
lv_vg_lite_pending_remove_all(u->radial_grad_pending);
}
/* Clear image decoder dsc reference */
lv_vg_lite_pending_remove_all(u->image_dsc_pending);

View File

@@ -15,6 +15,7 @@
#include <stdint.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <xf86drm.h>
#include <xf86drmMode.h>

View File

@@ -26,6 +26,9 @@
#include <linux/fb.h>
#endif /* LV_LINUX_FBDEV_BSD */
#include "../../../display/lv_display_private.h"
#include "../../../draw/sw/lv_draw_sw.h"
/*********************
* DEFINES
*********************/
@@ -57,6 +60,8 @@ typedef struct {
struct fb_fix_screeninfo finfo;
#endif /* LV_LINUX_FBDEV_BSD */
char * fbp;
uint8_t * rotated_buf;
size_t rotated_buf_size;
long int screensize;
int fbfd;
bool force_refresh;
@@ -253,15 +258,60 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * colo
{
lv_linux_fb_t * dsc = lv_display_get_driver_data(disp);
if(dsc->fbp == NULL ||
area->x2 < 0 || area->y2 < 0 ||
area->x1 > (int32_t)dsc->vinfo.xres - 1 || area->y1 > (int32_t)dsc->vinfo.yres - 1) {
if(dsc->fbp == NULL) {
lv_display_flush_ready(disp);
return;
}
int32_t w = lv_area_get_width(area);
uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
int32_t h = lv_area_get_height(area);
lv_color_format_t cf = lv_display_get_color_format(disp);
uint32_t px_size = lv_color_format_get_size(cf);
lv_display_rotation_t rotation = lv_display_get_rotation(disp);
/* Not all framebuffer kernel drivers support hardware rotation, so we need to handle it in software here */
if(rotation != LV_DISPLAY_ROTATION_0 && LV_LINUX_FBDEV_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) {
/* (Re)allocate temporary buffer if needed */
size_t buf_size = w * h * px_size;
if(!dsc->rotated_buf || dsc->rotated_buf_size != buf_size) {
dsc->rotated_buf = realloc(dsc->rotated_buf, buf_size);
dsc->rotated_buf_size = buf_size;
}
/* Rotate the pixel buffer */
uint32_t w_stride = lv_draw_buf_width_to_stride(w, cf);
uint32_t h_stride = lv_draw_buf_width_to_stride(h, cf);
switch(rotation) {
case LV_DISPLAY_ROTATION_0:
break;
case LV_DISPLAY_ROTATION_90:
lv_draw_sw_rotate(color_p, dsc->rotated_buf, w, h, w_stride, h_stride, rotation, cf);
break;
case LV_DISPLAY_ROTATION_180:
lv_draw_sw_rotate(color_p, dsc->rotated_buf, w, h, w_stride, w_stride, rotation, cf);
break;
case LV_DISPLAY_ROTATION_270:
lv_draw_sw_rotate(color_p, dsc->rotated_buf, w, h, w_stride, h_stride, rotation, cf);
break;
}
color_p = dsc->rotated_buf;
/* Rotate the area */
lv_display_rotate_area(disp, (lv_area_t *)area);
if(rotation != LV_DISPLAY_ROTATION_180) {
w = lv_area_get_width(area);
h = lv_area_get_height(area);
}
}
/* Ensure that we're within the framebuffer's bounds */
if(area->x2 < 0 || area->y2 < 0 || area->x1 > (int32_t)dsc->vinfo.xres - 1 || area->y1 > (int32_t)dsc->vinfo.yres - 1) {
lv_display_flush_ready(disp);
return;
}
uint32_t color_pos = (area->x1 + dsc->vinfo.xoffset) * px_size + area->y1 * dsc->finfo.line_length;
uint32_t fb_pos = color_pos + dsc->vinfo.yoffset * dsc->finfo.line_length;
@@ -275,6 +325,7 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * colo
}
}
else {
w = lv_area_get_width(area);
for(y = area->y1; y <= area->y2; y++) {
lv_memcpy(&fbp[fb_pos], color_p, w * px_size);
fb_pos += dsc->finfo.line_length;

View File

@@ -22,6 +22,7 @@
#include <dirent.h>
#include <libinput.h>
#include <pthread.h>
#include <string.h>
#if LV_LIBINPUT_BSD
#include <dev/evdev/input.h>

View File

@@ -12,6 +12,7 @@
#include "../../core/lv_refr.h"
#include "../../stdlib/lv_string.h"
#include "../../core/lv_global.h"
#include "../../display/lv_display_private.h"
#include "../../lv_init.h"
#define SDL_MAIN_HANDLED /*To fix SDL's "undefined reference to WinMain" issue*/
@@ -38,6 +39,8 @@ typedef struct {
uint8_t * fb_act;
uint8_t * buf1;
uint8_t * buf2;
uint8_t * rotated_buf;
size_t rotated_buf_size;
#endif
uint8_t zoom;
uint8_t ignore_size_chg;
@@ -125,17 +128,17 @@ lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res)
}
/*LV_DISPLAY_RENDER_MODE_DIRECT or FULL */
else {
uint32_t stride = lv_draw_buf_width_to_stride(lv_display_get_horizontal_resolution(disp),
uint32_t stride = lv_draw_buf_width_to_stride(disp->hor_res,
lv_display_get_color_format(disp));
lv_display_set_buffers(disp, dsc->fb1, dsc->fb2, stride * lv_display_get_vertical_resolution(disp),
lv_display_set_buffers(disp, dsc->fb1, dsc->fb2, stride * disp->ver_res,
LV_SDL_RENDER_MODE);
}
#else /*/*LV_USE_DRAW_SDL == 1*/
uint32_t stride = lv_draw_buf_width_to_stride(lv_display_get_horizontal_resolution(disp),
uint32_t stride = lv_draw_buf_width_to_stride(disp->hor_res,
lv_display_get_color_format(disp));
/*It will render directly to default Texture, so the buffer is not used, so just set something*/
static uint8_t dummy_buf[1];
lv_display_set_buffers(disp, dummy_buf, NULL, stride * lv_display_get_vertical_resolution(disp),
lv_display_set_buffers(disp, dummy_buf, NULL, stride * disp->ver_res,
LV_SDL_RENDER_MODE);
#endif /*LV_USE_DRAW_SDL == 0*/
lv_display_add_event_cb(disp, res_chg_event_cb, LV_EVENT_RESOLUTION_CHANGED, NULL);
@@ -208,21 +211,60 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_m
{
#if LV_USE_DRAW_SDL == 0
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
lv_color_format_t cf = lv_display_get_color_format(disp);
if(LV_SDL_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) {
int32_t y;
lv_display_rotation_t rotation = lv_display_get_rotation(disp);
uint32_t px_size = lv_color_format_get_size(cf);
if(rotation != LV_DISPLAY_ROTATION_0) {
int32_t w = lv_area_get_width(area);
int32_t h = lv_area_get_height(area);
uint32_t w_stride = lv_draw_buf_width_to_stride(w, cf);
uint32_t h_stride = lv_draw_buf_width_to_stride(h, cf);
size_t buf_size = w * h * px_size;
/* (Re)allocate temporary buffer if needed */
if(!dsc->rotated_buf || dsc->rotated_buf_size != buf_size) {
dsc->rotated_buf = realloc(dsc->rotated_buf, buf_size);
dsc->rotated_buf_size = buf_size;
}
switch(rotation) {
case LV_DISPLAY_ROTATION_0:
break;
case LV_DISPLAY_ROTATION_90:
lv_draw_sw_rotate(px_map, dsc->rotated_buf, w, h, w_stride, h_stride, rotation, cf);
break;
case LV_DISPLAY_ROTATION_180:
lv_draw_sw_rotate(px_map, dsc->rotated_buf, w, h, w_stride, w_stride, rotation, cf);
break;
case LV_DISPLAY_ROTATION_270:
lv_draw_sw_rotate(px_map, dsc->rotated_buf, w, h, w_stride, h_stride, rotation, cf);
break;
}
px_map = dsc->rotated_buf;
lv_display_rotate_area(disp, (lv_area_t *)area);
}
uint32_t px_map_stride = lv_draw_buf_width_to_stride(lv_area_get_width(area), cf);
uint32_t px_map_line_bytes = lv_area_get_width(area) * px_size;
uint8_t * fb_tmp = dsc->fb_act;
uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp));
uint32_t px_map_stride = lv_draw_buf_width_to_stride(lv_area_get_width(area), lv_display_get_color_format(disp));
uint32_t data_size = lv_area_get_width(area) * px_size;
int32_t fb_stride = lv_display_get_horizontal_resolution(disp) * px_size;
uint32_t fb_stride = disp->hor_res * px_size;
fb_tmp += area->y1 * fb_stride;
fb_tmp += area->x1 * px_size;
int32_t y;
for(y = area->y1; y <= area->y2; y++) {
lv_memcpy(fb_tmp, px_map, data_size);
lv_memcpy(fb_tmp, px_map, px_map_line_bytes);
px_map += px_map_stride;
fb_tmp += fb_stride;
}
}
/* TYPICALLY YOU DO NOT NEED THIS
* If it was the last part to refresh update the texture of the window.*/
if(lv_display_flush_is_last(disp)) {
@@ -304,8 +346,8 @@ static void window_create(lv_display_t * disp)
flag |= SDL_WINDOW_FULLSCREEN;
#endif
int32_t hor_res = lv_display_get_horizontal_resolution(disp);
int32_t ver_res = lv_display_get_vertical_resolution(disp);
int32_t hor_res = disp->hor_res;
int32_t ver_res = disp->ver_res;
dsc->window = SDL_CreateWindow("LVGL Simulator",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
hor_res * dsc->zoom, ver_res * dsc->zoom, flag); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/
@@ -331,7 +373,7 @@ static void window_update(lv_display_t * disp)
{
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
#if LV_USE_DRAW_SDL == 0
int32_t hor_res = lv_display_get_horizontal_resolution(disp);
int32_t hor_res = disp->hor_res;
uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_display_get_color_format(disp));
SDL_UpdateTexture(dsc->texture, NULL, dsc->fb_act, stride);
@@ -346,13 +388,11 @@ static void window_update(lv_display_t * disp)
#if LV_USE_DRAW_SDL == 0
static void texture_resize(lv_display_t * disp)
{
int32_t hor_res = lv_display_get_horizontal_resolution(disp);
int32_t ver_res = lv_display_get_vertical_resolution(disp);
uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_display_get_color_format(disp));
uint32_t stride = lv_draw_buf_width_to_stride(disp->hor_res, lv_display_get_color_format(disp));
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
dsc->fb1 = realloc(dsc->fb1, stride * ver_res);
memset(dsc->fb1, 0x00, stride * ver_res);
dsc->fb1 = realloc(dsc->fb1, stride * disp->ver_res);
lv_memzero(dsc->fb1, stride * disp->ver_res);
if(LV_SDL_RENDER_MODE == LV_DISPLAY_RENDER_MODE_PARTIAL) {
dsc->fb_act = dsc->fb1;
@@ -362,7 +402,7 @@ static void texture_resize(lv_display_t * disp)
dsc->fb2 = realloc(dsc->fb2, stride * ver_res);
memset(dsc->fb2, 0x00, stride * ver_res);
#endif
lv_display_set_buffers(disp, dsc->fb1, dsc->fb2, stride * ver_res, LV_SDL_RENDER_MODE);
lv_display_set_buffers(disp, dsc->fb1, dsc->fb2, stride * disp->ver_res, LV_SDL_RENDER_MODE);
}
if(dsc->texture) SDL_DestroyTexture(dsc->texture);
@@ -379,7 +419,7 @@ static void texture_resize(lv_display_t * disp)
// px_format = SDL_PIXELFORMAT_BGR24;
dsc->texture = SDL_CreateTexture(dsc->renderer, px_format,
SDL_TEXTUREACCESS_STATIC, hor_res, ver_res);
SDL_TEXTUREACCESS_STATIC, disp->hor_res, disp->ver_res);
SDL_SetTextureBlendMode(dsc->texture, SDL_BLENDMODE_BLEND);
}
#endif
@@ -388,11 +428,9 @@ static void res_chg_event_cb(lv_event_t * e)
{
lv_display_t * disp = lv_event_get_current_target(e);
int32_t hor_res = lv_display_get_horizontal_resolution(disp);
int32_t ver_res = lv_display_get_vertical_resolution(disp);
lv_sdl_window_t * dsc = lv_display_get_driver_data(disp);
if(dsc->ignore_size_chg == false) {
SDL_SetWindowSize(dsc->window, hor_res * dsc->zoom, ver_res * dsc->zoom);
SDL_SetWindowSize(dsc->window, disp->hor_res * dsc->zoom, disp->ver_res * dsc->zoom);
}
#if LV_USE_DRAW_SDL == 0

View File

@@ -6,12 +6,10 @@
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stdbool.h>
#include "../lvgl.h"
#include "../misc/lv_fs.h"
#include "../misc/lv_types.h"
#include "../stdlib/lv_string.h"
#include "lv_binfont_loader.h"
/**********************
@@ -208,7 +206,7 @@ static int read_label(lv_fs_file_t * fp, int start, const char * label)
if(lv_fs_read(fp, &length, 4, NULL) != LV_FS_RES_OK
|| lv_fs_read(fp, buf, 4, NULL) != LV_FS_RES_OK
|| memcmp(label, buf, 4) != 0) {
|| lv_memcmp(label, buf, 4) != 0) {
LV_LOG_WARN("Error reading '%s' label.", label);
return -1;
}
@@ -298,7 +296,7 @@ static int32_t load_cmaps(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, u
lv_font_fmt_txt_cmap_t * cmaps =
lv_malloc(cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
lv_memset(cmaps, 0, cmaps_subtables_count * sizeof(lv_font_fmt_txt_cmap_t));
font_dsc->cmaps = cmaps;
font_dsc->cmap_num = cmaps_subtables_count;
@@ -323,7 +321,7 @@ static int32_t load_glyph(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc,
lv_font_fmt_txt_glyph_dsc_t * glyph_dsc = (lv_font_fmt_txt_glyph_dsc_t *)
lv_malloc(loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
lv_memset(glyph_dsc, 0, loca_count * sizeof(lv_font_fmt_txt_glyph_dsc_t));
font_dsc->glyph_dsc = glyph_dsc;
@@ -462,7 +460,7 @@ static bool lvgl_load_font(lv_fs_file_t * fp, lv_font_t * font)
lv_font_fmt_txt_dsc_t * font_dsc = (lv_font_fmt_txt_dsc_t *)
lv_malloc(sizeof(lv_font_fmt_txt_dsc_t));
memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t));
lv_memset(font_dsc, 0, sizeof(lv_font_fmt_txt_dsc_t));
font->dsc = font_dsc;
@@ -579,7 +577,7 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
if(0 == kern_format_type) { /*sorted pairs*/
lv_font_fmt_txt_kern_pair_t * kern_pair = lv_malloc(sizeof(lv_font_fmt_txt_kern_pair_t));
memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t));
lv_memset(kern_pair, 0, sizeof(lv_font_fmt_txt_kern_pair_t));
font_dsc->kern_dsc = kern_pair;
font_dsc->kern_classes = 0;
@@ -617,7 +615,7 @@ int32_t load_kern(lv_fs_file_t * fp, lv_font_fmt_txt_dsc_t * font_dsc, uint8_t f
lv_font_fmt_txt_kern_classes_t * kern_classes = lv_malloc(sizeof(lv_font_fmt_txt_kern_classes_t));
memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t));
lv_memset(kern_classes, 0, sizeof(lv_font_fmt_txt_kern_classes_t));
font_dsc->kern_dsc = kern_classes;
font_dsc->kern_classes = 1;

View File

@@ -14,14 +14,11 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "../misc/lv_types.h"
#include "lv_symbol_def.h"
#include "../draw/lv_draw_buf.h"
#include "../misc/lv_area.h"
#include "../misc/lv_types.h"
#include "../misc/cache/lv_cache.h"
/*********************

View File

@@ -13,10 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_font.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -472,7 +472,6 @@ static void place_content(lv_flex_align_t place, int32_t max_size, int32_t conte
{
if(item_cnt <= 1) {
switch(place) {
case LV_FLEX_ALIGN_SPACE_BETWEEN:
case LV_FLEX_ALIGN_SPACE_AROUND:
case LV_FLEX_ALIGN_SPACE_EVENLY:
place = LV_FLEX_ALIGN_CENTER;
@@ -492,7 +491,7 @@ static void place_content(lv_flex_align_t place, int32_t max_size, int32_t conte
*start_pos += max_size - content_size;
break;
case LV_FLEX_ALIGN_SPACE_BETWEEN:
*gap = (int32_t)(max_size - content_size) / (int32_t)(item_cnt - 1);
if(item_cnt > 1) *gap = (int32_t)(max_size - content_size) / (int32_t)(item_cnt - 1);
break;
case LV_FLEX_ALIGN_SPACE_AROUND:
*gap += (int32_t)(max_size - content_size) / (int32_t)(item_cnt);

View File

@@ -101,7 +101,6 @@ void lv_bin_decoder_init(void)
lv_image_decoder_set_open_cb(decoder, lv_bin_decoder_open);
lv_image_decoder_set_get_area_cb(decoder, lv_bin_decoder_get_area);
lv_image_decoder_set_close_cb(decoder, lv_bin_decoder_close);
lv_image_decoder_set_cache_free_cb(decoder, NULL); /*Use general cache free method*/
}
lv_result_t lv_bin_decoder_info(lv_image_decoder_t * decoder, const void * src, lv_image_header_t * header)

View File

@@ -0,0 +1,181 @@
#include "../../../lvgl.h"
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
#include "../../core/lv_global.h"
#include "LittleFS.h"
typedef struct ArduinoEspLittleFile {
File file;
} ArduinoEspLittleFile;
/**********************
* STATIC PROTOTYPES
**********************/
static void fs_init(void);
static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode);
static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p);
static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br);
static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence);
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
/**
* Register a driver for the LittleFS File System interface
*/
extern "C" void lv_fs_arduino_esp_littlefs_init(void)
{
fs_init();
lv_fs_drv_t * fs_drv = &(LV_GLOBAL_DEFAULT()->arduino_esp_littlefs_fs_drv);
lv_fs_drv_init(fs_drv);
fs_drv->letter = LV_FS_ARDUINO_ESP_LITTLEFS_LETTER;
fs_drv->open_cb = fs_open;
fs_drv->close_cb = fs_close;
fs_drv->read_cb = fs_read;
fs_drv->write_cb = fs_write;
fs_drv->seek_cb = fs_seek;
fs_drv->tell_cb = fs_tell;
fs_drv->dir_close_cb = NULL;
fs_drv->dir_open_cb = NULL;
fs_drv->dir_read_cb = NULL;
lv_fs_drv_register(fs_drv);
}
/**********************
* STATIC FUNCTIONS
**********************/
/*Initialize your Storage device and File system.*/
static void fs_init(void)
{
LittleFS.begin();
}
/**
* Open a file
* @param drv pointer to a driver where this function belongs
* @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt)
* @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR
* @return a file descriptor or NULL on error
*/
static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
{
LV_UNUSED(drv);
const char * flags;
if(mode == LV_FS_MODE_WR)
flags = FILE_WRITE;
else if(mode == LV_FS_MODE_RD)
flags = FILE_READ;
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD))
flags = FILE_WRITE;
File file = LittleFS.open(path, flags);
if(!file) {
return NULL;
}
ArduinoEspLittleFile * lf = new ArduinoEspLittleFile{file};
return (void *)lf;
}
/**
* Close an opened file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable. (opened with fs_open)
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
*/
static lv_fs_res_t fs_close(lv_fs_drv_t * drv, void * file_p)
{
LV_UNUSED(drv);
ArduinoEspLittleFile * lf = (ArduinoEspLittleFile *)file_p;
lf->file.close();
lv_free(lf);
return LV_FS_RES_OK;
}
/**
* Read data from an opened file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable.
* @param buf pointer to a memory block where to store the read data
* @param btr number of Bytes To Read
* @param br the real number of read bytes (Byte Read)
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
*/
static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br)
{
LV_UNUSED(drv);
ArduinoEspLittleFile * lf = (ArduinoEspLittleFile *)file_p;
*br = lf->file.read((uint8_t *)buf, btr);
return (int32_t)(*br) < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
}
/**
* Write into a file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param buf pointer to a buffer with the bytes to write
* @param btw Bytes To Write
* @param bw the number of real written bytes (Bytes Written)
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
*/
static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw)
{
LV_UNUSED(drv);
ArduinoEspLittleFile * lf = (ArduinoEspLittleFile *)file_p;
*bw = lf->file.write((uint8_t *)buf, btw);
return (int32_t)(*bw) < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
}
/**
* Set the read write pointer. Also expand the file size if necessary.
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable. (opened with fs_open )
* @param pos the new position of read write pointer
* @param whence tells from where to interpret the `pos`. See @lv_fs_whence_t
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
*/
static lv_fs_res_t fs_seek(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence)
{
LV_UNUSED(drv);
SeekMode mode;
if(whence == LV_FS_SEEK_SET)
mode = SeekSet;
else if(whence == LV_FS_SEEK_CUR)
mode = SeekCur;
else if(whence == LV_FS_SEEK_END)
mode = SeekEnd;
ArduinoEspLittleFile * lf = (ArduinoEspLittleFile *)file_p;
int rc = lf->file.seek(pos, mode);
return rc < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
}
/**
* Give the position of the read write pointer
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_p variable
* @param pos_p pointer to store the result
* @return LV_FS_RES_OK: no error or any error from @lv_fs_res_t enum
*/
static lv_fs_res_t fs_tell(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
{
LV_UNUSED(drv);
ArduinoEspLittleFile * lf = (ArduinoEspLittleFile *)file_p;
*pos_p = lf->file.position();
return (int32_t)(*pos_p) < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
}
#endif

View File

@@ -51,6 +51,10 @@ void lv_fs_memfs_init(void);
void lv_fs_littlefs_init(void);
#endif
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
void lv_fs_arduino_esp_littlefs_init(void);
#endif
/**********************
* MACROS
**********************/

View File

@@ -72,7 +72,6 @@ void lv_libjpeg_turbo_init(void)
lv_image_decoder_set_info_cb(dec, decoder_info);
lv_image_decoder_set_open_cb(dec, decoder_open);
lv_image_decoder_set_close_cb(dec, decoder_close);
lv_image_decoder_set_cache_free_cb(dec, NULL); /*Use general cache free method*/
}
void lv_libjpeg_turbo_deinit(void)

View File

@@ -11,6 +11,7 @@
#include "lv_libpng.h"
#include <png.h>
#include <string.h>
/*********************
* DEFINES
@@ -26,7 +27,7 @@
static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src, lv_image_header_t * header);
static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc);
static void decoder_close(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc);
static lv_draw_buf_t * decode_png_file(const char * filename);
static lv_draw_buf_t * decode_png_file(lv_image_decoder_dsc_t * dsc, const char * filename);
/**********************
* STATIC VARIABLES
@@ -49,7 +50,6 @@ void lv_libpng_init(void)
lv_image_decoder_set_info_cb(dec, decoder_info);
lv_image_decoder_set_open_cb(dec, decoder_open);
lv_image_decoder_set_close_cb(dec, decoder_close);
lv_image_decoder_set_cache_free_cb(dec, NULL); /*Use general cache free method*/
}
void lv_libpng_deinit(void)
@@ -126,7 +126,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
/*If it's a PNG file...*/
if(dsc->src_type == LV_IMAGE_SRC_FILE) {
const char * fn = dsc->src;
lv_draw_buf_t * decoded = decode_png_file(fn);
lv_draw_buf_t * decoded = decode_png_file(dsc, fn);
if(decoded == NULL) {
return LV_RESULT_INVALID;
}
@@ -235,7 +235,7 @@ failed:
return data;
}
static lv_draw_buf_t * decode_png_file(const char * filename)
static lv_draw_buf_t * decode_png_file(lv_image_decoder_dsc_t * dsc, const char * filename)
{
int ret;
@@ -259,24 +259,34 @@ static lv_draw_buf_t * decode_png_file(const char * filename)
return NULL;
}
/*Set color format*/
lv_color_format_t cf;
if(dsc->args.use_indexed && (image.format & PNG_FORMAT_FLAG_COLORMAP)) {
cf = LV_COLOR_FORMAT_I8;
image.format = PNG_FORMAT_BGRA_COLORMAP;
}
else {
cf = LV_COLOR_FORMAT_ARGB8888;
image.format = PNG_FORMAT_BGRA;
}
/*Alloc image buffer*/
lv_draw_buf_t * decoded;
decoded = lv_draw_buf_create(image.width, image.height, LV_COLOR_FORMAT_ARGB8888, PNG_IMAGE_ROW_STRIDE(image));
decoded = lv_draw_buf_create(image.width, image.height, cf, LV_STRIDE_AUTO);
if(decoded == NULL) {
LV_LOG_ERROR("alloc PNG_IMAGE_SIZE(%" LV_PRIu32 ") failed: %s", (uint32_t)PNG_IMAGE_SIZE(image), filename);
lv_free(data);
return NULL;
}
void * palette = decoded->data;
void * map = decoded->data + LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t);
/*Start decoding*/
ret = png_image_finish_read(&image, NULL, decoded->data, 0, NULL);
ret = png_image_finish_read(&image, NULL, map, decoded->header.stride, palette);
png_image_free(&image);
lv_free(data);
if(!ret) {
LV_LOG_ERROR("png decode failed: %d", ret);
LV_LOG_ERROR("png decode failed: %s", image.message);
lv_draw_buf_destroy(decoded);
return NULL;
}

View File

@@ -10,6 +10,7 @@
#if LV_USE_RLOTTIE
#include <rlottie_capi.h>
#include <string.h>
/*********************
* DEFINES

View File

@@ -13,6 +13,7 @@
#include "tjpgd.h"
#include "lv_tjpgd.h"
#include "../../misc/lv_fs.h"
#include <string.h>
/*********************
* DEFINES

View File

@@ -124,6 +124,48 @@
#endif
#endif
#ifndef LV_STDINT_INCLUDE
#ifdef CONFIG_LV_STDINT_INCLUDE
#define LV_STDINT_INCLUDE CONFIG_LV_STDINT_INCLUDE
#else
#define LV_STDINT_INCLUDE <stdint.h>
#endif
#endif
#ifndef LV_STDDEF_INCLUDE
#ifdef CONFIG_LV_STDDEF_INCLUDE
#define LV_STDDEF_INCLUDE CONFIG_LV_STDDEF_INCLUDE
#else
#define LV_STDDEF_INCLUDE <stddef.h>
#endif
#endif
#ifndef LV_STDBOOL_INCLUDE
#ifdef CONFIG_LV_STDBOOL_INCLUDE
#define LV_STDBOOL_INCLUDE CONFIG_LV_STDBOOL_INCLUDE
#else
#define LV_STDBOOL_INCLUDE <stdbool.h>
#endif
#endif
#ifndef LV_INTTYPES_INCLUDE
#ifdef CONFIG_LV_INTTYPES_INCLUDE
#define LV_INTTYPES_INCLUDE CONFIG_LV_INTTYPES_INCLUDE
#else
#define LV_INTTYPES_INCLUDE <inttypes.h>
#endif
#endif
#ifndef LV_LIMITS_INCLUDE
#ifdef CONFIG_LV_LIMITS_INCLUDE
#define LV_LIMITS_INCLUDE CONFIG_LV_LIMITS_INCLUDE
#else
#define LV_LIMITS_INCLUDE <limits.h>
#endif
#endif
#ifndef LV_STDARG_INCLUDE
#ifdef CONFIG_LV_STDARG_INCLUDE
#define LV_STDARG_INCLUDE CONFIG_LV_STDARG_INCLUDE
#else
#define LV_STDARG_INCLUDE <stdarg.h>
#endif
#endif
#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
@@ -496,14 +538,25 @@
#endif
#endif
/* VG-Lite gradient image maximum cache number.
/* VG-Lite linear gradient image maximum cache number.
* NOTE: The memory usage of a single gradient image is 4K bytes.
*/
#ifndef LV_VG_LITE_GRAD_CACHE_SIZE
#ifdef CONFIG_LV_VG_LITE_GRAD_CACHE_SIZE
#define LV_VG_LITE_GRAD_CACHE_SIZE CONFIG_LV_VG_LITE_GRAD_CACHE_SIZE
#ifndef LV_VG_LITE_LINEAER_GRAD_CACHE_CNT
#ifdef CONFIG_LV_VG_LITE_LINEAER_GRAD_CACHE_CNT
#define LV_VG_LITE_LINEAER_GRAD_CACHE_CNT CONFIG_LV_VG_LITE_LINEAER_GRAD_CACHE_CNT
#else
#define LV_VG_LITE_GRAD_CACHE_SIZE 32
#define LV_VG_LITE_LINEAER_GRAD_CACHE_CNT 32
#endif
#endif
/* VG-Lite radial gradient image maximum cache size.
* NOTE: The memory usage of a single gradient image is radial grad radius * 4 bytes.
*/
#ifndef LV_VG_LITE_RADIAL_GRAD_CACHE_CNT
#ifdef CONFIG_LV_VG_LITE_RADIAL_GRAD_CACHE_CNT
#define LV_VG_LITE_RADIAL_GRAD_CACHE_CNT CONFIG_LV_VG_LITE_RADIAL_GRAD_CACHE_CNT
#else
#define LV_VG_LITE_RADIAL_GRAD_CACHE_CNT 32
#endif
#endif
@@ -2169,6 +2222,24 @@
#endif
#endif
/*API for Arduino LittleFs. */
#ifndef LV_USE_FS_ARDUINO_ESP_LITTLEFS
#ifdef CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS
#define LV_USE_FS_ARDUINO_ESP_LITTLEFS CONFIG_LV_USE_FS_ARDUINO_ESP_LITTLEFS
#else
#define LV_USE_FS_ARDUINO_ESP_LITTLEFS 0
#endif
#endif
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
#ifndef LV_FS_ARDUINO_ESP_LITTLEFS_LETTER
#ifdef CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_LETTER
#define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER CONFIG_LV_FS_ARDUINO_ESP_LITTLEFS_LETTER
#else
#define LV_FS_ARDUINO_ESP_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#endif
#endif
#endif
/*LODEPNG decoder library*/
#ifndef LV_USE_LODEPNG
#ifdef CONFIG_LV_USE_LODEPNG
@@ -3212,6 +3283,11 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN);
#define LV_LOG_TRACE_ANIM 0
#endif /*LV_USE_LOG*/
#if LV_USE_SYSMON == 0
#define LV_USE_PERF_MONITOR 0
#define LV_USE_MEM_MONITOR 0
#endif /*LV_USE_SYSMON*/
#ifndef LV_USE_LZ4
#define LV_USE_LZ4 (LV_USE_LZ4_INTERNAL || LV_USE_LZ4_EXTERNAL)
#endif

View File

@@ -268,6 +268,10 @@ void lv_init(void)
lv_fs_littlefs_init();
#endif
#if LV_USE_FS_ARDUINO_ESP_LITTLEFS
lv_fs_arduino_esp_littlefs_init();
#endif
#if LV_USE_LODEPNG
lv_lodepng_init();
#endif

View File

@@ -13,8 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include "lv_conf_internal.h"
#include "misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -15,12 +15,12 @@ extern "C" {
*********************/
#include "lv_cache_entry.h"
#include "lv_cache_private.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../lv_types.h"
#include "_lv_cache_lru_rb.h"
#include "lv_image_cache.h"
#include "lv_image_header_cache.h"
/*********************
* DEFINES
*********************/

View File

@@ -16,8 +16,6 @@ extern "C" {
#include "../../osal/lv_os.h"
#include "../lv_types.h"
#include "lv_cache_private.h"
#include <stdbool.h>
#include <stdlib.h>
/*********************
* DEFINES
*********************/

View File

@@ -14,8 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_types.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../../osal/lv_os.h"
/*********************
* DEFINES

View File

@@ -14,8 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_types.h"
#include <stdbool.h>
#include <stdlib.h>
#include "../../osal/lv_os.h"
/*********************

View File

@@ -7,13 +7,20 @@
* INCLUDES
*********************/
#include "../lv_assert.h"
#include "lv_image_header_cache.h"
#include "lv_image_cache.h"
#if LV_CACHE_DEF_SIZE > 0
#include "../../core/lv_global.h"
/*********************
* DEFINES
*********************/
#define img_cache_p (LV_GLOBAL_DEFAULT()->img_cache)
#define img_header_cache_p (LV_GLOBAL_DEFAULT()->img_header_cache)
/**********************
* TYPEDEFS
**********************/
@@ -22,6 +29,10 @@
* STATIC PROTOTYPES
**********************/
static lv_cache_compare_res_t image_cache_compare_cb(const lv_image_cache_data_t * lhs,
const lv_image_cache_data_t * rhs);
static void image_cache_free_cb(lv_image_cache_data_t * entry, void * user_data);
/**********************
* GLOBAL VARIABLES
**********************/
@@ -37,6 +48,32 @@
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_result_t lv_image_cache_init(void)
{
if(img_cache_p != NULL) {
return LV_RESULT_OK;
}
img_cache_p = lv_cache_create(&lv_cache_class_lru_rb_size,
sizeof(lv_image_cache_data_t), LV_CACHE_DEF_SIZE, (lv_cache_ops_t) {
.compare_cb = (lv_cache_compare_cb_t) image_cache_compare_cb,
.create_cb = NULL,
.free_cb = (lv_cache_free_cb_t) image_cache_free_cb,
});
return img_cache_p != NULL ? LV_RESULT_OK : LV_RESULT_INVALID;
}
void lv_image_cache_resize(uint32_t new_size, bool evict_now)
{
lv_cache_set_max_size(img_cache_p, new_size, NULL);
if(evict_now) {
lv_cache_reserve(img_cache_p, new_size, NULL);
}
}
#endif
void lv_image_cache_drop(const void * src)
{
/*If user invalidate image, the header cache should be invalidated too.*/
@@ -59,51 +96,50 @@ void lv_image_cache_drop(const void * src)
#endif
}
void lv_image_cache_resize(uint32_t new_size, bool evict_now)
{
#if LV_CACHE_DEF_SIZE > 0
lv_cache_set_max_size(img_cache_p, new_size, NULL);
if(evict_now) {
lv_cache_reserve(img_cache_p, new_size, NULL);
}
#else
LV_UNUSED(new_size);
LV_UNUSED(evict_now);
#endif
}
void lv_image_header_cache_drop(const void * src)
{
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
if(src == NULL) {
lv_cache_drop_all(img_header_cache_p, NULL);
return;
}
lv_image_header_cache_data_t search_key = {
.src = src,
.src_type = lv_image_src_get_type(src),
};
lv_cache_drop(img_header_cache_p, &search_key, NULL);
#else
LV_UNUSED(src);
#endif
}
void lv_image_header_cache_resize(uint32_t new_size, bool evict_now)
{
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
lv_cache_set_max_size(img_header_cache_p, new_size, NULL);
if(evict_now) {
lv_cache_reserve(img_header_cache_p, new_size, NULL);
}
#else
LV_UNUSED(new_size);
LV_UNUSED(evict_now);
#endif
}
/**********************
* STATIC FUNCTIONS
**********************/
#if LV_CACHE_DEF_SIZE > 0
inline static lv_cache_compare_res_t image_cache_common_compare(const void * lhs_src, lv_image_src_t lhs_src_type,
const void * rhs_src, lv_image_src_t rhs_src_type)
{
if(lhs_src_type == rhs_src_type) {
if(lhs_src_type == LV_IMAGE_SRC_FILE) {
int32_t cmp_res = lv_strcmp(lhs_src, rhs_src);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
}
}
else if(lhs_src_type == LV_IMAGE_SRC_VARIABLE) {
if(lhs_src != rhs_src) {
return lhs_src > rhs_src ? 1 : -1;
}
}
return 0;
}
return lhs_src_type > rhs_src_type ? 1 : -1;
}
static lv_cache_compare_res_t image_cache_compare_cb(
const lv_image_cache_data_t * lhs,
const lv_image_cache_data_t * rhs)
{
return image_cache_common_compare(lhs->src, lhs->src_type, rhs->src, rhs->src_type);
}
static void image_cache_free_cb(lv_image_cache_data_t * entry, void * user_data)
{
LV_UNUSED(user_data);
/* Destroy the decoded draw buffer if necessary. */
lv_draw_buf_t * decoded = (lv_draw_buf_t *)entry->decoded;
if(lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_ALLOCATED)) {
lv_draw_buf_destroy(decoded);
}
/*Free the duplicated file name*/
if(entry->src_type == LV_IMAGE_SRC_FILE) lv_free((void *)entry->src);
}
#endif

View File

@@ -13,7 +13,11 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lv_cache_private.h"
#include "../../lv_conf_internal.h"
#include "../lv_types.h"
#if LV_CACHE_DEF_SIZE > 0
/*********************
* DEFINES
@@ -28,10 +32,10 @@ extern "C" {
**********************/
/**
* Invalidate image cache. Use NULL to invalidate all images.
* @param src pointer to an image source.
* Initialize image cache.
* @return LV_RESULT_OK: initialization succeeded, LV_RESULT_INVALID: failed.
*/
void lv_image_cache_drop(const void * src);
lv_result_t lv_image_cache_init(void);
/**
* Resize image cache.
@@ -40,19 +44,13 @@ void lv_image_cache_drop(const void * src);
*/
void lv_image_cache_resize(uint32_t new_size, bool evict_now);
/**
* Invalidate image header cache. Use NULL to invalidate all image headers.
* It's also automatically called when an image is invalidated.
* @param src pointer to an image source.
*/
void lv_image_header_cache_drop(const void * src);
#endif /*LV_CACHE_DEF_SIZE > 0*/
/**
* Resize image header cache.
* @param new_size new size of the cache in count of image headers.
* @param evict_now true: evict the image headers should be removed by the eviction policy, false: wait for the next cache cleanup.
* Invalidate image cache. Use NULL to invalidate all images.
* @param src pointer to an image source.
*/
void lv_image_header_cache_resize(uint32_t new_size, bool evict_now);
void lv_image_cache_drop(const void * src);
/*************************
* GLOBAL VARIABLES

136
src/misc/cache/lv_image_header_cache.c vendored Normal file
View File

@@ -0,0 +1,136 @@
/**
* @file lv_image_header_cache.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../lv_assert.h"
#include "lv_image_header_cache.h"
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
#include "../../core/lv_global.h"
/*********************
* DEFINES
*********************/
#define img_header_cache_p (LV_GLOBAL_DEFAULT()->img_header_cache)
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_cache_compare_res_t image_header_cache_compare_cb(const lv_image_header_cache_data_t * lhs,
const lv_image_header_cache_data_t * rhs);
static void image_header_cache_free_cb(lv_image_header_cache_data_t * entry, void * user_data);
/**********************
* GLOBAL VARIABLES
**********************/
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
lv_result_t lv_image_header_cache_init(void)
{
if(img_header_cache_p != NULL) {
return LV_RESULT_OK;
}
img_header_cache_p = lv_cache_create(&lv_cache_class_lru_rb_count,
sizeof(lv_image_header_cache_data_t), LV_IMAGE_HEADER_CACHE_DEF_CNT, (lv_cache_ops_t) {
.compare_cb = (lv_cache_compare_cb_t) image_header_cache_compare_cb,
.create_cb = NULL,
.free_cb = (lv_cache_free_cb_t) image_header_cache_free_cb
});
return img_header_cache_p != NULL ? LV_RESULT_OK : LV_RESULT_INVALID;
}
void lv_image_header_cache_resize(uint32_t new_size, bool evict_now)
{
lv_cache_set_max_size(img_header_cache_p, new_size, NULL);
if(evict_now) {
lv_cache_reserve(img_header_cache_p, new_size, NULL);
}
}
#endif
void lv_image_header_cache_drop(const void * src)
{
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
if(src == NULL) {
lv_cache_drop_all(img_header_cache_p, NULL);
return;
}
lv_image_header_cache_data_t search_key = {
.src = src,
.src_type = lv_image_src_get_type(src),
};
lv_cache_drop(img_header_cache_p, &search_key, NULL);
#else
LV_UNUSED(src);
#endif
}
/**********************
* STATIC FUNCTIONS
**********************/
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
inline static lv_cache_compare_res_t image_cache_common_compare(const void * lhs_src, lv_image_src_t lhs_src_type,
const void * rhs_src, lv_image_src_t rhs_src_type)
{
if(lhs_src_type == rhs_src_type) {
if(lhs_src_type == LV_IMAGE_SRC_FILE) {
int32_t cmp_res = lv_strcmp(lhs_src, rhs_src);
if(cmp_res != 0) {
return cmp_res > 0 ? 1 : -1;
}
}
else if(lhs_src_type == LV_IMAGE_SRC_VARIABLE) {
if(lhs_src != rhs_src) {
return lhs_src > rhs_src ? 1 : -1;
}
}
return 0;
}
return lhs_src_type > rhs_src_type ? 1 : -1;
}
static lv_cache_compare_res_t image_header_cache_compare_cb(
const lv_image_header_cache_data_t * lhs,
const lv_image_header_cache_data_t * rhs)
{
return image_cache_common_compare(lhs->src, lhs->src_type, rhs->src, rhs->src_type);
}
static void image_header_cache_free_cb(lv_image_header_cache_data_t * entry, void * user_data)
{
LV_UNUSED(user_data); /*Unused*/
if(entry->src_type == LV_IMAGE_SRC_FILE) lv_free((void *)entry->src);
}
#endif

68
src/misc/cache/lv_image_header_cache.h vendored Normal file
View File

@@ -0,0 +1,68 @@
/**
* @file lv_image_header_cache.h
*
*/
#ifndef LV_IMAGE_HEADER_CACHE_H
#define LV_IMAGE_HEADER_CACHE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../lv_conf_internal.h"
#include "../lv_types.h"
#if LV_IMAGE_HEADER_CACHE_DEF_CNT > 0
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize image header cache.
* @return LV_RESULT_OK: initialization succeeded, LV_RESULT_INVALID: failed.
*/
lv_result_t lv_image_header_cache_init(void);
/**
* Resize image header cache.
* @param new_size new size of the cache in count of image headers.
* @param evict_now true: evict the image headers should be removed by the eviction policy, false: wait for the next cache cleanup.
*/
void lv_image_header_cache_resize(uint32_t new_size, bool evict_now);
#endif /*LV_IMAGE_HEADER_CACHE_DEF_CNT > 0*/
/**
* Invalidate image header cache. Use NULL to invalidate all image headers.
* It's also automatically called when an image is invalidated.
* @param src pointer to an image source.
*/
void lv_image_header_cache_drop(const void * src);
/*************************
* GLOBAL VARIABLES
*************************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_IMAGE_HEADER_CACHE_H*/

View File

@@ -19,10 +19,6 @@ extern "C" {
#include "lv_timer.h"
#include "lv_ll.h"
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
/*********************
* DEFINES
*********************/

View File

@@ -15,9 +15,6 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include "lv_types.h"
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
/*********************
* DEFINES

View File

@@ -13,10 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "lv_types.h"
/*********************

View File

@@ -6,9 +6,9 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_bidi.h"
#include "lv_text.h"
#include "lv_types.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"

View File

@@ -14,9 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdbool.h>
#include <stdint.h>
#include "lv_types.h"
#include "lv_text.h"
/*********************

View File

@@ -17,8 +17,6 @@ extern "C" {
#include "lv_assert.h"
#include "lv_math.h"
#include "lv_types.h"
#include <stdint.h>
#include <stdbool.h>
/*********************
* DEFINES

View File

@@ -16,7 +16,7 @@ extern "C" {
#include "lv_assert.h"
#include "lv_math.h"
#include "lv_color.h"
#include <stdint.h>
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -10,7 +10,7 @@
#include "../core/lv_global.h"
#include "../stdlib/lv_mem.h"
#include "lv_assert.h"
#include <stddef.h>
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include <stdint.h>
#include "lv_types.h"
#include "../lv_conf_internal.h"

View File

@@ -8,7 +8,6 @@
*********************/
#include "lv_fs.h"
#include <string.h>
#include "../misc/lv_assert.h"
#include "../stdlib/lv_string.h"
#include "lv_ll.h"

View File

@@ -14,9 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include <stdbool.h>
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -13,9 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "../lv_conf_internal.h"
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -9,8 +9,7 @@
#include "lv_log.h"
#if LV_USE_LOG
#include <stdarg.h>
#include <string.h>
#include "../misc/lv_types.h"
#include "../stdlib/lv_sprintf.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"

View File

@@ -14,7 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_types.h"

View File

@@ -164,7 +164,7 @@ lv_lru_res_t lv_lru_set(lv_lru_t * cache, const void * key, size_t key_length, v
item = lv_lru_pop_or_create_item(cache);
item->value = value;
item->key = lv_malloc(key_length);
memcpy(item->key, key, key_length);
lv_memcpy(item->key, key, key_length);
item->value_length = value_length;
item->key_length = key_length;
required = (int) value_length;
@@ -303,7 +303,7 @@ static int lv_lru_cmp_keys(lv_lru_item_t * item, const void * key, uint32_t key_
return 1;
}
else {
return memcmp(key, item->key, key_length);
return lv_memcmp(key, item->key, key_length);
}
}

View File

@@ -18,9 +18,6 @@ extern "C" {
#include "lv_types.h"
#include <stdint.h>
#include <stddef.h>
/*********************
* DEFINES
*********************/

View File

@@ -14,7 +14,6 @@ extern "C" {
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#include <stdint.h>
#include "lv_types.h"
/*********************

View File

@@ -14,8 +14,7 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_color.h"
#include <stdint.h>
#include <stdbool.h>
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -18,9 +18,7 @@ extern "C" {
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -14,8 +14,8 @@ extern "C" {
* INCLUDES
*********************/
#include "lv_types.h"
#include "stdbool.h"
#include "lv_assert.h"
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -13,8 +13,6 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include <stdint.h>
#include "../font/lv_font.h"
#include "lv_color.h"
#include "lv_area.h"

View File

@@ -6,7 +6,6 @@
/*********************
* INCLUDES
*********************/
#include <stdarg.h>
#include "lv_text.h"
#include "lv_text_ap.h"
#include "lv_math.h"
@@ -14,6 +13,7 @@
#include "lv_assert.h"
#include "../stdlib/lv_mem.h"
#include "../stdlib/lv_string.h"
#include "../misc/lv_types.h"
/*********************
* DEFINES

View File

@@ -15,12 +15,10 @@ extern "C" {
*********************/
#include "../lv_conf_internal.h"
#include <stdbool.h>
#include <stdarg.h>
#include "lv_types.h"
#include "lv_area.h"
#include "../font/lv_font.h"
#include "../stdlib/lv_sprintf.h"
#include "lv_types.h"
/*********************
* DEFINES

View File

@@ -6,10 +6,10 @@
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_bidi.h"
#include "lv_text.h"
#include "lv_text_ap.h"
#include "lv_types.h"
#include "../stdlib/lv_mem.h"
#include "../draw/lv_draw.h"

View File

@@ -13,8 +13,8 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include <stddef.h>
#include "lv_text.h"
#include "lv_types.h"
#include "../draw/lv_draw.h"
#if LV_USE_ARABIC_PERSIAN_CHARS == 1

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