This commit is contained in:
github-actions[bot]
2020-08-04 07:20:47 +00:00
committed by GitHub
7 changed files with 143 additions and 15 deletions

View File

@@ -11,7 +11,8 @@
- Add `lv_event_send_refresh`, `lv_event_send_refresh_recursive` to easily send `LV_EVENT_REFRESH` to object - Add `lv_event_send_refresh`, `lv_event_send_refresh_recursive` to easily send `LV_EVENT_REFRESH` to object
- Add `lv_tabview_set_tab_name()` function - used to change a tab's name - 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 - 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 - Reduce code size by adding: `LV_USE_FONT_COMPRESSED`, `LV_FONT_USE_SUBPX`, `LV_USE_OUTLINE`, `LV_USE_PATTERN`, `LV_USE_VALUE_STR` and applying some optimization
- Add `LV_MEMCPY_MEMSET_STD` to use standard `memcpy` and `memset`
### Bugfixes ### Bugfixes

View File

@@ -97,6 +97,10 @@ typedef int16_t lv_coord_t;
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ # define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/ #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 /* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */ * Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0 #define LV_ENABLE_GC 0
@@ -150,7 +154,7 @@ typedef void * lv_anim_user_data_t;
#endif #endif
/* 1: Enable shadow drawing*/ /* 1: Enable shadow drawing on rectangles*/
#define LV_USE_SHADOW 1 #define LV_USE_SHADOW 1
#if LV_USE_SHADOW #if LV_USE_SHADOW
/* Allow buffering some shadow calculation /* Allow buffering some shadow calculation
@@ -160,6 +164,15 @@ typedef void * lv_anim_user_data_t;
#define LV_SHADOW_CACHE_SIZE 0 #define LV_SHADOW_CACHE_SIZE 0
#endif #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_...`)*/ /* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 1 #define LV_USE_BLEND_MODES 1

View File

@@ -147,6 +147,12 @@
#endif #endif
#endif /*LV_MEM_CUSTOM*/ #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 /* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */ * Used if lvgl is binded to higher level language and the memory is managed by that language */
#ifndef LV_ENABLE_GC #ifndef LV_ENABLE_GC
@@ -223,7 +229,7 @@
#endif #endif
/* 1: Enable shadow drawing*/ /* 1: Enable shadow drawing on rectangles*/
#ifndef LV_USE_SHADOW #ifndef LV_USE_SHADOW
#define LV_USE_SHADOW 1 #define LV_USE_SHADOW 1
#endif #endif
@@ -237,6 +243,21 @@
#endif #endif
#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_...`)*/ /* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#ifndef LV_USE_BLEND_MODES #ifndef LV_USE_BLEND_MODES
#define LV_USE_BLEND_MODES 1 #define LV_USE_BLEND_MODES 1
@@ -633,7 +654,10 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
/* A fast and impressive theme. /* A fast and impressive theme.
* Flags: * Flags:
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme * 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 #ifndef LV_USE_THEME_MATERIAL
#define LV_USE_THEME_MATERIAL 1 #define LV_USE_THEME_MATERIAL 1
#endif #endif

View File

@@ -3157,7 +3157,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) { if(draw_dsc->outline_opa != LV_OPA_TRANSP) {
draw_dsc->outline_width = lv_obj_get_style_outline_width(obj, part); draw_dsc->outline_width = lv_obj_get_style_outline_width(obj, part);
if(draw_dsc->outline_width) { if(draw_dsc->outline_width) {
@@ -3171,7 +3171,9 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
#endif #endif
} }
} }
#endif
#if LV_USE_PATTERN
if(draw_dsc->pattern_opa != LV_OPA_TRANSP) { if(draw_dsc->pattern_opa != LV_OPA_TRANSP) {
draw_dsc->pattern_image = lv_obj_get_style_pattern_image(obj, part); draw_dsc->pattern_image = lv_obj_get_style_pattern_image(obj, part);
if(draw_dsc->pattern_image) { if(draw_dsc->pattern_image) {
@@ -3192,6 +3194,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 LV_USE_SHADOW
if(draw_dsc->shadow_opa > LV_OPA_MIN) { if(draw_dsc->shadow_opa > LV_OPA_MIN) {
draw_dsc->shadow_width = lv_obj_get_style_shadow_width(obj, part); draw_dsc->shadow_width = lv_obj_get_style_shadow_width(obj, part);
@@ -3210,6 +3214,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
} }
#endif #endif
#if LV_USE_VALUE_STR
if(draw_dsc->value_opa > LV_OPA_MIN) { if(draw_dsc->value_opa > LV_OPA_MIN) {
draw_dsc->value_str = lv_obj_get_style_value_str(obj, part); draw_dsc->value_str = lv_obj_get_style_value_str(obj, part);
if(draw_dsc->value_str) { if(draw_dsc->value_str) {
@@ -3228,6 +3233,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 LV_USE_OPA_SCALE
if(opa_scale < LV_OPA_MAX) { if(opa_scale < LV_OPA_MAX) {

View File

@@ -30,8 +30,10 @@
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, 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_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
lv_draw_rect_dsc_t * dsc); lv_draw_rect_dsc_t * dsc);
#if LV_USE_OUTLINE
static void draw_outline(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); #endif
#if LV_USE_SHADOW #if LV_USE_SHADOW
LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip,
lv_draw_rect_dsc_t * dsc); lv_draw_rect_dsc_t * dsc);
@@ -39,9 +41,16 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord
lv_coord_t r); 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); LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf);
#endif #endif
#if LV_USE_PATTERN
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc); 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); #endif
#if LV_USE_VALUE_STR
static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, 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); 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(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -96,10 +105,19 @@ void lv_draw_rect(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect
#endif #endif
draw_bg(coords, clip, dsc); draw_bg(coords, clip, dsc);
#if LV_USE_PATTERN
draw_pattern(coords, clip, dsc); draw_pattern(coords, clip, dsc);
#endif
draw_border(coords, clip, dsc); 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); draw_outline(coords, clip, dsc);
#endif
LV_ASSERT_MEM_INTEGRITY(); LV_ASSERT_MEM_INTEGRITY();
} }
@@ -1128,6 +1146,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
#endif #endif
#if LV_USE_OUTLINE
static void draw_outline(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)
{ {
if(dsc->outline_opa <= LV_OPA_MIN) return; if(dsc->outline_opa <= LV_OPA_MIN) return;
@@ -1155,7 +1174,10 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, lv_dr
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
#if LV_USE_PATTERN
static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc) static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
{ {
if(dsc->pattern_image == NULL) return; if(dsc->pattern_image == NULL) return;
@@ -1256,9 +1278,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); 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, lv_draw_rect_dsc_t * dsc)
{ {
if(dsc->value_str == NULL) return; if(dsc->value_str == NULL) return;
if(dsc->value_opa <= LV_OPA_MIN) return; if(dsc->value_opa <= LV_OPA_MIN) return;
@@ -1291,6 +1315,7 @@ 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); 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)
{ {

View File

@@ -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. * Same as `memcpy` but optimized for 4 byte operation.
* @param dst pointer to the destination buffer * @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. * 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 dst pointer to the destination buffer
* @param v value to set [0..255] * @param v value to set [0..255]
* @param len number of byte to set * @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. * 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 dst pointer to the destination buffer
* @param len number of byte to set * @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. * 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 dst pointer to the destination buffer
* @param len number of byte to set * @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 * STATIC FUNCTIONS

View File

@@ -20,6 +20,10 @@ extern "C" {
#include "lv_log.h" #include "lv_log.h"
#include "lv_types.h" #include "lv_types.h"
#if LV_MEMCPY_MEMSET_STD
#include <string.h>
#endif
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
@@ -137,6 +141,62 @@ void _lv_mem_buf_free_all(void);
//! @cond Doxygen_Suppress //! @cond Doxygen_Suppress
#if LV_MEMCPY_MEMSET_STD
/**
* Wrapper for the standard memcpy
* @param dst pointer to the destination buffer
* @param src pointer to the source buffer
* @param len number of byte to copy
*/
static inline void * _lv_memcpy(void * dst, const void * src, size_t len)
{
return memcpy(dst, src, len);
}
/**
* Wrapper for the standard memcpy
* @param dst pointer to the destination buffer
* @param src pointer to the source buffer
* @param len number of byte to copy
*/
static inline void * _lv_memcpy_small(void * dst, const void * src, size_t len)
{
return memcpy(dst, src, len);
}
/**
* Wrapper for the standard memset
* @param dst pointer to the destination buffer
* @param v value to set [0..255]
* @param len number of byte to set
*/
static inline void _lv_memset(void * dst, uint8_t v, size_t len)
{
memset(dst, v, len);
}
/**
* Wrapper for the standard memset with fixed 0x00 value
* @param dst pointer to the destination buffer
* @param len number of byte to set
*/
static inline void _lv_memset_00(void * dst, size_t len)
{
memset(dst, 0x00, len);
}
/**
* Wrapper for the standard memset with fixed 0xFF value
* @param dst pointer to the destination buffer
* @param len number of byte to set
*/
static inline void _lv_memset_ff(void * dst, size_t len)
{
memset(dst, 0xFF, len);
}
#else
/** /**
* Same as `memcpy` but optimized for 4 byte operation. * Same as `memcpy` but optimized for 4 byte operation.
* @param dst pointer to the destination buffer * @param dst pointer to the destination buffer
@@ -168,7 +228,6 @@ LV_ATTRIBUTE_FAST_MEM static inline void * _lv_memcpy_small(void * dst, const vo
/** /**
* Same as `memset` but optimized for 4 byte operation. * 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 dst pointer to the destination buffer
* @param v value to set [0..255] * @param v value to set [0..255]
* @param len number of byte to set * @param len number of byte to set
@@ -177,7 +236,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. * 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 dst pointer to the destination buffer
* @param len number of byte to set * @param len number of byte to set
*/ */
@@ -185,7 +243,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. * 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 dst pointer to the destination buffer
* @param len number of byte to set * @param len number of byte to set
*/ */
@@ -193,6 +250,9 @@ LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len);
//! @endcond //! @endcond
#endif
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/