diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1b34d7088..0c08541e1 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: ["https://www.paypal.com/paypalme/my/profile"] +custom: ["https://paypal.me/littlevgl?locale.x=en_US"] diff --git a/CHANGELOG.md b/CHANGELOG.md index c54f12402..215bf82b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,24 @@ # Changelog -## v7.4.0 (planned on 18.08.2020) +## v7.4.0 (planned on 01.09.2020) *Available in the `dev` branch* -## v7.3.0 (planned on 04.08.2020) -*Available in the `master` branch* +- Add `lv_font_load()` function - Loads a `lv_font_t` object from a binary font file +- Add `lv_font_free()` function - Frees the memory allocated by the `lv_font_load()` function + +## v7.3.1 (planned on 18.08.2020) + +### Bugfixes +- Fix drawing value string twice +- Rename `lv_chart_clear_serie` to `lv_chart_clear_series` and `lv_obj_align_origo` to `lv_obj_align_mid` +- Add linemeter's mirror feature again +- Fix text decor (udnerline strikethrough) with older versions of font converter +- Fix setting local style property multiple times +- Add missing background drawing and radius handling to image button +- Allow adding extra label to list buttons +- Fix overflow in large image transformations + +## v7.3.0 (04.08.2020) ### New features - Add `lv_task_get_next` @@ -12,9 +26,6 @@ - Add `lv_tabview_set_tab_name()` function - used to change a tab's name - Add `LV_THEME_MATERIAL_FLAG_NO_TRANSITION` and `LV_THEME_MATERIAL_FLAG_NO_FOCUS` flags - Reduce code size by adding: `LV_USE_FONT_COMPRESSED` and `LV_FONT_USE_SUBPX` and applying some optimization -- Add `lv_font_load()` function - Loads a `lv_font_t` object from a binary font file -- Add `lv_font_free()` function - Frees the memory allocated by the `lv_font_load()` function - ### Bugfixes - Do not print warning for missing glyph if its height OR width is zero. diff --git a/README.md b/README.md index eeb9f47f2..af3a4cde5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,4 @@
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index 66aae962d..9b5914e58 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -7,7 +7,7 @@ This list indicates only the current intention and can be changed.
## v8
Planned to September/October 2020
- New scrolling:
- - See [feat/new-scroll]((https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue.
+ - See [feat/new-scroll](https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue.
- Remove `lv_page` and support scrolling on `lv_obj`
- Support "elastic" scrolling when scrolled in
- Support scroll chaining among any objects types (not only `lv_pages`s)
@@ -23,6 +23,17 @@ Planned to September/October 2020
- Work in progress
- Add new label alignment modes
- See [#1656](https://github.com/lvgl/lvgl/issues/1656)
+- Remove the align parameter from `lv_canvas_draw_text`
+
+## v9
+- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
## Ideas
-- ...
+- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
+- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
+- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
+- Optmize font decompression
+- Switch to RGBA colors in styles
+- Need coverage report for tests
+- Need static analize (via coverity.io or somehing else)
+- Support dot_begin and dot_middle long modes for labels
diff --git a/library.json b/library.json
index a2c5dd2b9..6cb9ab8b3 100644
--- a/library.json
+++ b/library.json
@@ -1,6 +1,6 @@
{
"name": "lvgl",
- "version": "7.2.0",
+ "version": "7.3.0",
"keywords": "graphics, gui, embedded, tft, lvgl",
"description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.",
"repository": {
diff --git a/library.properties b/library.properties
new file mode 100644
index 000000000..712c77392
--- /dev/null
+++ b/library.properties
@@ -0,0 +1,10 @@
+name=lvgl
+version=7.3.0
+author=kisvegabor
+maintainer=kisvegabor,embeddedt,pete-pjb
+sentence=Full-featured Graphics Library for Embedded Systems
+paragraph=Powerful and easy-to-use embedded GUI with many widgets, advanced visual effects (opacity, antialiasing, animations) and low memory requirements (16K RAM, 64K Flash).
+category=Display
+url=https://lvgl.io
+architectures=*
+includes=lvgl.h
diff --git a/lv_conf_template.h b/lv_conf_template.h
index aab9f497f..4032f5ab0 100644
--- a/lv_conf_template.h
+++ b/lv_conf_template.h
@@ -1,6 +1,6 @@
/**
* @file lv_conf.h
- * Configuration file for LVGL v7.2.0
+ * Configuration file for LVGL v7.3.0
*/
/*
@@ -97,6 +97,10 @@ typedef int16_t lv_coord_t;
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
+/* Use the standard memcpy and memset instead of LVGL's own functions.
+ * The standard functions might or might not be faster depending on their implementation. */
+#define LV_MEMCPY_MEMSET_STD 0
+
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0
@@ -150,7 +154,7 @@ typedef void * lv_anim_user_data_t;
#endif
-/* 1: Enable shadow drawing*/
+/* 1: Enable shadow drawing on rectangles*/
#define LV_USE_SHADOW 1
#if LV_USE_SHADOW
/* Allow buffering some shadow calculation
@@ -160,6 +164,15 @@ typedef void * lv_anim_user_data_t;
#define LV_SHADOW_CACHE_SIZE 0
#endif
+/*1: enable outline drawing on rectangles*/
+#define LV_USE_OUTLINE 1
+
+/*1: enable pattern drawing on rectangles*/
+#define LV_USE_PATTERN 1
+
+/*1: enable value string drawing on rectangles*/
+#define LV_USE_VALUE_STR 1
+
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 1
diff --git a/scripts/release.py b/scripts/release.py
index e64c13bdc..0b5946584 100755
--- a/scripts/release.py
+++ b/scripts/release.py
@@ -210,10 +210,19 @@ def docs_update_version(v):
cmd("git add conf.py")
cmd('git ci -m "update conf.py to ' + v + '"')
+
+def docs_merge_to_release_branch(v):
+ title("docs: merge to release branch")
+ cmd('git co release/v7 --')
+ cmd('git clean -fd .')
+ cmd('rm -f LVGL.pdf') #To avoide possible merge conflict
+ cmd('git merge latest')
+ cmd('git push origin release/v7')
+
def docs_build():
title("docs: Build")
cmd("git checkout master")
- cmd("./update.py latest")
+ cmd("./update.py latest release/v7")
def clean_up():
title("Clean up repos")
@@ -240,6 +249,7 @@ drivers_merge_to_release_branch(ver_str)
docs_clone()
docs_get_api()
docs_update_version(ver_str)
+docs_merge_to_release_branch(ver_str)
docs_build()
clean_up()
diff --git a/src/lv_api_map.h b/src/lv_api_map.h
index 926e9ec47..d8e904e8a 100644
--- a/src/lv_api_map.h
+++ b/src/lv_api_map.h
@@ -200,8 +200,30 @@ static inline void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coor
{
lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax);
}
+
+
+static inline void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * series)
+{
+ lv_chart_clear_series(chart, series);
+}
+
#endif
+static inline void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
+{
+ lv_obj_align_mid(obj, base, align, x_ofs, y_ofs);
+}
+
+static inline void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs)
+{
+ lv_obj_align_mid_y(obj, base, align, x_ofs);
+}
+
+static inline void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs)
+{
+ lv_obj_align_mid_y(obj, base, align, y_ofs);
+}
+
#endif /*LV_USE_API_EXTENSION_V6*/
/**********************
* MACROS
diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h
index 7f86b0eae..d43134241 100644
--- a/src/lv_conf_internal.h
+++ b/src/lv_conf_internal.h
@@ -147,6 +147,12 @@
#endif
#endif /*LV_MEM_CUSTOM*/
+/* Use the standard memcpy and memset instead of LVGL's own functions.
+ * The standard functions might or might not be faster depending on their implementation. */
+#ifndef LV_MEMCPY_MEMSET_STD
+#define LV_MEMCPY_MEMSET_STD 0
+#endif
+
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#ifndef LV_ENABLE_GC
@@ -223,7 +229,7 @@
#endif
-/* 1: Enable shadow drawing*/
+/* 1: Enable shadow drawing on rectangles*/
#ifndef LV_USE_SHADOW
#define LV_USE_SHADOW 1
#endif
@@ -237,6 +243,21 @@
#endif
#endif
+/*1: enable outline drawing on rectangles*/
+#ifndef LV_USE_OUTLINE
+#define LV_USE_OUTLINE 1
+#endif
+
+/*1: enable pattern drawing on rectangles*/
+#ifndef LV_USE_PATTERN
+#define LV_USE_PATTERN 1
+#endif
+
+/*1: enable value string drawing on rectangles*/
+#ifndef LV_USE_VALUE_STR
+#define LV_USE_VALUE_STR 1
+#endif
+
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#ifndef LV_USE_BLEND_MODES
#define LV_USE_BLEND_MODES 1
@@ -633,7 +654,10 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
/* A fast and impressive theme.
* Flags:
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
- * LV_THEME_MATERIAL_FLAG_DARK: dark theme*/
+ * LV_THEME_MATERIAL_FLAG_DARK: dark theme
+ * LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
+ * LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
+ * */
#ifndef LV_USE_THEME_MATERIAL
#define LV_USE_THEME_MATERIAL 1
#endif
diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c
index 8eedc3da0..c20904733 100644
--- a/src/lv_core/lv_obj.c
+++ b/src/lv_core/lv_obj.c
@@ -87,7 +87,7 @@ static void refresh_children_style(lv_obj_t * obj);
static void base_dir_refr_children(lv_obj_t * obj);
static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
lv_coord_t x_ofs, lv_coord_t y_ofs);
-static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
+static void obj_align_mid_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
lv_coord_t x_ofs, lv_coord_t y_ofs);
#if LV_USE_ANIMATION
static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
@@ -856,7 +856,7 @@ void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h)
lv_style_int_t ptop = lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN);
lv_style_int_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
- lv_obj_set_width(obj, h - ptop - pbottom);
+ lv_obj_set_height(obj, h - ptop - pbottom);
}
/**
@@ -911,7 +911,7 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
obj->realign.xofs = x_ofs;
obj->realign.yofs = y_ofs;
obj->realign.base = base;
- obj->realign.origo_align = 0;
+ obj->realign.mid_align = 0;
#endif
}
@@ -959,7 +959,7 @@ void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
-void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
+void lv_obj_align_mid(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
@@ -970,7 +970,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
- obj_align_origo_core(obj, base, align, true, true, x_ofs, y_ofs);
+ obj_align_mid_core(obj, base, align, true, true, x_ofs, y_ofs);
#if LV_USE_OBJ_REALIGN
/*Save the last align parameters to use them in `lv_obj_realign`*/
@@ -978,7 +978,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
obj->realign.xofs = x_ofs;
obj->realign.yofs = y_ofs;
obj->realign.base = base;
- obj->realign.origo_align = 1;
+ obj->realign.mid_align = 1;
#endif
}
@@ -989,7 +989,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_ofs x coordinate offset after alignment
*/
-void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs)
+void lv_obj_align_mid_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
@@ -1000,7 +1000,7 @@ void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
- obj_align_origo_core(obj, base, align, true, false, x_ofs, 0);
+ obj_align_mid_core(obj, base, align, true, false, x_ofs, 0);
}
@@ -1011,7 +1011,7 @@ void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig
* @param align type of alignment (see 'lv_align_t' enum)
* @param y_ofs y coordinate offset after alignment
*/
-void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs)
+void lv_obj_align_mid_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
@@ -1022,7 +1022,7 @@ void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
- obj_align_origo_core(obj, base, align, true, false, 0, y_ofs);
+ obj_align_mid_core(obj, base, align, true, false, 0, y_ofs);
}
/**
@@ -1034,8 +1034,8 @@ void lv_obj_realign(lv_obj_t * obj)
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
#if LV_USE_OBJ_REALIGN
- if(obj->realign.origo_align)
- lv_obj_align_origo(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs);
+ if(obj->realign.mid_align)
+ lv_obj_align_mid(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs);
else
lv_obj_align(obj, obj->realign.base, obj->realign.align, obj->realign.xofs, obj->realign.yofs);
#else
@@ -1783,7 +1783,8 @@ void lv_event_send_refresh_recursive(lv_obj_t * obj)
d = lv_disp_get_next(d);
}
- } else {
+ }
+ else {
lv_res_t res = lv_event_send_refresh(obj);
if(res != LV_RES_OK) return; /*If invalid returned do not check the children*/
@@ -3157,7 +3158,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
}
}
-
+#if LV_USE_OUTLINE
if(draw_dsc->outline_opa != LV_OPA_TRANSP) {
draw_dsc->outline_width = lv_obj_get_style_outline_width(obj, part);
if(draw_dsc->outline_width) {
@@ -3171,7 +3172,9 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
#endif
}
}
+#endif
+#if LV_USE_PATTERN
if(draw_dsc->pattern_opa != LV_OPA_TRANSP) {
draw_dsc->pattern_image = lv_obj_get_style_pattern_image(obj, part);
if(draw_dsc->pattern_image) {
@@ -3192,6 +3195,8 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
}
}
}
+#endif
+
#if LV_USE_SHADOW
if(draw_dsc->shadow_opa > LV_OPA_MIN) {
draw_dsc->shadow_width = lv_obj_get_style_shadow_width(obj, part);
@@ -3210,6 +3215,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
}
#endif
+#if LV_USE_VALUE_STR
if(draw_dsc->value_opa > LV_OPA_MIN) {
draw_dsc->value_str = lv_obj_get_style_value_str(obj, part);
if(draw_dsc->value_str) {
@@ -3228,6 +3234,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
}
}
}
+#endif
#if LV_USE_OPA_SCALE
if(opa_scale < LV_OPA_MAX) {
@@ -3669,6 +3676,7 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
+ draw_dsc.value_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(obj, LV_OBJ_PART_MAIN, &draw_dsc);
lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_OBJ_PART_MAIN);
@@ -3885,7 +3893,7 @@ static void obj_align_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t ali
else if(y_set) lv_obj_set_y(obj, new_pos.y);
}
-static void obj_align_origo_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
+static void obj_align_mid_core(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, bool x_set, bool y_set,
lv_coord_t x_ofs, lv_coord_t y_ofs)
{
lv_coord_t new_x = lv_obj_get_x(obj);
diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h
index 9815d3b9b..5d10eb3bc 100644
--- a/src/lv_core/lv_obj.h
+++ b/src/lv_core/lv_obj.h
@@ -162,7 +162,7 @@ typedef struct {
lv_coord_t yofs;
lv_align_t align;
uint8_t auto_realign : 1;
- uint8_t origo_align : 1; /**< 1: the origo (center of the object) was aligned with
+ uint8_t mid_align : 1; /**< 1: the origo (center of the object) was aligned with
`lv_obj_align_origo`*/
} lv_realign_t;
#endif
@@ -494,7 +494,7 @@ void lv_obj_align_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
-void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
+void lv_obj_align_mid(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
/**
@@ -504,7 +504,7 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_ofs x coordinate offset after alignment
*/
-void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs);
+void lv_obj_align_mid_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs);
/**
* Align an object's middle point to an other object vertically.
@@ -513,7 +513,7 @@ void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t alig
* @param align type of alignment (see 'lv_align_t' enum)
* @param y_ofs y coordinate offset after alignment
*/
-void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs);
+void lv_obj_align_mid_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs);
/**
* Realign the object based on the last `lv_obj_align` parameters.
diff --git a/src/lv_core/lv_style.c b/src/lv_core/lv_style.c
index df1debc4d..887c4733b 100644
--- a/src/lv_core/lv_style.c
+++ b/src/lv_core/lv_style.c
@@ -1104,7 +1104,7 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
{
LV_ASSERT_STYLE_LIST(list);
- if(list->has_local) return lv_style_list_get_style(list, 0);
+ if(list->has_local) return lv_style_list_get_style(list, list->has_trans ? 1 : 0);
lv_style_t * local_style = lv_mem_alloc(sizeof(lv_style_t));
LV_ASSERT_MEM(local_style);
diff --git a/src/lv_draw/lv_draw_arc.c b/src/lv_draw/lv_draw_arc.c
index 27f6f1667..bcf94d000 100644
--- a/src/lv_draw/lv_draw_arc.c
+++ b/src/lv_draw/lv_draw_arc.c
@@ -65,17 +65,18 @@ static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t tickness,
* @param mask the arc will be drawn only in this mask
* @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right)
* @param end_angle the end angle of the arc
- * @param style style of the arc (`body.thickness`, `body.main_color`, `body.opa` is used)
- * @param opa_scale scale down all opacities by the factor
+ * @param clip_area the arc will be drawn only in this area
+ * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
- const lv_area_t * clip_area, lv_draw_line_dsc_t * dsc)
+ const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc)
{
if(dsc->opa <= LV_OPA_MIN) return;
if(dsc->width == 0) return;
if(start_angle == end_angle) return;
- if(dsc->width > radius) dsc->width = radius;
+ lv_style_int_t width = dsc->width;
+ if(width > radius) width = radius;
lv_draw_rect_dsc_t cir_dsc;
lv_draw_rect_dsc_init(&cir_dsc);
@@ -83,7 +84,7 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
cir_dsc.bg_opa = LV_OPA_TRANSP;
cir_dsc.border_opa = dsc->opa;
cir_dsc.border_color = dsc->color;
- cir_dsc.border_width = dsc->width;
+ cir_dsc.border_width = width;
cir_dsc.border_blend_mode = dsc->blend_mode;
lv_area_t area;
@@ -123,7 +124,7 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
q_dsc.end_angle = end_angle;
q_dsc.start_quarter = (start_angle / 90) & 0x3;
q_dsc.end_quarter = (end_angle / 90) & 0x3;
- q_dsc.width = dsc->width;
+ q_dsc.width = width;
q_dsc.draw_dsc = &cir_dsc;
q_dsc.draw_area = &area;
q_dsc.clip_area = clip_area;
@@ -146,7 +147,7 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
lv_area_t round_area;
if(dsc->round_start) {
- get_rounded_area(start_angle, radius, dsc->width, &round_area);
+ get_rounded_area(start_angle, radius, width, &round_area);
round_area.x1 += center_x;
round_area.x2 += center_x;
round_area.y1 += center_y;
@@ -156,7 +157,7 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
}
if(dsc->round_end) {
- get_rounded_area(end_angle, radius, dsc->width, &round_area);
+ get_rounded_area(end_angle, radius, width, &round_area);
round_area.x1 += center_x;
round_area.x2 += center_x;
round_area.y1 += center_y;
diff --git a/src/lv_draw/lv_draw_arc.h b/src/lv_draw/lv_draw_arc.h
index 7e1352eb9..a4b182410 100644
--- a/src/lv_draw/lv_draw_arc.h
+++ b/src/lv_draw/lv_draw_arc.h
@@ -35,11 +35,11 @@ extern "C" {
* @param mask the arc will be drawn only in this mask
* @param start_angle the start angle of the arc (0 deg on the bottom, 90 deg on the right)
* @param end_angle the end angle of the arc
- * @param style style of the arc (`body.thickness`, `body.main_color`, `body.opa` is used)
- * @param opa_scale scale down all opacities by the factor
+ * @param clip_area the arc will be drawn only in this area
+ * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
- const lv_area_t * clip_area, lv_draw_line_dsc_t * dsc);
+ const lv_area_t * clip_area, const lv_draw_line_dsc_t * dsc);
/**********************
* MACROS
diff --git a/src/lv_draw/lv_draw_img.c b/src/lv_draw/lv_draw_img.c
index b447d615e..47615724a 100644
--- a/src/lv_draw/lv_draw_img.c
+++ b/src/lv_draw/lv_draw_img.c
@@ -29,11 +29,11 @@
**********************/
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
const void * src,
- lv_draw_img_dsc_t * draw_dsc);
+ const lv_draw_img_dsc_t * draw_dsc);
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
const uint8_t * map_p,
- lv_draw_img_dsc_t * draw_dsc,
+ const lv_draw_img_dsc_t * draw_dsc,
bool chroma_key, bool alpha_byte);
static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, const char * msg);
@@ -65,13 +65,9 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
* @param coords the coordinates of the image
* @param mask the image will be drawn only in this area
* @param src pointer to a lv_color_t array which contains the pixels of the image
- * @param style style of the image
- * @param angle rotation angle of the image
- * @param center rotation center of the image
- * @param antialias anti-alias transformations (rotate, zoom) or not
- * @param opa_scale scale down all opacities by the factor
+ * @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
*/
-void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, lv_draw_img_dsc_t * dsc)
+void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc)
{
if(src == NULL) {
LV_LOG_WARN("Image draw: src is NULL");
@@ -232,7 +228,7 @@ lv_img_src_t lv_img_src_get_type(const void * src)
LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords, const lv_area_t * clip_area,
const void * src,
- lv_draw_img_dsc_t * draw_dsc)
+ const lv_draw_img_dsc_t * draw_dsc)
{
if(draw_dsc->opa <= LV_OPA_MIN) return LV_RES_OK;
@@ -327,18 +323,14 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
* @param cords_p coordinates the color map
* @param mask_p the map will drawn only on this area (truncated to VDB area)
* @param map_p pointer to a lv_color_t array
- * @param opa opacity of the map
+ * @param draw_dsc pointer to an initialized `lv_draw_img_dsc_t` variable
* @param chroma_keyed true: enable transparency of LV_IMG_LV_COLOR_TRANSP color pixels
* @param alpha_byte true: extra alpha byte is inserted for every pixel
- * @param style style of the image
- * @param angle angle in degree
- * @param pivot center of rotation
- * @param zoom zoom factor
- * @param antialias anti-alias transformations (rotate, zoom) or not
*/
LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
const uint8_t * map_p,
- lv_draw_img_dsc_t * draw_dsc, bool chroma_key, bool alpha_byte)
+ const lv_draw_img_dsc_t * draw_dsc,
+ bool chroma_key, bool alpha_byte)
{
/* Use the clip area as draw area*/
lv_area_t draw_area;
diff --git a/src/lv_draw/lv_draw_img.h b/src/lv_draw/lv_draw_img.h
index 735777684..e4531d725 100644
--- a/src/lv_draw/lv_draw_img.h
+++ b/src/lv_draw/lv_draw_img.h
@@ -53,13 +53,9 @@ void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc);
* @param coords the coordinates of the image
* @param mask the image will be drawn only in this area
* @param src pointer to a lv_color_t array which contains the pixels of the image
- * @param style style of the image
- * @param angle rotation angle of the image
- * @param center rotation center of the image
- * @param antialias anti-alias transformations (rotate, zoom) or not
- * @param opa_scale scale down all opacities by the factor
+ * @param dsc pointer to an initialized `lv_draw_img_dsc_t` variable
*/
-void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, lv_draw_img_dsc_t * dsc);
+void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, const void * src, const lv_draw_img_dsc_t * dsc);
/**
* Get the type of an image source
diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c
index 1cf8f6320..113393e34 100644
--- a/src/lv_draw/lv_draw_label.c
+++ b/src/lv_draw/lv_draw_label.c
@@ -111,8 +111,10 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
* @param hint pointer to a `lv_draw_label_hint_t` variable.
* It is managed by the drawer to speed up the drawing of very long texts (thousands of lines).
*/
-LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_label_dsc_t * dsc,
- const char * txt, lv_draw_label_hint_t * hint)
+LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask,
+ const lv_draw_label_dsc_t * dsc,
+ const char * txt,
+ lv_draw_label_hint_t * hint)
{
if(dsc->opa <= LV_OPA_MIN) return;
@@ -213,12 +215,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
sel_start = sel_end;
sel_end = tmp;
}
-
lv_draw_line_dsc_t line_dsc;
+
if((dsc->decor & LV_TEXT_DECOR_UNDERLINE) || (dsc->decor & LV_TEXT_DECOR_STRIKETHROUGH)) {
lv_draw_line_dsc_init(&line_dsc);
line_dsc.color = dsc->color;
- line_dsc.width = (dsc->font->line_height + 5) / 10; /*+5 for rounding*/
+ line_dsc.width = font->underline_thickness ? font->underline_thickness : LV_MATH_MAX(font->line_height / 10, 1);
line_dsc.opa = dsc->opa;
line_dsc.blend_mode = dsc->blend_mode;
}
@@ -342,7 +344,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
lv_point_t p1;
lv_point_t p2;
p1.x = pos_x_start;
- p1.y = pos.y + dsc->font->line_height - dsc->font->base_line + line_dsc.width / 2 + 1;
+ p1.y = pos.y + dsc->font->line_height - dsc->font->base_line - font->underline_position;
p2.x = pos.x;
p2.y = p1.y;
lv_draw_line(&p1, &p2, mask, &line_dsc);
diff --git a/src/lv_draw/lv_draw_label.h b/src/lv_draw/lv_draw_label.h
index a81aeae74..b28381002 100644
--- a/src/lv_draw/lv_draw_label.h
+++ b/src/lv_draw/lv_draw_label.h
@@ -77,7 +77,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc);
* @param hint pointer to a `lv_draw_label_hint_t` variable.
* It is managed by the drawer to speed up the drawing of very long texts (thousands of lines).
*/
-LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_label_dsc_t * dsc,
+LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask,
+ const lv_draw_label_dsc_t * dsc,
const char * txt, lv_draw_label_hint_t * hint);
//! @endcond
diff --git a/src/lv_draw/lv_draw_line.c b/src/lv_draw/lv_draw_line.c
index 2a22ec509..38e29cdfb 100644
--- a/src/lv_draw/lv_draw_line.c
+++ b/src/lv_draw/lv_draw_line.c
@@ -26,13 +26,13 @@
**********************/
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc);
+ const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc);
+ const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc);
+ const lv_draw_line_dsc_t * dsc);
/**********************
* STATIC VARIABLES
@@ -58,12 +58,11 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
* Draw a line
* @param point1 first point of the line
* @param point2 second point of the line
- * @param mask the line will be drawn only on this area
- * @param style pointer to a line's style
- * @param opa_scale scale down all opacities by the factor
+ * @param clip the line will be drawn only in this area
+ * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc)
+ const lv_draw_line_dsc_t * dsc)
{
if(dsc->width == 0) return;
if(dsc->opa <= LV_OPA_MIN) return;
@@ -120,7 +119,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_poin
LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const lv_point_t * point2,
const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc)
+ const lv_draw_line_dsc_t * dsc)
{
lv_opa_t opa = dsc->opa;
@@ -221,7 +220,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc)
+ const lv_draw_line_dsc_t * dsc)
{
lv_opa_t opa = dsc->opa;
@@ -316,7 +315,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
const lv_area_t * clip,
- lv_draw_line_dsc_t * dsc)
+ const lv_draw_line_dsc_t * dsc)
{
/*Keep the great y in p1*/
lv_point_t p1;
diff --git a/src/lv_draw/lv_draw_line.h b/src/lv_draw/lv_draw_line.h
index abc2e9819..eb4bbaf58 100644
--- a/src/lv_draw/lv_draw_line.h
+++ b/src/lv_draw/lv_draw_line.h
@@ -43,12 +43,11 @@ typedef struct {
* Draw a line
* @param point1 first point of the line
* @param point2 second point of the line
- * @param mask the line will be drawn only on this area
- * @param style pointer to a line's style
- * @param opa_scale scale down all opacities by the factor
+ * @param clip the line will be drawn only in this area
+ * @param dsc pointer to an initialized `lv_draw_line_dsc_t` variable
*/
-LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * mask,
- lv_draw_line_dsc_t * dsc);
+LV_ATTRIBUTE_FAST_MEM void lv_draw_line(const lv_point_t * point1, const lv_point_t * point2, const lv_area_t * clip,
+ const lv_draw_line_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc);
diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c
index f624d99e8..b4ce5a0b4 100644
--- a/src/lv_draw/lv_draw_rect.c
+++ b/src/lv_draw/lv_draw_rect.c
@@ -27,21 +27,32 @@
/**********************
* STATIC PROTOTYPES
**********************/
-LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
+LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip,
+ const lv_draw_rect_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
- lv_draw_rect_dsc_t * dsc);
-static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
-LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
+ const lv_draw_rect_dsc_t * dsc);
+
+#if LV_USE_OUTLINE
+ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc);
+#endif
#if LV_USE_SHADOW
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
- lv_draw_rect_dsc_t * dsc);
+ const lv_draw_rect_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t s,
lv_coord_t r);
LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
#endif
-static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
-static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc);
-static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip, lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
+
+#if LV_USE_PATTERN
+ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc);
+#endif
+
+#if LV_USE_VALUE_STR
+ static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc);
+#endif
+static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
+ lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
+LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
/**********************
* STATIC VARIABLES
@@ -86,9 +97,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
* Draw a rectangle
* @param coords the coordinates of the rectangle
* @param mask the rectangle will be drawn only in this mask
- * @param style pointer to a style
+ * @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
-void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
+void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc)
{
if(lv_area_get_height(coords) < 1 || lv_area_get_width(coords) < 1) return;
#if LV_USE_SHADOW
@@ -96,10 +107,19 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect
#endif
draw_bg(coords, clip, dsc);
+
+#if LV_USE_PATTERN
draw_pattern(coords, clip, dsc);
+#endif
draw_border(coords, clip, dsc);
- draw_value(coords, clip, dsc);
+
+#if LV_USE_VALUE_STR
+ draw_value_str(coords, clip, dsc);
+#endif
+
+#if LV_USE_OUTLINE
draw_outline(coords, clip, dsc);
+#endif
LV_ASSERT_MEM_INTEGRITY();
}
@@ -143,7 +163,8 @@ void lv_draw_px(const lv_point_t * point, const lv_area_t * clip_area, const lv_
* STATIC FUNCTIONS
**********************/
-LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
+LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip,
+ const lv_draw_rect_dsc_t * dsc)
{
if(dsc->bg_opa <= LV_OPA_MIN) return;
@@ -365,7 +386,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
}
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
- lv_draw_rect_dsc_t * dsc)
+ const lv_draw_rect_dsc_t * dsc)
{
if(dsc->border_opa <= LV_OPA_MIN) return;
if(dsc->border_width == 0) return;
@@ -467,8 +488,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
for(h = draw_area.y1; h <= draw_area.y2; h++) {
if(normal ||
- (top_only && fill_area.y1 <= coords->y1 + corner_size) ||
- (bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
+ (top_only && fill_area.y1 <= coords->y1 + corner_size) ||
+ (bottom_only && fill_area.y1 >= coords->y2 - corner_size)) {
_lv_memset_ff(mask_buf, draw_area_w);
mask_res = lv_draw_mask_apply(mask_buf, vdb->area.x1 + draw_area.x1, vdb->area.y1 + h, draw_area_w);
_lv_blend_fill(clip, &fill_area, color, mask_buf + buf_ofs, mask_res, opa, blend_mode);
@@ -483,7 +504,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
}
}
-LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i)
+LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i)
{
int32_t min = (dsc->bg_main_color_stop * s) >> 8;
if(i <= min) return dsc->bg_color;
@@ -500,7 +521,7 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(lv_draw_rect_dsc_t * dsc
#if LV_USE_SHADOW
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
- lv_draw_rect_dsc_t * dsc)
+ const lv_draw_rect_dsc_t * dsc)
{
/*Check whether the shadow is visible*/
if(dsc->shadow_width == 0) return;
@@ -1128,7 +1149,8 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
#endif
-static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
+#if LV_USE_OUTLINE
+static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc)
{
if(dsc->outline_opa <= LV_OPA_MIN) return;
if(dsc->outline_width == 0) return;
@@ -1153,10 +1175,13 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
area_outer.y1 -= dsc->outline_width;
area_outer.y2 += dsc->outline_width;
- draw_full_border(&area_inner, &area_outer, clip, dsc->radius, dsc->outline_color, dsc->outline_opa, dsc->outline_blend_mode);
+ draw_full_border(&area_inner, &area_outer, clip, dsc->radius, dsc->outline_color, dsc->outline_opa,
+ dsc->outline_blend_mode);
}
+#endif
-static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
+#if LV_USE_PATTERN
+static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc)
{
if(dsc->pattern_image == NULL) return;
if(dsc->pattern_opa <= LV_OPA_MIN) return;
@@ -1256,9 +1281,11 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_dr
lv_draw_mask_remove_id(radius_mask_id);
}
}
+#endif
-static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
+#if LV_USE_VALUE_STR
+static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc)
{
if(dsc->value_str == NULL) return;
if(dsc->value_opa <= LV_OPA_MIN) return;
@@ -1291,8 +1318,10 @@ static void draw_value(const lv_area_t * coords, const lv_area_t * clip, lv_draw
lv_draw_label(&value_area, clip, &label_dsc, dsc->value_str, NULL);
}
+#endif
-static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip, lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
+static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
+ lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
{
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
bool simple_mode = true;
diff --git a/src/lv_draw/lv_draw_rect.h b/src/lv_draw/lv_draw_rect.h
index 3b6dc5bf3..17f4a7248 100644
--- a/src/lv_draw/lv_draw_rect.h
+++ b/src/lv_draw/lv_draw_rect.h
@@ -92,9 +92,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc);
* Draw a rectangle
* @param coords the coordinates of the rectangle
* @param mask the rectangle will be drawn only in this mask
- * @param style pointer to a style
+ * @param dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
-void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, lv_draw_rect_dsc_t * dsc);
+void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_draw_rect_dsc_t * dsc);
/**
* Draw a pixel
diff --git a/src/lv_draw/lv_draw_triangle.c b/src/lv_draw/lv_draw_triangle.c
index 72a4a7fe2..08bcf6af2 100644
--- a/src/lv_draw/lv_draw_triangle.c
+++ b/src/lv_draw/lv_draw_triangle.c
@@ -40,7 +40,7 @@
* @param clip_area the triangle will be drawn only in this area
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
-void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, lv_draw_rect_dsc_t * draw_dsc)
+void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, const lv_draw_rect_dsc_t * draw_dsc)
{
lv_draw_polygon(points, 3, clip_area, draw_dsc);
}
@@ -53,7 +53,7 @@ void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip_area, lv
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * clip_area,
- lv_draw_rect_dsc_t * draw_dsc)
+ const lv_draw_rect_dsc_t * draw_dsc)
{
if(point_cnt < 3) return;
if(points == NULL) return;
diff --git a/src/lv_draw/lv_draw_triangle.h b/src/lv_draw/lv_draw_triangle.h
index 242ce30f9..64a7b1c81 100644
--- a/src/lv_draw/lv_draw_triangle.h
+++ b/src/lv_draw/lv_draw_triangle.h
@@ -33,7 +33,7 @@ extern "C" {
* @param clip_area the triangle will be drawn only in this area
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
-void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, lv_draw_rect_dsc_t * draw_dsc);
+void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, const lv_draw_rect_dsc_t * draw_dsc);
/**
* Draw a polygon. Only convex polygons are supported.
@@ -43,7 +43,7 @@ void lv_draw_triangle(const lv_point_t points[], const lv_area_t * clip, lv_draw
* @param draw_dsc pointer to an initialized `lv_draw_rect_dsc_t` variable
*/
void lv_draw_polygon(const lv_point_t points[], uint16_t point_cnt, const lv_area_t * mask,
- lv_draw_rect_dsc_t * draw_dsc);
+ const lv_draw_rect_dsc_t * draw_dsc);
/**********************
* MACROS
diff --git a/src/lv_draw/lv_img_buf.c b/src/lv_draw/lv_img_buf.c
index 8838c32ab..5ddf40577 100644
--- a/src/lv_draw/lv_img_buf.c
+++ b/src/lv_draw/lv_img_buf.c
@@ -435,6 +435,10 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
dsc->tmp.sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
dsc->tmp.cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
+ /*Use smaller value to avoid overflow*/
+ dsc->tmp.sinma = dsc->tmp.sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
+ dsc->tmp.cosma = dsc->tmp.cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
+
dsc->tmp.chroma_keyed = lv_img_cf_is_chroma_keyed(dsc->cfg.cf) ? 1 : 0;
dsc->tmp.has_alpha = lv_img_cf_has_alpha(dsc->cfg.cf) ? 1 : 0;
if(dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR || dsc->cfg.cf == LV_IMG_CF_TRUE_COLOR_ALPHA ||
@@ -468,7 +472,7 @@ void _lv_img_buf_transform_init(lv_img_transform_dsc_t * dsc)
* @param pivot x,y pivot coordinates of rotation
*/
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
- lv_point_t * pivot)
+ const lv_point_t * pivot)
{
#if LV_USE_IMG_TRANSFORM
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) {
@@ -493,6 +497,10 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10;
int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10;
+ /*Use smaller value to avoid overflow*/
+ sinma = sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
+ cosma = cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT);
+
lv_point_t lt;
lv_point_t rt;
lv_point_t lb;
@@ -509,23 +517,23 @@ void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t
xt = a.x1;
yt = a.y1;
- lt.x = ((cosma * xt - sinma * yt) >> LV_TRIGO_SHIFT) + pivot->x;
- lt.y = ((sinma * xt + cosma * yt) >> LV_TRIGO_SHIFT) + pivot->y;
+ lt.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
+ lt.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
xt = a.x2;
yt = a.y1;
- rt.x = ((cosma * xt - sinma * yt) >> LV_TRIGO_SHIFT) + pivot->x;
- rt.y = ((sinma * xt + cosma * yt) >> LV_TRIGO_SHIFT) + pivot->y;
+ rt.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
+ rt.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
xt = a.x1;
yt = a.y2;
- lb.x = ((cosma * xt - sinma * yt) >> LV_TRIGO_SHIFT) + pivot->x;
- lb.y = ((sinma * xt + cosma * yt) >> LV_TRIGO_SHIFT) + pivot->y;
+ lb.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
+ lb.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
xt = a.x2;
yt = a.y2;
- rb.x = ((cosma * xt - sinma * yt) >> LV_TRIGO_SHIFT) + pivot->x;
- rb.y = ((sinma * xt + cosma * yt) >> LV_TRIGO_SHIFT) + pivot->y;
+ rb.x = ((cosma * xt - sinma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x;
+ rb.y = ((sinma * xt + cosma * yt) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y;
res->x1 = LV_MATH_MIN4(lb.x, lt.x, rb.x, rt.x);
res->x2 = LV_MATH_MAX4(lb.x, lt.x, rb.x, rt.x);
diff --git a/src/lv_draw/lv_img_buf.h b/src/lv_draw/lv_img_buf.h
index 204f3c1d8..d0d3991fc 100644
--- a/src/lv_draw/lv_img_buf.h
+++ b/src/lv_draw/lv_img_buf.h
@@ -48,6 +48,8 @@ extern "C" {
#define LV_IMG_ZOOM_NONE 256
+#define _LV_TRANSFORM_TRIGO_SHIFT 10
+
/**********************
* TYPEDEFS
**********************/
@@ -301,8 +303,8 @@ static inline bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_
int32_t ys;
if(dsc->cfg.zoom == LV_IMG_ZOOM_NONE) {
/*Get the source pixel from the upscaled image*/
- xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (LV_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_x_256;
- ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (LV_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256;
+ xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_x_256;
+ ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT - 8)) + dsc->tmp.pivot_y_256;
}
else if(dsc->cfg.angle == 0) {
xt *= dsc->tmp.zoom_inv;
@@ -313,8 +315,8 @@ static inline bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_
else {
xt *= dsc->tmp.zoom_inv;
yt *= dsc->tmp.zoom_inv;
- xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (LV_TRIGO_SHIFT)) + dsc->tmp.pivot_x_256;
- ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (LV_TRIGO_SHIFT)) + dsc->tmp.pivot_y_256;
+ xs = ((dsc->tmp.cosma * xt - dsc->tmp.sinma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT)) + dsc->tmp.pivot_x_256;
+ ys = ((dsc->tmp.sinma * xt + dsc->tmp.cosma * yt) >> (_LV_TRANSFORM_TRIGO_SHIFT)) + dsc->tmp.pivot_y_256;
}
/*Get the integer part of the source pixel*/
@@ -380,7 +382,7 @@ static inline bool _lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_
* @param pivot x,y pivot coordinates of rotation
*/
void _lv_img_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, int16_t angle, uint16_t zoom,
- lv_point_t * pivot);
+ const lv_point_t * pivot);
/**********************
* MACROS
diff --git a/src/lv_draw/lv_img_cache.c b/src/lv_draw/lv_img_cache.c
index 8db00b175..cef32144f 100644
--- a/src/lv_draw/lv_img_cache.c
+++ b/src/lv_draw/lv_img_cache.c
@@ -59,7 +59,7 @@ static uint16_t entry_cnt;
* The image will be left open meaning if the image decoder open callback allocated memory then it will remain.
* The image is closed if a new image is opened and the new image takes its place in the cache.
* @param src source of the image. Path to file or pointer to an `lv_img_dsc_t` variable
- * @param style style of the image
+ * @param color color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return pointer to the cache entry or NULL if can open the image
*/
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color)
diff --git a/src/lv_draw/lv_img_cache.h b/src/lv_draw/lv_img_cache.h
index 641785f8c..6106aff90 100644
--- a/src/lv_draw/lv_img_cache.h
+++ b/src/lv_draw/lv_img_cache.h
@@ -46,7 +46,7 @@ typedef struct {
* The image will be left open meaning if the image decoder open callback allocated memory then it will remain.
* The image is closed if a new image is opened and the new image takes its place in the cache.
* @param src source of the image. Path to file or pointer to an `lv_img_dsc_t` variable
- * @param style style of the image
+ * @param color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return pointer to the cache entry or NULL if can open the image
*/
lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color);
diff --git a/src/lv_draw/lv_img_decoder.c b/src/lv_draw/lv_img_decoder.c
index 0c2f67d72..895c064bb 100644
--- a/src/lv_draw/lv_img_decoder.c
+++ b/src/lv_draw/lv_img_decoder.c
@@ -114,7 +114,7 @@ lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header)
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK`
- * @param style the style of the image
+ * @param color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return LV_RES_OK: opened the image. `dsc->img_data` and `dsc->header` are set.
* LV_RES_INV: none of the registered image decoders were able to open the image.
*/
@@ -559,7 +559,7 @@ static lv_res_t lv_img_decoder_built_in_line_true_color(lv_img_decoder_dsc_t * d
}
uint32_t btr = len * (px_size >> 3);
uint32_t br = 0;
- lv_fs_read(user_data->f, buf, btr, &br);
+ res = lv_fs_read(user_data->f, buf, btr, &br);
if(res != LV_FS_RES_OK || btr != br) {
LV_LOG_WARN("Built-in image decoder read failed");
return LV_RES_INV;
diff --git a/src/lv_draw/lv_img_decoder.h b/src/lv_draw/lv_img_decoder.h
index 980816425..8e3cf2662 100644
--- a/src/lv_draw/lv_img_decoder.h
+++ b/src/lv_draw/lv_img_decoder.h
@@ -157,7 +157,7 @@ lv_res_t lv_img_decoder_get_info(const char * src, lv_img_header_t * header);
* 1) File name: E.g. "S:folder/img1.png" (The drivers needs to registered via `lv_fs_add_drv()`)
* 2) Variable: Pointer to an `lv_img_dsc_t` variable
* 3) Symbol: E.g. `LV_SYMBOL_OK`
- * @param style the style of the image
+ * @param color The color of the image with `LV_IMG_CF_ALPHA_...`
* @return LV_RES_OK: opened the image. `dsc->img_data` and `dsc->header` are set.
* LV_RES_INV: none of the registered image decoders were able to open the image.
*/
diff --git a/src/lv_font/lv_font.h b/src/lv_font/lv_font.h
index 041211acd..b3ecb881c 100644
--- a/src/lv_font/lv_font.h
+++ b/src/lv_font/lv_font.h
@@ -71,6 +71,10 @@ typedef struct _lv_font_struct {
lv_coord_t line_height; /**< The real line height where any text fits*/
lv_coord_t base_line; /**< Base line measured from the top of the line_height*/
uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/
+
+ int8_t underline_position; /**< Distance between the top of the underline and base line (< 0 means below the base line)*/
+ int8_t underline_thickness; /**< Thickness of the underline*/
+
void * dsc; /**< Store implementation specific or run_time data or caching here*/
#if LV_USE_USER_DATA
lv_font_user_data_t user_data; /**< Custom user data for font. */
diff --git a/src/lv_misc/lv_color.h b/src/lv_misc/lv_color.h
index 1b557788c..8268668e6 100644
--- a/src/lv_misc/lv_color.h
+++ b/src/lv_misc/lv_color.h
@@ -596,19 +596,26 @@ static inline uint8_t lv_color_brightness(lv_color_t color)
return (uint8_t)(bright >> 3);
}
+#ifdef __cplusplus
+/* Fix of msvc 2019 compiler error C4576 inside C++ code */
+#define _LV_COLOR_MAKE_TYPE_HELPER lv_color_t
+#else
+#define _LV_COLOR_MAKE_TYPE_HELPER (lv_color_t)
+#endif
+
/* The most simple macro to create a color from R,G and B values */
#if LV_COLOR_DEPTH == 1
-#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){.full = (uint8_t)((b8 >> 7) | (g8 >> 7) | (r8 >> 7))})
+#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{.full = (uint8_t)((b8 >> 7) | (g8 >> 7) | (r8 >> 7))})
#elif LV_COLOR_DEPTH == 8
-#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(uint8_t)((b8 >> 6) & 0x3U), (uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 5) & 0x7U)}})
+#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((b8 >> 6) & 0x3U), (uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 5) & 0x7U)}})
#elif LV_COLOR_DEPTH == 16
#if LV_COLOR_16_SWAP == 0
-#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x3FU), (uint16_t)((r8 >> 3) & 0x1FU)}})
+#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x3FU), (uint16_t)((r8 >> 3) & 0x1FU)}})
#else
-#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{(uint16_t)((g8 >> 5) & 0x7U), (uint16_t)((r8 >> 3) & 0x1FU), (uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x7U)}})
+#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint16_t)((g8 >> 5) & 0x7U), (uint16_t)((r8 >> 3) & 0x1FU), (uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x7U)}})
#endif
#elif LV_COLOR_DEPTH == 32
-#define LV_COLOR_MAKE(r8, g8, b8) ((lv_color_t){{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/
+#define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/
#endif
static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b)
diff --git a/src/lv_misc/lv_mem.c b/src/lv_misc/lv_mem.c
index 8775f39da..7fa3146f8 100644
--- a/src/lv_misc/lv_mem.c
+++ b/src/lv_misc/lv_mem.c
@@ -586,6 +586,7 @@ void _lv_mem_buf_free_all(void)
}
}
+#if LV_MEMCPY_MEMSET_STD == 0
/**
* Same as `memcpy` but optimized for 4 byte operation.
* @param dst pointer to the destination buffer
@@ -652,7 +653,6 @@ LV_ATTRIBUTE_FAST_MEM void * _lv_memcpy(void * dst, const void * src, size_t len
/**
* Same as `memset` but optimized for 4 byte operation.
- * `dst` should be word aligned else normal `memcpy` will be used
* @param dst pointer to the destination buffer
* @param v value to set [0..255]
* @param len number of byte to set
@@ -707,7 +707,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset(void * dst, uint8_t v, size_t len)
/**
* Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation.
- * `dst` should be word aligned else normal `memcpy` will be used
* @param dst pointer to the destination buffer
* @param len number of byte to set
*/
@@ -757,7 +756,6 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_00(void * dst, size_t len)
/**
* Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation.
- * `dst` should be word aligned else normal `memcpy` will be used
* @param dst pointer to the destination buffer
* @param len number of byte to set
*/
@@ -805,6 +803,7 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len)
}
}
+#endif /*LV_MEMCPY_MEMSET_STD*/
/**********************
* STATIC FUNCTIONS
diff --git a/src/lv_misc/lv_mem.h b/src/lv_misc/lv_mem.h
index 91774133a..f3ca9c6f2 100644
--- a/src/lv_misc/lv_mem.h
+++ b/src/lv_misc/lv_mem.h
@@ -20,6 +20,10 @@ extern "C" {
#include "lv_log.h"
#include "lv_types.h"
+#if LV_MEMCPY_MEMSET_STD
+#include