mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-01 16:58:33 +08:00
arch(conf, api) refactor lv_conf and some API (#3501)
Kconfig and MicroPython config is not updated yet. * start to refactor lv_conf.h * further mem refactoring * create lv_mem_builtin.c/h * update lv_conf_internal.h * add lv_strlen and lv_strncpy * rename LV_DRAW_COMPLEX to LV_USE_DRAW_MASK * update lv_conf_template * minor fix
This commit is contained in:
committed by
GitHub
parent
c03d817192
commit
5369d7d473
@@ -1342,7 +1342,7 @@ static void chart_event_cb(lv_event_t * e)
|
||||
|
||||
/*Add the faded area before the lines are drawn */
|
||||
else if(dsc->part == LV_PART_ITEMS) {
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
/*Add a line mask that keeps the area below the line*/
|
||||
if(dsc->p1 && dsc->p2) {
|
||||
lv_draw_mask_line_param_t line_mask_param;
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
MEMORY SETTINGS
|
||||
*=========================*/
|
||||
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_malloc()` and `lv_free()`*/
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (64U * 1024U) /*[bytes]*/
|
||||
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
@@ -112,20 +112,20 @@
|
||||
|
||||
/*Enable complex draw engine.
|
||||
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
|
||||
#define LV_DRAW_COMPLEX 1
|
||||
#if LV_DRAW_COMPLEX != 0
|
||||
#define LV_DRAW_SW_COMPLEX 1
|
||||
#if LV_DRAW_SW_COMPLEX != 0
|
||||
|
||||
/*Allow buffering some shadow calculation.
|
||||
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
*LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_DRAW_SW_SHADOW_CACHE_SIZE 0
|
||||
|
||||
/* Set number of maximally cached circle data.
|
||||
* The circumference of 1/4 circle are saved for anti-aliasing
|
||||
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
|
||||
* 0: to disable caching */
|
||||
#define LV_CIRCLE_CACHE_SIZE 4
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
#define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4
|
||||
#endif /*LV_DRAW_SW_COMPLEX*/
|
||||
|
||||
/**
|
||||
* "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer
|
||||
@@ -133,15 +133,15 @@
|
||||
* Note that `bg_opa`, `text_opa` etc don't require buffering into layer)
|
||||
* The widget can be buffered in smaller chunks to avoid using large buffers.
|
||||
*
|
||||
* - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it
|
||||
* - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated.
|
||||
* - LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it
|
||||
* - LV_DRAW_SW_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated.
|
||||
*
|
||||
* Both buffer sizes are in bytes.
|
||||
* "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers
|
||||
* and can't be drawn in chunks. So these settings affects only widgets with opacity.
|
||||
*/
|
||||
#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024)
|
||||
#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024)
|
||||
#define LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE (24 * 1024)
|
||||
#define LV_DRAW_SW_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024)
|
||||
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
@@ -156,20 +156,20 @@
|
||||
|
||||
/*Default gradient buffer size.
|
||||
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
|
||||
*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.
|
||||
*LV_DRAW_SW_GRADIENT_CACHE_DEF_SIZE sets the size of this cache in bytes.
|
||||
*If the cache is too small the map will be allocated only while it's required for the drawing.
|
||||
*0 mean no caching.*/
|
||||
#define LV_GRAD_CACHE_DEF_SIZE 0
|
||||
#define LV_DRAW_SW_GRADIENT_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
|
||||
*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface
|
||||
*LV_DRAW_SW_GRADIENT_DITHER implies allocating one or two more lines of the object's rendering surface
|
||||
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
|
||||
#define LV_DITHER_GRADIENT 0
|
||||
#if LV_DITHER_GRADIENT
|
||||
#define LV_DRAW_SW_GRADIENT_DITHER 0
|
||||
#if LV_DRAW_SW_GRADIENT_DITHER
|
||||
/*Add support for error diffusion dithering.
|
||||
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
|
||||
*The increase in memory consumption is (24 bits * object's width)*/
|
||||
#define LV_DITHER_ERROR_DIFFUSION 0
|
||||
#define LV_DRAW_SW_GRADIENT_DITHER_ERROR_DIFFUSION 0
|
||||
#endif
|
||||
|
||||
/*Maximum buffer size to allocate for rotation.
|
||||
@@ -203,13 +203,13 @@
|
||||
#endif
|
||||
|
||||
/*Use SDL renderer API*/
|
||||
#define LV_USE_GPU_SDL 0
|
||||
#if LV_USE_GPU_SDL
|
||||
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
#define LV_USE_DRAW_SDL 0
|
||||
#if LV_USE_DRAW_SDL
|
||||
#define LV_DARW_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
/*Texture cache size, 8MB by default*/
|
||||
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
#define LV_DARW_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
|
||||
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#define LV_DARW_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
@@ -397,10 +397,10 @@
|
||||
#define LV_USE_FONT_COMPRESSED 0
|
||||
|
||||
/*Enable subpixel rendering*/
|
||||
#define LV_USE_FONT_SUBPX 0
|
||||
#if LV_USE_FONT_SUBPX
|
||||
#define LV_DRAW_SW_FONT_SUBPX 0
|
||||
#if LV_DRAW_SW_FONT_SUBPX
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#define LV_DRAW_SW_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
/*Enable drawing placeholders when glyph dsc is not found*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_CHART && LV_USE_DRAW_MASKS && LV_BUILD_EXAMPLES
|
||||
|
||||
static lv_obj_t * chart1;
|
||||
static lv_chart_series_t * ser1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_CHART && LV_USE_DRAW_MASKS && LV_BUILD_EXAMPLES
|
||||
|
||||
/* A struct is used to keep track of the series list because later we need to draw to the series in the reverse order to which they were initialised. */
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_CHART && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_CHART && LV_USE_DRAW_MASKS && LV_BUILD_EXAMPLES
|
||||
|
||||
|
||||
static void add_data(lv_timer_t * t)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_LABEL && LV_USE_CANVAS && LV_BUILD_EXAMPLES && LV_DRAW_COMPLEX
|
||||
#if LV_USE_LABEL && LV_USE_CANVAS && LV_BUILD_EXAMPLES && LV_USE_DRAW_MASKS
|
||||
|
||||
#define MASK_WIDTH 100
|
||||
#define MASK_HEIGHT 45
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_ROLLER && LV_DRAW_COMPLEX && LV_BUILD_EXAMPLES
|
||||
#if LV_USE_ROLLER && LV_USE_DRAW_MASKS && LV_BUILD_EXAMPLES
|
||||
|
||||
static void mask_event_cb(lv_event_t * e)
|
||||
{
|
||||
@@ -28,14 +28,14 @@ static void mask_event_cb(lv_event_t * e)
|
||||
rect_area.y1 = roller_coords.y1;
|
||||
rect_area.y2 = roller_coords.y1 + (lv_obj_get_height(obj) - font_h - line_space) / 2;
|
||||
|
||||
lv_draw_mask_fade_param_t * fade_mask_top = lv_mem_buf_get(sizeof(lv_draw_mask_fade_param_t));
|
||||
lv_draw_mask_fade_param_t * fade_mask_top = lv_malloc(sizeof(lv_draw_mask_fade_param_t));
|
||||
lv_draw_mask_fade_init(fade_mask_top, &rect_area, LV_OPA_TRANSP, rect_area.y1, LV_OPA_COVER, rect_area.y2);
|
||||
mask_top_id = lv_draw_mask_add(fade_mask_top, NULL);
|
||||
|
||||
rect_area.y1 = rect_area.y2 + font_h + line_space - 1;
|
||||
rect_area.y2 = roller_coords.y2;
|
||||
|
||||
lv_draw_mask_fade_param_t * fade_mask_bottom = lv_mem_buf_get(sizeof(lv_draw_mask_fade_param_t));
|
||||
lv_draw_mask_fade_param_t * fade_mask_bottom = lv_malloc(sizeof(lv_draw_mask_fade_param_t));
|
||||
lv_draw_mask_fade_init(fade_mask_bottom, &rect_area, LV_OPA_COVER, rect_area.y1, LV_OPA_TRANSP, rect_area.y2);
|
||||
mask_bottom_id = lv_draw_mask_add(fade_mask_bottom, NULL);
|
||||
|
||||
@@ -45,8 +45,8 @@ static void mask_event_cb(lv_event_t * e)
|
||||
lv_draw_mask_fade_param_t * fade_mask_bottom = lv_draw_mask_remove_id(mask_bottom_id);
|
||||
lv_draw_mask_free_param(fade_mask_top);
|
||||
lv_draw_mask_free_param(fade_mask_bottom);
|
||||
lv_mem_buf_release(fade_mask_top);
|
||||
lv_mem_buf_release(fade_mask_bottom);
|
||||
lv_free(fade_mask_top);
|
||||
lv_free(fade_mask_bottom);
|
||||
mask_top_id = -1;
|
||||
mask_bottom_id = -1;
|
||||
}
|
||||
|
||||
+113
-134
@@ -26,30 +26,17 @@
|
||||
/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/
|
||||
#define LV_COLOR_DEPTH 16
|
||||
|
||||
/*Swap the 2 bytes of RGB565 color. Useful if the display has an 8-bit interface (e.g. SPI)*/
|
||||
#define LV_COLOR_16_SWAP 0
|
||||
|
||||
/*Enable features to draw on transparent background.
|
||||
*It's required if opa, and transform_* style properties are used.
|
||||
*Can be also used if the UI is above another layer, e.g. an OSD menu or video player.*/
|
||||
#define LV_COLOR_SCREEN_TRANSP 0
|
||||
|
||||
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
|
||||
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
|
||||
#define LV_COLOR_MIX_ROUND_OFS 0
|
||||
|
||||
/*Images pixels with this color will not be drawn if they are chroma keyed)*/
|
||||
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/
|
||||
#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00)
|
||||
|
||||
/*=========================
|
||||
MEMORY SETTINGS
|
||||
STDLIB WRAPPER SETTINGS
|
||||
*=========================*/
|
||||
|
||||
/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/
|
||||
#define LV_MEM_CUSTOM 0
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (48U * 1024U) /*[bytes]*/
|
||||
/*Enable and configure the built-in memory manager*/
|
||||
#define LV_USE_BUILTIN_MALLOC 1
|
||||
#if LV_USE_BUILTIN_MALLOC
|
||||
/*Size of the memory available for `lv_malloc()` in bytes (>= 2kB)*/
|
||||
#define LV_MEM_SIZE (128U * 1024U) /*[bytes]*/
|
||||
|
||||
/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/
|
||||
#define LV_MEM_ADR 0 /*0: unused*/
|
||||
@@ -58,31 +45,29 @@
|
||||
#undef LV_MEM_POOL_INCLUDE
|
||||
#undef LV_MEM_POOL_ALLOC
|
||||
#endif
|
||||
#endif /*LV_USE_BUILTIN_MALLOC*/
|
||||
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc
|
||||
#define LV_MEM_CUSTOM_FREE free
|
||||
#define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
/*Enable and configure the built-in (v)snprintf */
|
||||
#define LV_USE_BUILTIN_SNPRINTF 1
|
||||
#if LV_USE_BUILTIN_SNPRINTF
|
||||
#define LV_SPRINTF_USE_FLOAT 0
|
||||
#endif /*LV_USE_BUILTIN_SNPRINTF*/
|
||||
|
||||
/*Number of the intermediate memory buffer used during rendering and other internal processing mechanisms.
|
||||
*You will see an error log message if there wasn't enough buffers. */
|
||||
#define LV_MEM_BUF_MAX_NUM 16
|
||||
|
||||
/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/
|
||||
#define LV_MEMCPY_MEMSET_STD 0
|
||||
#define LV_STDLIB_INCLUDE <stdint.h>
|
||||
#define LV_MALLOC lv_malloc_builtin
|
||||
#define LV_REALLOC lv_realloc_builtin
|
||||
#define LV_FREE lv_free_builtin
|
||||
#define LV_MEMSET lv_memset_builtin
|
||||
#define LV_MEMCPY lv_memcpy_builtin
|
||||
#define LV_SNPRINTF lv_snprintf_builtin
|
||||
#define LV_VSNPRINTF lv_vsnprintf_builtin
|
||||
#define LV_STRLEN lv_strlen_builtin
|
||||
#define LV_STRNCPY lv_strncpy_builtin
|
||||
|
||||
/*====================
|
||||
HAL SETTINGS
|
||||
*====================*/
|
||||
|
||||
/*Default display refresh period. LVG will redraw changed areas with this period time*/
|
||||
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
|
||||
|
||||
/*Input device read period in milliseconds*/
|
||||
#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/
|
||||
|
||||
/*Use a custom tick source that tells the elapsed time in milliseconds.
|
||||
*It removes the need to manually update the tick with `lv_tick_inc()`)*/
|
||||
#define LV_TICK_CUSTOM 0
|
||||
@@ -95,83 +80,82 @@
|
||||
*(Not so important, you can adjust it to modify default sizes and spaces)*/
|
||||
#define LV_DPI_DEF 130 /*[px/inch]*/
|
||||
|
||||
/*=======================
|
||||
* FEATURE CONFIGURATION
|
||||
*=======================*/
|
||||
/*========================
|
||||
* DRAW CONFIGURATION
|
||||
*========================*/
|
||||
|
||||
/*-------------
|
||||
* Drawing
|
||||
*-----------*/
|
||||
/*Enable the built in mask engine.
|
||||
*Required to draw shadow, rounded corners, circles, arc, skew lines, or any other masks*/
|
||||
#define LV_USE_DRAW_MASKS 1
|
||||
|
||||
/*Enable complex draw engine.
|
||||
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
|
||||
#define LV_DRAW_COMPLEX 1
|
||||
#if LV_DRAW_COMPLEX != 0
|
||||
#define LV_USE_DRAW_SW 1
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
/*Enable complex draw engine.
|
||||
*Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/
|
||||
#define LV_DRAW_SW_COMPLEX 1
|
||||
|
||||
/* If a widget has `style_opa < 255` (not `bg_opa`, `text_opa` etc) or not NORMAL blend mode
|
||||
* it is buffered into a "simple" layer before rendering. The widget can be buffered in smaller chunks.
|
||||
* "Transformed layers" (if `transform_angle/zoom` are set) use larger buffers
|
||||
* and can't be drawn in chunks. */
|
||||
|
||||
/*The target buffer size for simple layer chunks.*/
|
||||
#define LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE (24 * 1024) /*[bytes]*/
|
||||
|
||||
/*Used if `LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated.*/
|
||||
#define LV_DRAW_SW_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024) /*[bytes]*/
|
||||
|
||||
/*Allow buffering some shadow calculation.
|
||||
*LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_SHADOW_CACHE_SIZE 0
|
||||
*LV_DRAW_SW_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius`
|
||||
*Caching has LV_DRAW_SW_SHADOW_CACHE_SIZE^2 RAM cost*/
|
||||
#define LV_DRAW_SW_SHADOW_CACHE_SIZE 0
|
||||
|
||||
/* Set number of maximally cached circle data.
|
||||
* The circumference of 1/4 circle are saved for anti-aliasing
|
||||
* radius * 4 bytes are used per circle (the most often used radiuses are saved)
|
||||
* 0: to disable caching */
|
||||
#define LV_CIRCLE_CACHE_SIZE 4
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
#define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4
|
||||
|
||||
/**
|
||||
* "Simple layers" are used when a widget has `style_opa < 255` to buffer the widget into a layer
|
||||
* and blend it as an image with the given opacity.
|
||||
* Note that `bg_opa`, `text_opa` etc don't require buffering into layer)
|
||||
* The widget can be buffered in smaller chunks to avoid using large buffers.
|
||||
*
|
||||
* - LV_LAYER_SIMPLE_BUF_SIZE: [bytes] the optimal target buffer size. LVGL will try to allocate it
|
||||
* - LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE: [bytes] used if `LV_LAYER_SIMPLE_BUF_SIZE` couldn't be allocated.
|
||||
*
|
||||
* Both buffer sizes are in bytes.
|
||||
* "Transformed layers" (where transform_angle/zoom properties are used) use larger buffers
|
||||
* and can't be drawn in chunks. So these settings affects only widgets with opacity.
|
||||
*/
|
||||
#define LV_LAYER_SIMPLE_BUF_SIZE (24 * 1024)
|
||||
#define LV_LAYER_SIMPLE_FALLBACK_BUF_SIZE (3 * 1024)
|
||||
/*Default gradient buffer size.
|
||||
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
|
||||
*LV_DRAW_SW_GRADIENT_CACHE_DEF_SIZE sets the size of this cache in bytes.
|
||||
*If the cache is too small the map will be allocated only while it's required for the drawing.
|
||||
*0 mean no caching.*/
|
||||
#define LV_DRAW_SW_GRADIENT_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Default image cache size. Image caching keeps the images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is added)
|
||||
*With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
|
||||
*However the opened images might consume additional RAM.
|
||||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
|
||||
*LV_DRAW_SW_GRADIENT_DITHER implies allocating one or two more lines of the object's rendering surface
|
||||
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
|
||||
#define LV_DRAW_SW_GRADIENT_DITHER 0
|
||||
#if LV_DRAW_SW_GRADIENT_DITHER
|
||||
/*Add support for error diffusion dithering.
|
||||
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
|
||||
*The increase in memory consumption is (24 bits * object's width)*/
|
||||
#define LV_DRAW_SW_GRADIENT_DITHER_ERROR_DIFFUSION 0
|
||||
#endif
|
||||
|
||||
/*Number of stops allowed per gradient. Increase this to allow more stops.
|
||||
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
|
||||
#define LV_GRADIENT_MAX_STOPS 2
|
||||
|
||||
/*Default gradient buffer size.
|
||||
*When LVGL calculates the gradient "maps" it can save them into a cache to avoid calculating them again.
|
||||
*LV_GRAD_CACHE_DEF_SIZE sets the size of this cache in bytes.
|
||||
*If the cache is too small the map will be allocated only while it's required for the drawing.
|
||||
*0 mean no caching.*/
|
||||
#define LV_GRAD_CACHE_DEF_SIZE 0
|
||||
|
||||
/*Allow dithering the gradients (to achieve visual smooth color gradients on limited color depth display)
|
||||
*LV_DITHER_GRADIENT implies allocating one or two more lines of the object's rendering surface
|
||||
*The increase in memory consumption is (32 bits * object width) plus 24 bits * object width if using error diffusion */
|
||||
#define LV_DITHER_GRADIENT 0
|
||||
#if LV_DITHER_GRADIENT
|
||||
/*Add support for error diffusion dithering.
|
||||
*Error diffusion dithering gets a much better visual result, but implies more CPU consumption and memory when drawing.
|
||||
*The increase in memory consumption is (24 bits * object's width)*/
|
||||
#define LV_DITHER_ERROR_DIFFUSION 0
|
||||
/*Enable subpixel rendering*/
|
||||
#define LV_DRAW_SW_FONT_SUBPX 0
|
||||
#if LV_DRAW_SW_FONT_SUBPX
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_DRAW_SW_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*Maximum buffer size to allocate for rotation.
|
||||
*Only used if software rotation is enabled in the display driver.*/
|
||||
#define LV_DISP_ROT_MAX_BUF (10*1024)
|
||||
/*Use SDL renderer API*/
|
||||
#define LV_USE_DRAW_SDL 0
|
||||
#if LV_USE_DRAW_SDL
|
||||
#define LV_DARW_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
/*Texture cache size, 8MB by default*/
|
||||
#define LV_DARW_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
|
||||
#define LV_DARW_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
#endif
|
||||
|
||||
/*-------------
|
||||
* GPU
|
||||
*-----------*/
|
||||
/*=====================
|
||||
* GPU CONFIGURATION
|
||||
*=====================*/
|
||||
|
||||
/*Use Arm's 2D acceleration library Arm-2D */
|
||||
#define LV_USE_GPU_ARM2D 0
|
||||
@@ -184,12 +168,6 @@
|
||||
#define LV_GPU_DMA2D_CMSIS_INCLUDE
|
||||
#endif
|
||||
|
||||
/*Use SWM341's DMA2D GPU*/
|
||||
#define LV_USE_GPU_SWM341_DMA2D 0
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
#define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h"
|
||||
#endif
|
||||
|
||||
/*Use NXP's PXP GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_PXP 0
|
||||
#if LV_USE_GPU_NXP_PXP
|
||||
@@ -204,16 +182,16 @@
|
||||
/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/
|
||||
#define LV_USE_GPU_NXP_VG_LITE 0
|
||||
|
||||
/*Use SDL renderer API*/
|
||||
#define LV_USE_GPU_SDL 0
|
||||
#if LV_USE_GPU_SDL
|
||||
#define LV_GPU_SDL_INCLUDE_PATH <SDL2/SDL.h>
|
||||
/*Texture cache size, 8MB by default*/
|
||||
#define LV_GPU_SDL_LRU_SIZE (1024 * 1024 * 8)
|
||||
/*Custom blend mode for mask drawing, disable if you need to link with older SDL2 lib*/
|
||||
#define LV_GPU_SDL_CUSTOM_BLEND_MODE (SDL_VERSION_ATLEAST(2, 0, 6))
|
||||
/*Use SWM341's DMA2D GPU*/
|
||||
#define LV_USE_GPU_SWM341_DMA2D 0
|
||||
#if LV_USE_GPU_SWM341_DMA2D
|
||||
#define LV_GPU_SWM341_DMA2D_INCLUDE "SWM341.h"
|
||||
#endif
|
||||
|
||||
/*=======================
|
||||
* FEATURE CONFIGURATION
|
||||
*=======================*/
|
||||
|
||||
/*-------------
|
||||
* Logging
|
||||
*-----------*/
|
||||
@@ -274,7 +252,7 @@
|
||||
#endif
|
||||
|
||||
/*1: Show the used memory and the memory fragmentation
|
||||
* Requires LV_MEM_CUSTOM = 0*/
|
||||
* Requires `LV_USE_BUILTIN_MALLOC = 1`*/
|
||||
#define LV_USE_MEM_MONITOR 0
|
||||
#if LV_USE_MEM_MONITOR
|
||||
#define LV_USE_MEM_MONITOR_POS LV_ALIGN_BOTTOM_LEFT
|
||||
@@ -283,15 +261,9 @@
|
||||
/*1: Draw random colored rectangles over the redrawn areas*/
|
||||
#define LV_USE_REFR_DEBUG 0
|
||||
|
||||
/*Change the built in (v)snprintf functions*/
|
||||
#define LV_SPRINTF_CUSTOM 0
|
||||
#if LV_SPRINTF_CUSTOM
|
||||
#define LV_SPRINTF_INCLUDE <stdio.h>
|
||||
#define lv_snprintf snprintf
|
||||
#define lv_vsnprintf vsnprintf
|
||||
#else /*LV_SPRINTF_CUSTOM*/
|
||||
#define LV_SPRINTF_USE_FLOAT 0
|
||||
#endif /*LV_SPRINTF_CUSTOM*/
|
||||
/*Maximum buffer size to allocate for rotation.
|
||||
*Only used if software rotation is enabled in the display driver.*/
|
||||
#define LV_DISP_ROT_MAX_BUF (10*1024)
|
||||
|
||||
#define LV_USE_USER_DATA 1
|
||||
|
||||
@@ -302,6 +274,22 @@
|
||||
#define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
|
||||
#endif /*LV_ENABLE_GC*/
|
||||
|
||||
/*Default image cache size. Image caching keeps some images opened.
|
||||
*If only the built-in image formats are used there is no real advantage of caching.
|
||||
*With other image decoders (e.g. PNG or JPG) caching save the continuous open/decode of images.
|
||||
*However the opened images consume additional RAM.
|
||||
*0: to disable caching*/
|
||||
#define LV_IMG_CACHE_DEF_SIZE 0
|
||||
|
||||
|
||||
/*Number of stops allowed per gradient. Increase this to allow more stops.
|
||||
*This adds (sizeof(lv_color_t) + 1) bytes per additional stop*/
|
||||
#define LV_GRADIENT_MAX_STOPS 2
|
||||
|
||||
/* Adjust color mix functions rounding. GPUs might calculate color mix (blending) differently.
|
||||
* 0: round down, 64: round up from x.75, 128: round up from half, 192: round up from x.25, 254: round up */
|
||||
#define LV_COLOR_MIX_ROUND_OFS 0
|
||||
|
||||
/*=====================
|
||||
* COMPILER SETTINGS
|
||||
*====================*/
|
||||
@@ -334,8 +322,6 @@
|
||||
/*Place performance critical functions into a faster memory (e.g RAM)*/
|
||||
#define LV_ATTRIBUTE_FAST_MEM
|
||||
|
||||
/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are DMA accessible*/
|
||||
#define LV_ATTRIBUTE_DMA
|
||||
|
||||
/*Export integer constant to binding. This macro is used with constants in the form of LV_<CONST> that
|
||||
*should also appear on LVGL binding API such as Micropython.*/
|
||||
@@ -398,13 +384,6 @@
|
||||
/*Enables/disables support for compressed fonts.*/
|
||||
#define LV_USE_FONT_COMPRESSED 0
|
||||
|
||||
/*Enable subpixel rendering*/
|
||||
#define LV_USE_FONT_SUBPX 0
|
||||
#if LV_USE_FONT_SUBPX
|
||||
/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/
|
||||
#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/
|
||||
#endif
|
||||
|
||||
/*Enable drawing placeholders when glyph dsc is not found*/
|
||||
#define LV_USE_FONT_PLACEHOLDER 1
|
||||
|
||||
@@ -724,7 +703,7 @@
|
||||
====================*/
|
||||
|
||||
/*Show some widget. It might be required to increase `LV_MEM_SIZE` */
|
||||
#define LV_USE_DEMO_WIDGETS 0
|
||||
#define LV_USE_DEMO_WIDGETS 1
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
#define LV_DEMO_WIDGETS_SLIDESHOW 0
|
||||
#endif
|
||||
|
||||
@@ -210,6 +210,18 @@ void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa)
|
||||
_lv_inv_area(disp, &a);
|
||||
}
|
||||
|
||||
lv_color_t lv_disp_get_chroma_key_color(lv_disp_t * disp)
|
||||
{
|
||||
|
||||
if(!disp) disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("no display registered");
|
||||
return lv_color_hex(0x00ff00);
|
||||
}
|
||||
|
||||
return disp->driver->color_chroma_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch screen with animation
|
||||
* @param scr pointer to the new screen to load
|
||||
|
||||
@@ -119,6 +119,8 @@ void lv_disp_set_bg_image(lv_disp_t * disp, const void * img_src);
|
||||
*/
|
||||
void lv_disp_set_bg_opa(lv_disp_t * disp, lv_opa_t opa);
|
||||
|
||||
lv_color_t lv_disp_get_chroma_key_color(lv_disp_t * disp);
|
||||
|
||||
/**
|
||||
* Switch screen with animation
|
||||
* @param scr pointer to the new screen to load
|
||||
|
||||
+8
-8
@@ -166,8 +166,8 @@ struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
|
||||
obj->spec_attr->event_dsc_cnt++;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
|
||||
obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].cb = event_cb;
|
||||
@@ -190,8 +190,8 @@ bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i + 1];
|
||||
}
|
||||
obj->spec_attr->event_dsc_cnt--;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
return true;
|
||||
}
|
||||
@@ -215,8 +215,8 @@ bool lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_c
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i + 1];
|
||||
}
|
||||
obj->spec_attr->event_dsc_cnt--;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
return true;
|
||||
}
|
||||
@@ -240,8 +240,8 @@ bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc)
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i + 1];
|
||||
}
|
||||
obj->spec_attr->event_dsc_cnt--;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
return true;
|
||||
}
|
||||
|
||||
+2
-2
@@ -94,7 +94,7 @@ void lv_group_del(lv_group_t * group)
|
||||
|
||||
_lv_ll_clear(&(group->obj_ll));
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group);
|
||||
lv_mem_free(group);
|
||||
lv_free(group);
|
||||
}
|
||||
|
||||
void lv_group_set_default(lv_group_t * group)
|
||||
@@ -201,7 +201,7 @@ void lv_group_remove_obj(lv_obj_t * obj)
|
||||
_LV_LL_READ(&g->obj_ll, i) {
|
||||
if(*i == obj) {
|
||||
_lv_ll_remove(&g->obj_ll, i);
|
||||
lv_mem_free(i);
|
||||
lv_free(i);
|
||||
if(obj->spec_attr) obj->spec_attr->group_p = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
+24
-17
@@ -21,6 +21,9 @@
|
||||
#include "../misc/lv_gc.h"
|
||||
#include "../misc/lv_math.h"
|
||||
#include "../misc/lv_log.h"
|
||||
#if LV_USE_BUILTIN_MALLOC
|
||||
#include "../misc/lv_mem_builtin.h"
|
||||
#endif
|
||||
#include "../hal/lv_hal.h"
|
||||
#include "../extra/lv_extra.h"
|
||||
#include <stdint.h>
|
||||
@@ -102,8 +105,9 @@ void lv_init(void)
|
||||
LV_LOG_INFO("begin");
|
||||
|
||||
/*Initialize the misc modules*/
|
||||
lv_mem_init();
|
||||
|
||||
#if LV_USE_BUILTIN_MALLOC
|
||||
lv_mem_init_builtin();
|
||||
#endif
|
||||
_lv_timer_core_init();
|
||||
|
||||
_lv_fs_init();
|
||||
@@ -190,7 +194,10 @@ void lv_deinit(void)
|
||||
_lv_gc_clear_roots();
|
||||
|
||||
lv_disp_set_default(NULL);
|
||||
lv_mem_deinit();
|
||||
|
||||
#if LV_USE_BUILTIN_MALLOC
|
||||
lv_mem_deinit_builtin();
|
||||
#endif
|
||||
lv_initialized = false;
|
||||
|
||||
LV_LOG_INFO("lv_deinit done");
|
||||
@@ -348,11 +355,11 @@ void lv_obj_allocate_spec_attr(lv_obj_t * obj)
|
||||
if(obj->spec_attr == NULL) {
|
||||
static uint32_t x = 0;
|
||||
x++;
|
||||
obj->spec_attr = lv_mem_alloc(sizeof(_lv_obj_spec_attr_t));
|
||||
obj->spec_attr = lv_malloc(sizeof(_lv_obj_spec_attr_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr);
|
||||
if(obj->spec_attr == NULL) return;
|
||||
|
||||
lv_memset_00(obj->spec_attr, sizeof(_lv_obj_spec_attr_t));
|
||||
lv_memzero(obj->spec_attr, sizeof(_lv_obj_spec_attr_t));
|
||||
|
||||
obj->spec_attr->scroll_dir = LV_DIR_ALL;
|
||||
obj->spec_attr->scrollbar_mode = LV_SCROLLBAR_MODE_AUTO;
|
||||
@@ -453,15 +460,15 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
||||
|
||||
if(obj->spec_attr) {
|
||||
if(obj->spec_attr->children) {
|
||||
lv_mem_free(obj->spec_attr->children);
|
||||
lv_free(obj->spec_attr->children);
|
||||
obj->spec_attr->children = NULL;
|
||||
}
|
||||
if(obj->spec_attr->event_dsc) {
|
||||
lv_mem_free(obj->spec_attr->event_dsc);
|
||||
lv_free(obj->spec_attr->event_dsc);
|
||||
obj->spec_attr->event_dsc = NULL;
|
||||
}
|
||||
|
||||
lv_mem_free(obj->spec_attr);
|
||||
lv_free(obj->spec_attr);
|
||||
obj->spec_attr = NULL;
|
||||
}
|
||||
}
|
||||
@@ -530,7 +537,7 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
part_dsc.part = LV_PART_MAIN;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_dsc);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
/*With clip corner enabled draw the bg img separately to make it clipped*/
|
||||
bool clip_corner = (lv_obj_get_style_clip_corner(obj, LV_PART_MAIN) && draw_dsc.radius != 0) ? true : false;
|
||||
const void * bg_img_src = draw_dsc.bg_img_src;
|
||||
@@ -542,9 +549,9 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
lv_draw_rect(draw_ctx, &draw_dsc, &coords);
|
||||
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
if(clip_corner) {
|
||||
lv_draw_mask_radius_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
|
||||
lv_draw_mask_radius_param_t * mp = lv_malloc(sizeof(lv_draw_mask_radius_param_t));
|
||||
lv_draw_mask_radius_init(mp, &obj->coords, draw_dsc.radius, false);
|
||||
/*Add the mask and use `obj+8` as custom id. Don't use `obj` directly because it might be used by the user*/
|
||||
lv_draw_mask_add(mp, obj + 8);
|
||||
@@ -566,12 +573,12 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
lv_draw_ctx_t * draw_ctx = lv_event_get_draw_ctx(e);
|
||||
draw_scrollbar(obj, draw_ctx);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
if(lv_obj_get_style_clip_corner(obj, LV_PART_MAIN)) {
|
||||
lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(obj + 8);
|
||||
if(param) {
|
||||
lv_draw_mask_free_param(param);
|
||||
lv_mem_buf_release(param);
|
||||
lv_free(param);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -670,7 +677,7 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
dsc->shadow_opa = lv_obj_get_style_shadow_opa(obj, LV_PART_SCROLLBAR);
|
||||
if(dsc->shadow_opa > LV_OPA_MIN) {
|
||||
dsc->shadow_width = lv_obj_get_style_shadow_width(obj, LV_PART_SCROLLBAR);
|
||||
@@ -871,8 +878,8 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
/*If there is no difference in styles there is nothing else to do*/
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return;
|
||||
|
||||
_lv_obj_style_transition_dsc_t * ts = lv_mem_buf_get(sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX);
|
||||
lv_memset_00(ts, sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX);
|
||||
_lv_obj_style_transition_dsc_t * ts = lv_malloc(sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX);
|
||||
lv_memzero(ts, sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX);
|
||||
uint32_t tsi = 0;
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_cnt && tsi < STYLE_TRANSITION_MAX; i++) {
|
||||
@@ -917,7 +924,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
_lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]);
|
||||
}
|
||||
|
||||
lv_mem_buf_release(ts);
|
||||
lv_free(ts);
|
||||
|
||||
if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW) {
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
@@ -44,9 +44,9 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
||||
{
|
||||
LV_TRACE_OBJ_CREATE("Creating object with %p class on %p parent", (void *)class_p, (void *)parent);
|
||||
uint32_t s = get_instance_size(class_p);
|
||||
lv_obj_t * obj = lv_mem_alloc(s);
|
||||
lv_obj_t * obj = lv_malloc(s);
|
||||
if(obj == NULL) return NULL;
|
||||
lv_memset_00(obj, s);
|
||||
lv_memzero(obj, s);
|
||||
obj->class_p = class_p;
|
||||
obj->parent = parent;
|
||||
|
||||
@@ -56,18 +56,18 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
||||
lv_disp_t * disp = lv_disp_get_default();
|
||||
if(!disp) {
|
||||
LV_LOG_WARN("No display created yet. No place to assign the new screen");
|
||||
lv_mem_free(obj);
|
||||
lv_free(obj);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(disp->screens == NULL) {
|
||||
disp->screens = lv_mem_alloc(sizeof(lv_obj_t *));
|
||||
disp->screens = lv_malloc(sizeof(lv_obj_t *));
|
||||
disp->screens[0] = obj;
|
||||
disp->screen_cnt = 1;
|
||||
}
|
||||
else {
|
||||
disp->screen_cnt++;
|
||||
disp->screens = lv_mem_realloc(disp->screens, sizeof(lv_obj_t *) * disp->screen_cnt);
|
||||
disp->screens = lv_realloc(disp->screens, sizeof(lv_obj_t *) * disp->screen_cnt);
|
||||
disp->screens[disp->screen_cnt - 1] = obj;
|
||||
}
|
||||
|
||||
@@ -86,14 +86,14 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
||||
}
|
||||
|
||||
if(parent->spec_attr->children == NULL) {
|
||||
parent->spec_attr->children = lv_mem_alloc(sizeof(lv_obj_t *));
|
||||
parent->spec_attr->children = lv_malloc(sizeof(lv_obj_t *));
|
||||
parent->spec_attr->children[0] = obj;
|
||||
parent->spec_attr->child_cnt = 1;
|
||||
}
|
||||
else {
|
||||
parent->spec_attr->child_cnt++;
|
||||
parent->spec_attr->children = lv_mem_realloc(parent->spec_attr->children,
|
||||
sizeof(lv_obj_t *) * parent->spec_attr->child_cnt);
|
||||
parent->spec_attr->children = lv_realloc(parent->spec_attr->children,
|
||||
sizeof(lv_obj_t *) * parent->spec_attr->child_cnt);
|
||||
parent->spec_attr->children[parent->spec_attr->child_cnt - 1] = obj;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-11
@@ -51,8 +51,8 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#if LV_USE_DRAW_MASKS
|
||||
|
||||
draw_dsc->radius = lv_obj_get_style_radius(obj, part);
|
||||
|
||||
@@ -132,7 +132,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#else /*LV_DRAW_COMPLEX*/
|
||||
#else /*LV_USE_DRAW_MASKS*/
|
||||
if(draw_dsc->bg_opa != LV_OPA_TRANSP) {
|
||||
draw_dsc->bg_opa = lv_obj_get_style_bg_opa(obj, part);
|
||||
if(draw_dsc->bg_opa > LV_OPA_MIN) {
|
||||
@@ -212,9 +212,7 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc
|
||||
draw_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, part);
|
||||
draw_dsc->line_space = lv_obj_get_style_text_line_space(obj, part);
|
||||
draw_dsc->decor = lv_obj_get_style_text_decor(obj, part);
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
|
||||
draw_dsc->font = lv_obj_get_style_text_font(obj, part);
|
||||
|
||||
@@ -250,9 +248,7 @@ void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t *
|
||||
if(draw_dsc->recolor_opa > 0) {
|
||||
draw_dsc->recolor = lv_obj_get_style_img_recolor_filtered(obj, part);
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc)
|
||||
@@ -284,9 +280,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t
|
||||
draw_dsc->round_start = lv_obj_get_style_line_rounded(obj, part);
|
||||
draw_dsc->round_end = draw_dsc->round_start;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc)
|
||||
@@ -313,9 +307,7 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t *
|
||||
|
||||
draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part);
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
|
||||
@@ -354,7 +346,7 @@ lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part)
|
||||
|
||||
void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_obj_draw_part_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_obj_draw_part_dsc_t));
|
||||
dsc->draw_ctx = draw_ctx;
|
||||
}
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ void lv_obj_update_layout(const lv_obj_t * obj)
|
||||
uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data)
|
||||
{
|
||||
layout_cnt++;
|
||||
LV_GC_ROOT(_lv_layout_list) = lv_mem_realloc(LV_GC_ROOT(_lv_layout_list), layout_cnt * sizeof(lv_layout_dsc_t));
|
||||
LV_GC_ROOT(_lv_layout_list) = lv_realloc(LV_GC_ROOT(_lv_layout_list), layout_cnt * sizeof(lv_layout_dsc_t));
|
||||
LV_ASSERT_MALLOC(LV_GC_ROOT(_lv_layout_list));
|
||||
|
||||
LV_GC_ROOT(_lv_layout_list)[layout_cnt - 1].cb = cb;
|
||||
|
||||
+16
-15
@@ -89,14 +89,15 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto
|
||||
|
||||
/*Allocate space for the new style and shift the rest of the style to the end*/
|
||||
obj->style_cnt++;
|
||||
obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
LV_ASSERT_MALLOC(obj->styles);
|
||||
|
||||
uint32_t j;
|
||||
for(j = obj->style_cnt - 1; j > i ; j--) {
|
||||
obj->styles[j] = obj->styles[j - 1];
|
||||
}
|
||||
|
||||
lv_memset_00(&obj->styles[i], sizeof(_lv_obj_style_t));
|
||||
lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t));
|
||||
obj->styles[i].style = style;
|
||||
obj->styles[i].selector = selector;
|
||||
|
||||
@@ -128,7 +129,7 @@ void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_sele
|
||||
|
||||
if(obj->styles[i].is_local || obj->styles[i].is_trans) {
|
||||
if(obj->styles[i].style) lv_style_reset((lv_style_t *)obj->styles[i].style);
|
||||
lv_mem_free((lv_style_t *)obj->styles[i].style);
|
||||
lv_free((lv_style_t *)obj->styles[i].style);
|
||||
obj->styles[i].style = NULL;
|
||||
}
|
||||
|
||||
@@ -139,7 +140,7 @@ void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_sele
|
||||
}
|
||||
|
||||
obj->style_cnt--;
|
||||
obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
|
||||
deleted = true;
|
||||
/*The style from the current `i` index is removed, so `i` points to the next style.
|
||||
@@ -513,7 +514,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector
|
||||
}
|
||||
|
||||
obj->style_cnt++;
|
||||
obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
LV_ASSERT_MALLOC(obj->styles);
|
||||
|
||||
for(i = obj->style_cnt - 1; i > 0 ; i--) {
|
||||
@@ -523,9 +524,10 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector
|
||||
obj->styles[i] = obj->styles[i - 1];
|
||||
}
|
||||
|
||||
lv_memset_00(&obj->styles[i], sizeof(_lv_obj_style_t));
|
||||
obj->styles[i].style = lv_mem_alloc(sizeof(lv_style_t));
|
||||
lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t));
|
||||
obj->styles[i].style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init((lv_style_t *)obj->styles[i].style);
|
||||
|
||||
obj->styles[i].is_local = 1;
|
||||
obj->styles[i].selector = selector;
|
||||
return (lv_style_t *)obj->styles[i].style;
|
||||
@@ -549,15 +551,17 @@ static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t se
|
||||
if(i != obj->style_cnt) return &obj->styles[i];
|
||||
|
||||
obj->style_cnt++;
|
||||
obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t));
|
||||
|
||||
for(i = obj->style_cnt - 1; i > 0 ; i--) {
|
||||
obj->styles[i] = obj->styles[i - 1];
|
||||
}
|
||||
|
||||
lv_memset_00(&obj->styles[0], sizeof(_lv_obj_style_t));
|
||||
obj->styles[0].style = lv_mem_alloc(sizeof(lv_style_t));
|
||||
|
||||
lv_memzero(&obj->styles[0], sizeof(_lv_obj_style_t));
|
||||
obj->styles[0].style = lv_malloc(sizeof(lv_style_t));
|
||||
lv_style_init((lv_style_t *)obj->styles[0].style);
|
||||
|
||||
obj->styles[0].is_trans = 1;
|
||||
obj->styles[0].selector = selector;
|
||||
return &obj->styles[0];
|
||||
@@ -705,7 +709,7 @@ static bool trans_del(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, tran
|
||||
/*Free the transition descriptor too*/
|
||||
lv_anim_del(tr, NULL);
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
lv_free(tr);
|
||||
removed = true;
|
||||
|
||||
}
|
||||
@@ -822,7 +826,7 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
for(i = 0; i < obj->style_cnt; i++) {
|
||||
if(obj->styles[i].is_trans && obj->styles[i].selector == tr->selector) {
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
lv_free(tr);
|
||||
|
||||
_lv_obj_style_t * obj_style = &obj->styles[i];
|
||||
lv_style_remove_prop((lv_style_t *)obj_style->style, prop);
|
||||
@@ -842,10 +846,7 @@ static lv_layer_type_t calculate_layer_type(lv_obj_t * obj)
|
||||
if(lv_obj_get_style_transform_angle(obj, 0) != 0) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_transform_zoom(obj, 0) != 256) return LV_LAYER_TYPE_TRANSFORM;
|
||||
if(lv_obj_get_style_opa(obj, 0) != LV_OPA_COVER) return LV_LAYER_TYPE_SIMPLE;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
if(lv_obj_get_style_blend_mode(obj, 0) != LV_BLEND_MODE_NORMAL) return LV_LAYER_TYPE_SIMPLE;
|
||||
#endif
|
||||
return LV_LAYER_TYPE_NONE;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,18 +156,18 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
}
|
||||
old_parent->spec_attr->child_cnt--;
|
||||
if(old_parent->spec_attr->child_cnt) {
|
||||
old_parent->spec_attr->children = lv_mem_realloc(old_parent->spec_attr->children,
|
||||
old_parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
old_parent->spec_attr->children = lv_realloc(old_parent->spec_attr->children,
|
||||
old_parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
}
|
||||
else {
|
||||
lv_mem_free(old_parent->spec_attr->children);
|
||||
lv_free(old_parent->spec_attr->children);
|
||||
old_parent->spec_attr->children = NULL;
|
||||
}
|
||||
|
||||
/*Add the child to the new parent as the last (newest child)*/
|
||||
parent->spec_attr->child_cnt++;
|
||||
parent->spec_attr->children = lv_mem_realloc(parent->spec_attr->children,
|
||||
parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
parent->spec_attr->children = lv_realloc(parent->spec_attr->children,
|
||||
parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj;
|
||||
|
||||
obj->parent = parent;
|
||||
@@ -402,7 +402,7 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
disp->screens[i] = disp->screens[i + 1];
|
||||
}
|
||||
disp->screen_cnt--;
|
||||
disp->screens = lv_mem_realloc(disp->screens, disp->screen_cnt * sizeof(lv_obj_t *));
|
||||
disp->screens = lv_realloc(disp->screens, disp->screen_cnt * sizeof(lv_obj_t *));
|
||||
}
|
||||
/*Remove the object from the child list of its parent*/
|
||||
else {
|
||||
@@ -412,12 +412,12 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
obj->parent->spec_attr->children[i] = obj->parent->spec_attr->children[i + 1];
|
||||
}
|
||||
obj->parent->spec_attr->child_cnt--;
|
||||
obj->parent->spec_attr->children = lv_mem_realloc(obj->parent->spec_attr->children,
|
||||
obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *));
|
||||
obj->parent->spec_attr->children = lv_realloc(obj->parent->spec_attr->children,
|
||||
obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *));
|
||||
}
|
||||
|
||||
/*Free the object itself*/
|
||||
lv_mem_free(obj);
|
||||
lv_free(obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-12
@@ -334,8 +334,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
}
|
||||
|
||||
/*Clean up*/
|
||||
lv_memset_00(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
lv_memset_00(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
|
||||
lv_memzero(disp_refr->inv_areas, sizeof(disp_refr->inv_areas));
|
||||
lv_memzero(disp_refr->inv_area_joined, sizeof(disp_refr->inv_area_joined));
|
||||
disp_refr->inv_p = 0;
|
||||
|
||||
elaps = lv_tick_elaps(start);
|
||||
@@ -346,10 +346,9 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
}
|
||||
}
|
||||
|
||||
lv_mem_buf_free_all();
|
||||
_lv_font_clean_up_fmt_txt();
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
_lv_draw_mask_cleanup();
|
||||
#endif
|
||||
|
||||
@@ -628,16 +627,14 @@ static void refr_area_part(lv_draw_ctx_t * draw_ctx)
|
||||
}
|
||||
|
||||
/*If the screen is transparent initialize it when the flushing is ready*/
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp_refr->driver->screen_transp) {
|
||||
if(disp_refr->driver->clear_cb) {
|
||||
disp_refr->driver->clear_cb(disp_refr->driver, disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size);
|
||||
}
|
||||
else {
|
||||
lv_memset_00(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
lv_memzero(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_obj_t * top_act_scr = NULL;
|
||||
@@ -1142,7 +1139,7 @@ static void draw_buf_rotate(lv_area_t * area, lv_color_t * color_p)
|
||||
}
|
||||
else {
|
||||
/*Rotate other areas using a maximum buffer size*/
|
||||
if(rot_buf == NULL) rot_buf = lv_mem_buf_get(LV_DISP_ROT_MAX_BUF);
|
||||
if(rot_buf == NULL) rot_buf = lv_malloc(LV_DISP_ROT_MAX_BUF);
|
||||
draw_buf_rotate_90(drv->rotated == LV_DISP_ROT_270, area_w, height, color_p, rot_buf);
|
||||
|
||||
if(drv->rotated == LV_DISP_ROT_90) {
|
||||
@@ -1174,7 +1171,7 @@ static void draw_buf_rotate(lv_area_t * area, lv_color_t * color_p)
|
||||
row += height;
|
||||
}
|
||||
/*Free the allocated buffer at the end if necessary*/
|
||||
if(rot_buf != NULL) lv_mem_buf_release(rot_buf);
|
||||
if(rot_buf != NULL) lv_free(rot_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1197,16 +1194,14 @@ static void draw_buf_flush(lv_disp_t * disp)
|
||||
}
|
||||
|
||||
/*If the screen is transparent initialize it when the flushing is ready*/
|
||||
#if LV_COLOR_SCREEN_TRANSP
|
||||
if(disp_refr->driver->screen_transp) {
|
||||
if(disp_refr->driver->clear_cb) {
|
||||
disp_refr->driver->clear_cb(disp_refr->driver, disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size);
|
||||
}
|
||||
else {
|
||||
lv_memset_00(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
lv_memzero(disp_refr->driver->draw_buf->buf_act, disp_refr->driver->draw_buf->size * LV_IMG_PX_SIZE_ALPHA_BYTE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
draw_buf->flushing = 1;
|
||||
|
||||
@@ -275,7 +275,7 @@
|
||||
lv_color_t *rgb_tmp_buf = NULL; \
|
||||
if(draw_dsc->recolor_opa > LV_OPA_MIN) { \
|
||||
rgb_tmp_buf \
|
||||
= lv_mem_buf_get(src_w * src_h * sizeof(lv_color_t)); \
|
||||
= lv_malloc(src_w * src_h * sizeof(lv_color_t)); \
|
||||
if (NULL == rgb_tmp_buf) { \
|
||||
LV_LOG_WARN( \
|
||||
"Failed to allocate memory for accelerating recolour, " \
|
||||
@@ -300,7 +300,7 @@
|
||||
} \
|
||||
__VA_ARGS__ \
|
||||
if (NULL != rgb_tmp_buf) { \
|
||||
lv_mem_buf_release(rgb_tmp_buf); \
|
||||
lv_free(rgb_tmp_buf); \
|
||||
} \
|
||||
} while(0);
|
||||
/* *INDENT-ON* */
|
||||
@@ -645,7 +645,7 @@ static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend
|
||||
mask,
|
||||
mask_stride);
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
else {
|
||||
break;
|
||||
}
|
||||
@@ -663,7 +663,7 @@ static void lv_draw_arm2d_blend(lv_draw_ctx_t * draw_ctx, const lv_draw_sw_blend
|
||||
mask,
|
||||
mask_stride);
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
else {
|
||||
break;
|
||||
}
|
||||
@@ -846,7 +846,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
lv_area_t blend_area;
|
||||
lv_draw_sw_blend_dsc_t blend_dsc;
|
||||
|
||||
lv_memset_00(&blend_dsc, sizeof(lv_draw_sw_blend_dsc_t));
|
||||
lv_memzero(&blend_dsc, sizeof(lv_draw_sw_blend_dsc_t));
|
||||
blend_dsc.opa = draw_dsc->opa;
|
||||
blend_dsc.blend_mode = draw_dsc->blend_mode;
|
||||
blend_dsc.blend_area = &blend_area;
|
||||
@@ -908,8 +908,8 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
/*Create buffers and masks*/
|
||||
uint32_t buf_size = buf_w * buf_h;
|
||||
|
||||
lv_color_t * rgb_buf = lv_mem_buf_get(buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(buf_size);
|
||||
lv_color_t * rgb_buf = lv_malloc(buf_size * sizeof(lv_color_t));
|
||||
lv_opa_t * mask_buf = lv_malloc(buf_size);
|
||||
blend_dsc.mask_buf = mask_buf;
|
||||
blend_dsc.mask_area = &blend_area;
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -977,14 +977,14 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
|
||||
uint8_t * mask_temp_buf = NULL;
|
||||
if(blend_dsc.opa < LV_OPA_MAX) {
|
||||
mask_temp_buf = lv_mem_buf_get(copy_size.iHeight * copy_size.iWidth);
|
||||
mask_temp_buf = lv_malloc(copy_size.iHeight * copy_size.iWidth);
|
||||
if(NULL == mask_temp_buf) {
|
||||
LV_LOG_WARN(
|
||||
"Failed to allocate memory for alpha mask,"
|
||||
" use normal route instead.");
|
||||
break;
|
||||
}
|
||||
lv_memset_00(mask_temp_buf, copy_size.iHeight * copy_size.iWidth);
|
||||
lv_memzero(mask_temp_buf, copy_size.iHeight * copy_size.iWidth);
|
||||
|
||||
__arm_2d_impl_gray8_colour_filling_channel_mask_opacity(
|
||||
mask_temp_buf,
|
||||
@@ -1006,7 +1006,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
dest_stride,
|
||||
©_size);
|
||||
|
||||
lv_mem_buf_release(mask_temp_buf);
|
||||
lv_free(mask_temp_buf);
|
||||
}
|
||||
else {
|
||||
__arm_2d_impl_src_chn_msk_copy(
|
||||
@@ -1144,7 +1144,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
source_center.iY = draw_dsc->pivot.y;
|
||||
|
||||
|
||||
if((LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED == cf) ||
|
||||
if((LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED == cf) ||
|
||||
(LV_IMG_CF_TRUE_COLOR == cf)) {
|
||||
arm_2d_tile_transform_with_opacity(
|
||||
&source_tile,
|
||||
@@ -1160,7 +1160,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
}
|
||||
#if defined(__ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__) \
|
||||
&& __ARM_2D_CFG_SUPPORT_COLOUR_CHANNEL_ACCESS__
|
||||
else if((LV_IMG_CF_TRUE_COLOR_ALPHA == cf) &&
|
||||
else if((LV_IMG_CF_TRUE_COLOR_ALPHA == cf) &&
|
||||
(LV_COLOR_DEPTH == 32)) {
|
||||
arm_2d_tile_transform_with_src_mask_and_opacity(
|
||||
&source_tile,
|
||||
@@ -1208,7 +1208,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
(color_int)draw_dsc->recolor.full,
|
||||
draw_dsc->recolor_opa);
|
||||
}
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
/*Apply the masks if any*/
|
||||
if(mask_any) {
|
||||
lv_coord_t y;
|
||||
@@ -1218,7 +1218,7 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
mask_res_line = lv_draw_mask_apply(mask_buf_tmp, blend_area.x1, y, blend_w);
|
||||
|
||||
if(mask_res_line == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf_tmp, blend_w);
|
||||
lv_memzero(mask_buf_tmp, blend_w);
|
||||
blend_dsc.mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
else if(mask_res_line == LV_DRAW_MASK_RES_CHANGED) {
|
||||
@@ -1238,8 +1238,8 @@ static void lv_draw_arm2d_img_decoded(struct _lv_draw_ctx_t * draw_ctx,
|
||||
if(blend_area.y2 > y_last) blend_area.y2 = y_last;
|
||||
}
|
||||
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_mem_buf_release(rgb_buf);
|
||||
lv_free(mask_buf);
|
||||
lv_free(rgb_buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1275,7 +1275,7 @@ static void convert_cb(const lv_area_t * dest_area, const void * src_buf, lv_coo
|
||||
|
||||
if(cf == LV_IMG_CF_TRUE_COLOR || cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
uint32_t px_cnt = lv_area_get_size(dest_area);
|
||||
lv_memset_ff(abuf, px_cnt);
|
||||
lv_memset(abuf, 0xff, px_cnt);
|
||||
|
||||
src_tmp8 += (src_stride * dest_area->y1 * sizeof(lv_color_t)) + dest_area->x1 * sizeof(lv_color_t);
|
||||
uint32_t dest_w = lv_area_get_width(dest_area);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
void lv_draw_arc_dsc_init(lv_draw_arc_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_arc_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_draw_arc_dsc_t));
|
||||
dsc->width = 1;
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->color = lv_color_black();
|
||||
|
||||
@@ -45,7 +45,7 @@ static void draw_cleanup(_lv_img_cache_entry_t * cache);
|
||||
|
||||
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_draw_img_dsc_t));
|
||||
dsc->recolor = lv_color_black();
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->zoom = LV_IMG_ZOOM_NONE;
|
||||
@@ -300,8 +300,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
|
||||
int32_t width = lv_area_get_width(&mask_com);
|
||||
|
||||
uint8_t * buf = lv_mem_buf_get(lv_area_get_width(&mask_com) *
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
uint8_t * buf = lv_malloc(lv_area_get_width(&mask_com) *
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
lv_area_t line;
|
||||
@@ -320,7 +320,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
if(read_res != LV_RES_OK) {
|
||||
lv_img_decoder_close(&cdsc->dec_dsc);
|
||||
LV_LOG_WARN("Image draw can't read the line");
|
||||
lv_mem_buf_release(buf);
|
||||
lv_free(buf);
|
||||
draw_cleanup(cdsc);
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
return LV_RES_INV;
|
||||
@@ -333,7 +333,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
y++;
|
||||
}
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
lv_mem_buf_release(buf);
|
||||
lv_free(buf);
|
||||
}
|
||||
|
||||
draw_cleanup(cdsc);
|
||||
|
||||
@@ -54,7 +54,7 @@ static uint8_t hex_char_to_num(char hex);
|
||||
|
||||
void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_draw_label_dsc_t));
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->color = lv_color_black();
|
||||
dsc->font = LV_FONT_DEFAULT;
|
||||
@@ -219,7 +219,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_draw_ctx_t * draw_ctx, const lv_draw
|
||||
cmd_state = CMD_STATE_WAIT;
|
||||
i = 0;
|
||||
#if LV_USE_BIDI
|
||||
char * bidi_txt = lv_mem_buf_get(line_end - line_start + 1);
|
||||
char * bidi_txt = lv_malloc(line_end - line_start + 1);
|
||||
_lv_bidi_process_paragraph(txt + line_start, bidi_txt, line_end - line_start, base_dir, NULL, 0);
|
||||
#else
|
||||
const char * bidi_txt = txt + line_start;
|
||||
@@ -263,7 +263,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_draw_ctx_t * draw_ctx, const lv_draw
|
||||
/*Get the parameter*/
|
||||
if(i - par_start == LABEL_RECOLOR_PAR_LENGTH + 1) {
|
||||
char buf[LABEL_RECOLOR_PAR_LENGTH + 1];
|
||||
lv_memcpy_small(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
|
||||
lv_memcpy(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
|
||||
buf[LABEL_RECOLOR_PAR_LENGTH] = '\0';
|
||||
int r, g, b;
|
||||
r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]);
|
||||
@@ -329,7 +329,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(lv_draw_ctx_t * draw_ctx, const lv_draw
|
||||
}
|
||||
|
||||
#if LV_USE_BIDI
|
||||
lv_mem_buf_release(bidi_txt);
|
||||
lv_free(bidi_txt);
|
||||
bidi_txt = NULL;
|
||||
#endif
|
||||
/*Go to next line*/
|
||||
|
||||
@@ -39,14 +39,14 @@ lv_draw_layer_ctx_t * lv_draw_layer_create(lv_draw_ctx_t * draw_ctx, const lv_ar
|
||||
{
|
||||
if(draw_ctx->layer_init == NULL) return NULL;
|
||||
|
||||
lv_draw_layer_ctx_t * layer_ctx = lv_mem_alloc(draw_ctx->layer_instance_size);
|
||||
lv_draw_layer_ctx_t * layer_ctx = lv_malloc(draw_ctx->layer_instance_size);
|
||||
LV_ASSERT_MALLOC(layer_ctx);
|
||||
if(layer_ctx == NULL) {
|
||||
LV_LOG_WARN("Couldn't allocate a new layer context");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
lv_memset_00(layer_ctx, draw_ctx->layer_instance_size);
|
||||
lv_memzero(layer_ctx, draw_ctx->layer_instance_size);
|
||||
|
||||
lv_disp_t * disp_refr = _lv_refr_get_disp_refreshing();
|
||||
layer_ctx->original.buf = draw_ctx->buf;
|
||||
@@ -57,7 +57,7 @@ lv_draw_layer_ctx_t * lv_draw_layer_create(lv_draw_ctx_t * draw_ctx, const lv_ar
|
||||
|
||||
lv_draw_layer_ctx_t * init_layer_ctx = draw_ctx->layer_init(draw_ctx, layer_ctx, flags);
|
||||
if(NULL == init_layer_ctx) {
|
||||
lv_mem_free(layer_ctx);
|
||||
lv_free(layer_ctx);
|
||||
}
|
||||
return init_layer_ctx;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ void lv_draw_layer_destroy(lv_draw_ctx_t * draw_ctx, lv_draw_layer_ctx_t * layer
|
||||
disp_refr->driver->screen_transp = layer_ctx->original.screen_transp;
|
||||
|
||||
if(draw_ctx->layer_destroy) draw_ctx->layer_destroy(draw_ctx, layer_ctx);
|
||||
lv_mem_free(layer_ctx);
|
||||
lv_free(layer_ctx);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_draw_line_dsc_t));
|
||||
dsc->width = 1;
|
||||
dsc->opa = LV_OPA_COVER;
|
||||
dsc->color = lv_color_black();
|
||||
|
||||
+39
-39
@@ -7,7 +7,7 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_draw.h"
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
#include "../misc/lv_math.h"
|
||||
#include "../misc/lv_log.h"
|
||||
#include "../misc/lv_assert.h"
|
||||
@@ -214,8 +214,8 @@ void lv_draw_mask_free_param(void * p)
|
||||
lv_draw_mask_radius_param_t * radius_p = (lv_draw_mask_radius_param_t *) p;
|
||||
if(radius_p->circle) {
|
||||
if(radius_p->circle->life < 0) {
|
||||
lv_mem_free(radius_p->circle->cir_opa);
|
||||
lv_mem_free(radius_p->circle);
|
||||
lv_free(radius_p->circle->cir_opa);
|
||||
lv_free(radius_p->circle);
|
||||
}
|
||||
else {
|
||||
radius_p->circle->used_cnt--;
|
||||
@@ -224,18 +224,18 @@ void lv_draw_mask_free_param(void * p)
|
||||
}
|
||||
else if(pdsc->type == LV_DRAW_MASK_TYPE_POLYGON) {
|
||||
lv_draw_mask_polygon_param_t * poly_p = (lv_draw_mask_polygon_param_t *) p;
|
||||
lv_mem_free(poly_p->cfg.points);
|
||||
lv_free(poly_p->cfg.points);
|
||||
}
|
||||
}
|
||||
|
||||
void _lv_draw_mask_cleanup(void)
|
||||
{
|
||||
uint8_t i;
|
||||
for(i = 0; i < LV_CIRCLE_CACHE_SIZE; i++) {
|
||||
for(i = 0; i < LV_DRAW_SW_CIRCLE_CACHE_SIZE; i++) {
|
||||
if(LV_GC_ROOT(_lv_circle_cache[i]).buf) {
|
||||
lv_mem_free(LV_GC_ROOT(_lv_circle_cache[i]).buf);
|
||||
lv_free(LV_GC_ROOT(_lv_circle_cache[i]).buf);
|
||||
}
|
||||
lv_memset_00(&LV_GC_ROOT(_lv_circle_cache[i]), sizeof(LV_GC_ROOT(_lv_circle_cache[i])));
|
||||
lv_memzero(&LV_GC_ROOT(_lv_circle_cache[i]), sizeof(LV_GC_ROOT(_lv_circle_cache[i])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ bool lv_draw_mask_is_any(const lv_area_t * a)
|
||||
void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, lv_coord_t p2x,
|
||||
lv_coord_t p2y, lv_draw_mask_line_side_t side)
|
||||
{
|
||||
lv_memset_00(param, sizeof(lv_draw_mask_line_param_t));
|
||||
lv_memzero(param, sizeof(lv_draw_mask_line_param_t));
|
||||
|
||||
if(p1y == p2y && side == LV_DRAW_MASK_LINE_SIDE_BOTTOM) {
|
||||
p1y--;
|
||||
@@ -493,7 +493,7 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area
|
||||
uint32_t i;
|
||||
|
||||
/*Try to reuse a circle cache entry*/
|
||||
for(i = 0; i < LV_CIRCLE_CACHE_SIZE; i++) {
|
||||
for(i = 0; i < LV_DRAW_SW_CIRCLE_CACHE_SIZE; i++) {
|
||||
if(LV_GC_ROOT(_lv_circle_cache[i]).radius == radius) {
|
||||
LV_GC_ROOT(_lv_circle_cache[i]).used_cnt++;
|
||||
CIRCLE_CACHE_AGING(LV_GC_ROOT(_lv_circle_cache[i]).life, radius);
|
||||
@@ -504,7 +504,7 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area
|
||||
|
||||
/*If not found find a free entry with lowest life*/
|
||||
_lv_draw_mask_radius_circle_dsc_t * entry = NULL;
|
||||
for(i = 0; i < LV_CIRCLE_CACHE_SIZE; i++) {
|
||||
for(i = 0; i < LV_DRAW_SW_CIRCLE_CACHE_SIZE; i++) {
|
||||
if(LV_GC_ROOT(_lv_circle_cache[i]).used_cnt == 0) {
|
||||
if(!entry) entry = &LV_GC_ROOT(_lv_circle_cache[i]);
|
||||
else if(LV_GC_ROOT(_lv_circle_cache[i]).life < entry->life) entry = &LV_GC_ROOT(_lv_circle_cache[i]);
|
||||
@@ -512,9 +512,9 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area
|
||||
}
|
||||
|
||||
if(!entry) {
|
||||
entry = lv_mem_alloc(sizeof(_lv_draw_mask_radius_circle_dsc_t));
|
||||
entry = lv_malloc(sizeof(_lv_draw_mask_radius_circle_dsc_t));
|
||||
LV_ASSERT_MALLOC(entry);
|
||||
lv_memset_00(entry, sizeof(_lv_draw_mask_radius_circle_dsc_t));
|
||||
lv_memzero(entry, sizeof(_lv_draw_mask_radius_circle_dsc_t));
|
||||
entry->life = -1;
|
||||
}
|
||||
else {
|
||||
@@ -567,7 +567,7 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
||||
void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_point_t * points, uint16_t point_cnt)
|
||||
{
|
||||
/*Join adjacent points if they are on the same coordinate*/
|
||||
lv_point_t * p = lv_mem_alloc(point_cnt * sizeof(lv_point_t));
|
||||
lv_point_t * p = lv_malloc(point_cnt * sizeof(lv_point_t));
|
||||
if(p == NULL) return;
|
||||
uint16_t i;
|
||||
uint16_t pcnt = 0;
|
||||
@@ -625,7 +625,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
else {
|
||||
int32_t k = - abs_x;
|
||||
if(k < 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(k >= 0 && k < len) lv_memset_00(&mask_buf[k], len - k);
|
||||
if(k >= 0 && k < len) lv_memzero(&mask_buf[k], len - k);
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
@@ -635,7 +635,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_line(lv_opa_t * mas
|
||||
int32_t k = - abs_x;
|
||||
if(k < 0) k = 0;
|
||||
if(k >= len) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(k >= 0 && k < len) lv_memset_00(&mask_buf[0], k);
|
||||
else if(k >= 0 && k < len) lv_memzero(&mask_buf[0], k);
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
}
|
||||
@@ -753,7 +753,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(k >= 0) {
|
||||
lv_memset_00(&mask_buf[0], k);
|
||||
lv_memzero(&mask_buf[0], k);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -762,7 +762,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_flat(lv_opa_t * mask_b
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(k <= len) {
|
||||
lv_memset_00(&mask_buf[k], len - k);
|
||||
lv_memzero(&mask_buf[k], len - k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -832,13 +832,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
if(k >= len) {
|
||||
return LV_DRAW_MASK_RES_TRANSP;
|
||||
}
|
||||
if(k >= 0) lv_memset_00(&mask_buf[0], k);
|
||||
if(k >= 0) lv_memzero(&mask_buf[0], k);
|
||||
|
||||
}
|
||||
else {
|
||||
if(k > len) k = len;
|
||||
if(k == 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(k > 0) lv_memset_00(&mask_buf[k], len - k);
|
||||
else if(k > 0) lv_memzero(&mask_buf[k], len - k);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -867,12 +867,12 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
k = xsi - abs_x - 1;
|
||||
|
||||
if(k > len) k = len;
|
||||
else if(k > 0) lv_memset_00(&mask_buf[0], k);
|
||||
else if(k > 0) lv_memzero(&mask_buf[0], k);
|
||||
|
||||
}
|
||||
else {
|
||||
if(k > len) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
if(k >= 0) lv_memset_00(&mask_buf[k], len - k);
|
||||
if(k >= 0) lv_memzero(&mask_buf[k], len - k);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -897,13 +897,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_
|
||||
if(p->inv) {
|
||||
k = xsi - abs_x;
|
||||
if(k > len) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(k >= 0) lv_memset_00(&mask_buf[0], k);
|
||||
if(k >= 0) lv_memzero(&mask_buf[0], k);
|
||||
|
||||
}
|
||||
else {
|
||||
if(k > len) k = len;
|
||||
if(k == 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(k > 0) lv_memset_00(&mask_buf[k], len - k);
|
||||
else if(k > 0) lv_memzero(&mask_buf[k], len - k);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -949,7 +949,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp > 0) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, &p->start_line);
|
||||
if(res1 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[0], tmp);
|
||||
lv_memzero(&mask_buf[0], tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -957,7 +957,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp < 0) tmp = 0;
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x + tmp, abs_y, len - tmp, &p->end_line);
|
||||
if(res2 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[tmp], len - tmp);
|
||||
lv_memzero(&mask_buf[tmp], len - tmp);
|
||||
}
|
||||
if(res1 == res2) return res1;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -991,7 +991,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp > 0) {
|
||||
res1 = lv_draw_mask_line(&mask_buf[0], abs_x, abs_y, tmp, (lv_draw_mask_line_param_t *)&p->end_line);
|
||||
if(res1 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[0], tmp);
|
||||
lv_memzero(&mask_buf[0], tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +999,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_angle(lv_opa_t * ma
|
||||
if(tmp < 0) tmp = 0;
|
||||
res2 = lv_draw_mask_line(&mask_buf[tmp], abs_x + tmp, abs_y, len - tmp, (lv_draw_mask_line_param_t *)&p->start_line);
|
||||
if(res2 == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&mask_buf[tmp], len - tmp);
|
||||
lv_memzero(&mask_buf[tmp], len - tmp);
|
||||
}
|
||||
if(res1 == res2) return res1;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -1077,13 +1077,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
int32_t last = rect.x1 - abs_x;
|
||||
if(last > len) return LV_DRAW_MASK_RES_TRANSP;
|
||||
if(last >= 0) {
|
||||
lv_memset_00(&mask_buf[0], last);
|
||||
lv_memzero(&mask_buf[0], last);
|
||||
}
|
||||
|
||||
int32_t first = rect.x2 - abs_x + 1;
|
||||
if(first <= 0) return LV_DRAW_MASK_RES_TRANSP;
|
||||
else if(first < len) {
|
||||
lv_memset_00(&mask_buf[first], len - first);
|
||||
lv_memzero(&mask_buf[first], len - first);
|
||||
}
|
||||
if(last == 0 && first == len) return LV_DRAW_MASK_RES_FULL_COVER;
|
||||
else return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -1095,7 +1095,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
int32_t last = rect.x2 - abs_x - first + 1;
|
||||
if(first + last > len) last = len - first;
|
||||
if(last >= 0) {
|
||||
lv_memset_00(&mask_buf[first], last);
|
||||
lv_memzero(&mask_buf[first], last);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1142,11 +1142,11 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
/*Clean the right side*/
|
||||
cir_x_right = LV_CLAMP(0, cir_x_right + i, len);
|
||||
lv_memset_00(&mask_buf[cir_x_right], len - cir_x_right);
|
||||
lv_memzero(&mask_buf[cir_x_right], len - cir_x_right);
|
||||
|
||||
/*Clean the left side*/
|
||||
cir_x_left = LV_CLAMP(0, cir_x_left - aa_len + 1, len);
|
||||
lv_memset_00(&mask_buf[0], cir_x_left);
|
||||
lv_memzero(&mask_buf[0], cir_x_left);
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < aa_len; i++) {
|
||||
@@ -1161,7 +1161,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
|
||||
lv_coord_t clr_start = LV_CLAMP(0, cir_x_left + 1, len);
|
||||
lv_coord_t clr_len = LV_CLAMP(0, cir_x_right - clr_start, len - clr_start);
|
||||
lv_memset_00(&mask_buf[clr_start], clr_len);
|
||||
lv_memzero(&mask_buf[clr_start], clr_len);
|
||||
}
|
||||
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
@@ -1257,7 +1257,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_polygon(lv_opa_t *
|
||||
lv_point_t p2;
|
||||
} lines[2], tmp;
|
||||
uint16_t line_cnt = 0;
|
||||
lv_memset_00(&lines, sizeof(lines));
|
||||
lv_memzero(&lines, sizeof(lines));
|
||||
int psign_prev = 0;
|
||||
for(i = 0; i < param->cfg.point_cnt; i++) {
|
||||
lv_point_t p1 = param->cfg.points[i];
|
||||
@@ -1367,9 +1367,9 @@ static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radi
|
||||
c->radius = radius;
|
||||
|
||||
/*Allocate buffers*/
|
||||
if(c->buf) lv_mem_free(c->buf);
|
||||
if(c->buf) lv_free(c->buf);
|
||||
|
||||
c->buf = lv_mem_alloc(radius * 6 + 6); /*Use uint16_t for opa_start_on_y and x_start_on_y*/
|
||||
c->buf = lv_malloc(radius * 6 + 6); /*Use uint16_t for opa_start_on_y and x_start_on_y*/
|
||||
LV_ASSERT_MALLOC(c->buf);
|
||||
c->cir_opa = c->buf;
|
||||
c->opa_start_on_y = (uint16_t *)(c->buf + 2 * radius + 2);
|
||||
@@ -1384,7 +1384,7 @@ static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radi
|
||||
return;
|
||||
}
|
||||
|
||||
lv_coord_t * cir_x = lv_mem_buf_get((radius + 1) * 2 * 2 * sizeof(lv_coord_t));
|
||||
lv_coord_t * cir_x = lv_malloc((radius + 1) * 2 * 2 * sizeof(lv_coord_t));
|
||||
lv_coord_t * cir_y = &cir_x[(radius + 1) * 2];
|
||||
|
||||
uint32_t y_8th_cnt = 0;
|
||||
@@ -1506,7 +1506,7 @@ static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radi
|
||||
y++;
|
||||
}
|
||||
|
||||
lv_mem_buf_release(cir_x);
|
||||
lv_free(cir_x);
|
||||
}
|
||||
|
||||
static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len,
|
||||
@@ -1527,4 +1527,4 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_
|
||||
}
|
||||
|
||||
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
#endif /*LV_USE_DRAW_MASKS*/
|
||||
|
||||
@@ -23,7 +23,7 @@ extern "C" {
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define LV_MASK_ID_INV (-1)
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
# define _LV_MASK_MAX_NUM 16
|
||||
#else
|
||||
# define _LV_MASK_MAX_NUM 1
|
||||
@@ -51,7 +51,7 @@ typedef _lv_draw_mask_saved_t _lv_draw_mask_saved_arr_t[_LV_MASK_MAX_NUM];
|
||||
|
||||
|
||||
|
||||
#if LV_DRAW_COMPLEX == 0
|
||||
#if LV_USE_DRAW_MASKS == 0
|
||||
static inline uint8_t lv_draw_mask_get_cnt(void)
|
||||
{
|
||||
return 0;
|
||||
@@ -65,7 +65,7 @@ static inline bool lv_draw_mask_is_any(const lv_area_t * a)
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
|
||||
enum {
|
||||
LV_DRAW_MASK_TYPE_LINE,
|
||||
@@ -163,7 +163,7 @@ typedef struct {
|
||||
lv_coord_t radius; /*The radius of the entry*/
|
||||
} _lv_draw_mask_radius_circle_dsc_t;
|
||||
|
||||
typedef _lv_draw_mask_radius_circle_dsc_t _lv_draw_mask_radius_circle_dsc_arr_t[LV_CIRCLE_CACHE_SIZE];
|
||||
typedef _lv_draw_mask_radius_circle_dsc_t _lv_draw_mask_radius_circle_dsc_arr_t[LV_DRAW_SW_CIRCLE_CACHE_SIZE];
|
||||
|
||||
typedef struct {
|
||||
/*The first element must be the common descriptor*/
|
||||
@@ -381,7 +381,7 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
|
||||
|
||||
void lv_draw_mask_polygon_init(lv_draw_mask_polygon_param_t * param, const lv_point_t * points, uint16_t point_cnt);
|
||||
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
#endif /*LV_USE_DRAW_MASKS*/
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_draw_rect_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_draw_rect_dsc_t));
|
||||
dsc->bg_color = lv_color_white();
|
||||
dsc->bg_grad.stops[0].color = lv_color_white();
|
||||
dsc->bg_grad.stops[1].color = lv_color_black();
|
||||
|
||||
+13
-13
@@ -57,7 +57,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
|
||||
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA || dsc->header.cf == LV_IMG_CF_RGB565A8) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||
lv_memcpy(&p_color, &buf_u8[px], sizeof(lv_color_t));
|
||||
#if LV_COLOR_SIZE == 32
|
||||
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a default alpha value*/
|
||||
#endif
|
||||
@@ -244,12 +244,12 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
|
||||
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&buf_u8[px], &c, px_size);
|
||||
lv_memcpy(&buf_u8[px], &c, px_size);
|
||||
}
|
||||
else if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
|
||||
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
|
||||
uint32_t px = dsc->header.w * y * px_size + x * px_size;
|
||||
lv_memcpy_small(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
|
||||
lv_memcpy(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
|
||||
}
|
||||
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
|
||||
buf_u8 += sizeof(lv_color32_t) * 2; /*Skip the palette*/
|
||||
@@ -317,7 +317,7 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
lv_color32_t c32;
|
||||
c32.full = lv_color_to32(c);
|
||||
uint8_t * buf = (uint8_t *)dsc->data;
|
||||
lv_memcpy_small(&buf[id * sizeof(c32)], &c32, sizeof(c32));
|
||||
lv_memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,26 +330,26 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
|
||||
lv_img_dsc_t * lv_img_buf_alloc(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
{
|
||||
/*Allocate image descriptor*/
|
||||
lv_img_dsc_t * dsc = lv_mem_alloc(sizeof(lv_img_dsc_t));
|
||||
lv_img_dsc_t * dsc = lv_malloc(sizeof(lv_img_dsc_t));
|
||||
if(dsc == NULL)
|
||||
return NULL;
|
||||
|
||||
lv_memset_00(dsc, sizeof(lv_img_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_img_dsc_t));
|
||||
|
||||
/*Get image data size*/
|
||||
dsc->data_size = lv_img_buf_get_img_size(w, h, cf);
|
||||
if(dsc->data_size == 0) {
|
||||
lv_mem_free(dsc);
|
||||
lv_free(dsc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*Allocate raw buffer*/
|
||||
dsc->data = lv_mem_alloc(dsc->data_size);
|
||||
dsc->data = lv_malloc(dsc->data_size);
|
||||
if(dsc->data == NULL) {
|
||||
lv_mem_free(dsc);
|
||||
lv_free(dsc);
|
||||
return NULL;
|
||||
}
|
||||
lv_memset_00((uint8_t *)dsc->data, dsc->data_size);
|
||||
lv_memzero((uint8_t *)dsc->data, dsc->data_size);
|
||||
|
||||
/*Fill in header*/
|
||||
dsc->header.always_zero = 0;
|
||||
@@ -367,9 +367,9 @@ void lv_img_buf_free(lv_img_dsc_t * dsc)
|
||||
{
|
||||
if(dsc != NULL) {
|
||||
if(dsc->data != NULL)
|
||||
lv_mem_free((void *)dsc->data);
|
||||
lv_free((void *)dsc->data);
|
||||
|
||||
lv_mem_free(dsc);
|
||||
lv_free(dsc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ uint32_t lv_img_buf_get_img_size(lv_coord_t w, lv_coord_t h, lv_img_cf_t cf)
|
||||
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,
|
||||
const lv_point_t * pivot)
|
||||
{
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
if(angle == 0 && zoom == LV_IMG_ZOOM_NONE) {
|
||||
res->x1 = 0;
|
||||
res->y1 = 0;
|
||||
|
||||
@@ -123,7 +123,7 @@ _lv_img_cache_entry_t * _lv_img_cache_open(const void * src, lv_color_t color, i
|
||||
lv_res_t open_res = lv_img_decoder_open(&cached_src->dec_dsc, src, color, frame_id);
|
||||
if(open_res == LV_RES_INV) {
|
||||
LV_LOG_WARN("Image draw cannot open the image resource");
|
||||
lv_memset_00(cached_src, sizeof(_lv_img_cache_entry_t));
|
||||
lv_memzero(cached_src, sizeof(_lv_img_cache_entry_t));
|
||||
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its us*/
|
||||
return NULL;
|
||||
}
|
||||
@@ -155,11 +155,11 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
|
||||
if(LV_GC_ROOT(_lv_img_cache_array) != NULL) {
|
||||
/*Clean the cache before free it*/
|
||||
lv_img_cache_invalidate_src(NULL);
|
||||
lv_mem_free(LV_GC_ROOT(_lv_img_cache_array));
|
||||
lv_free(LV_GC_ROOT(_lv_img_cache_array));
|
||||
}
|
||||
|
||||
/*Reallocate the cache*/
|
||||
LV_GC_ROOT(_lv_img_cache_array) = lv_mem_alloc(sizeof(_lv_img_cache_entry_t) * new_entry_cnt);
|
||||
LV_GC_ROOT(_lv_img_cache_array) = lv_malloc(sizeof(_lv_img_cache_entry_t) * new_entry_cnt);
|
||||
LV_ASSERT_MALLOC(LV_GC_ROOT(_lv_img_cache_array));
|
||||
if(LV_GC_ROOT(_lv_img_cache_array) == NULL) {
|
||||
entry_cnt = 0;
|
||||
@@ -168,7 +168,7 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
|
||||
entry_cnt = new_entry_cnt;
|
||||
|
||||
/*Clean the cache*/
|
||||
lv_memset_00(LV_GC_ROOT(_lv_img_cache_array), entry_cnt * sizeof(_lv_img_cache_entry_t));
|
||||
lv_memzero(LV_GC_ROOT(_lv_img_cache_array), entry_cnt * sizeof(_lv_img_cache_entry_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ void lv_img_cache_invalidate_src(const void * src)
|
||||
lv_img_decoder_close(&cache[i].dec_dsc);
|
||||
}
|
||||
|
||||
lv_memset_00(&cache[i], sizeof(_lv_img_cache_entry_t));
|
||||
lv_memzero(&cache[i], sizeof(_lv_img_cache_entry_t));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+22
-22
@@ -82,7 +82,7 @@ void _lv_img_decoder_init(void)
|
||||
*/
|
||||
lv_res_t lv_img_decoder_get_info(const void * src, lv_img_header_t * header)
|
||||
{
|
||||
lv_memset_00(header, sizeof(lv_img_header_t));
|
||||
lv_memzero(header, sizeof(lv_img_header_t));
|
||||
|
||||
if(src == NULL) return LV_RES_INV;
|
||||
|
||||
@@ -106,7 +106,7 @@ lv_res_t lv_img_decoder_get_info(const void * src, lv_img_header_t * header)
|
||||
|
||||
lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_color_t color, int32_t frame_id)
|
||||
{
|
||||
lv_memset_00(dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
lv_memzero(dsc, sizeof(lv_img_decoder_dsc_t));
|
||||
|
||||
if(src == NULL) return LV_RES_INV;
|
||||
lv_img_src_t src_type = lv_img_src_get_type(src);
|
||||
@@ -121,7 +121,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||
size_t fnlen = strlen(src);
|
||||
dsc->src = lv_mem_alloc(fnlen + 1);
|
||||
dsc->src = lv_malloc(fnlen + 1);
|
||||
LV_ASSERT_MALLOC(dsc->src);
|
||||
if(dsc->src == NULL) {
|
||||
LV_LOG_WARN("lv_img_decoder_open: out of memory");
|
||||
@@ -150,7 +150,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
if(res == LV_RES_OK) return res;
|
||||
|
||||
/*Prepare for the next loop*/
|
||||
lv_memset_00(&dsc->header, sizeof(lv_img_header_t));
|
||||
lv_memzero(&dsc->header, sizeof(lv_img_header_t));
|
||||
|
||||
dsc->error_msg = NULL;
|
||||
dsc->img_data = NULL;
|
||||
@@ -159,7 +159,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
}
|
||||
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE)
|
||||
lv_mem_free((void *)dsc->src);
|
||||
lv_free((void *)dsc->src);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc)
|
||||
if(dsc->decoder->close_cb) dsc->decoder->close_cb(dsc->decoder, dsc);
|
||||
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||
lv_mem_free((void *)dsc->src);
|
||||
lv_free((void *)dsc->src);
|
||||
dsc->src = NULL;
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ lv_img_decoder_t * lv_img_decoder_create(void)
|
||||
LV_ASSERT_MALLOC(decoder);
|
||||
if(decoder == NULL) return NULL;
|
||||
|
||||
lv_memset_00(decoder, sizeof(lv_img_decoder_t));
|
||||
lv_memzero(decoder, sizeof(lv_img_decoder_t));
|
||||
|
||||
return decoder;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ lv_img_decoder_t * lv_img_decoder_create(void)
|
||||
void lv_img_decoder_delete(lv_img_decoder_t * decoder)
|
||||
{
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_img_decoder_ll), decoder);
|
||||
lv_mem_free(decoder);
|
||||
lv_free(decoder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,18 +339,18 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
|
||||
/*If the file was open successfully save the file descriptor*/
|
||||
if(dsc->user_data == NULL) {
|
||||
dsc->user_data = lv_mem_alloc(sizeof(lv_img_decoder_built_in_data_t));
|
||||
dsc->user_data = lv_malloc(sizeof(lv_img_decoder_built_in_data_t));
|
||||
LV_ASSERT_MALLOC(dsc->user_data);
|
||||
if(dsc->user_data == NULL) {
|
||||
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
|
||||
lv_fs_close(&f);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
lv_memzero(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
}
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
lv_memcpy_small(&user_data->f, &f, sizeof(f));
|
||||
lv_memcpy(&user_data->f, &f, sizeof(f));
|
||||
}
|
||||
else if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
/*The variables should have valid data*/
|
||||
@@ -383,19 +383,19 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
|
||||
|
||||
/*Allocate the palette*/
|
||||
if(dsc->user_data == NULL) {
|
||||
dsc->user_data = lv_mem_alloc(sizeof(lv_img_decoder_built_in_data_t));
|
||||
dsc->user_data = lv_malloc(sizeof(lv_img_decoder_built_in_data_t));
|
||||
LV_ASSERT_MALLOC(dsc->user_data);
|
||||
if(dsc->user_data == NULL) {
|
||||
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
lv_memzero(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
|
||||
}
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
user_data->palette = lv_mem_alloc(palette_size * sizeof(lv_color_t));
|
||||
user_data->palette = lv_malloc(palette_size * sizeof(lv_color_t));
|
||||
LV_ASSERT_MALLOC(user_data->palette);
|
||||
user_data->opa = lv_mem_alloc(palette_size * sizeof(lv_opa_t));
|
||||
user_data->opa = lv_malloc(palette_size * sizeof(lv_opa_t));
|
||||
LV_ASSERT_MALLOC(user_data->opa);
|
||||
if(user_data->palette == NULL || user_data->opa == NULL) {
|
||||
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
|
||||
@@ -497,10 +497,10 @@ void lv_img_decoder_built_in_close(lv_img_decoder_t * decoder, lv_img_decoder_ds
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||
lv_fs_close(&user_data->f);
|
||||
}
|
||||
if(user_data->palette) lv_mem_free(user_data->palette);
|
||||
if(user_data->opa) lv_mem_free(user_data->opa);
|
||||
if(user_data->palette) lv_free(user_data->palette);
|
||||
if(user_data->opa) lv_free(user_data->opa);
|
||||
|
||||
lv_mem_free(user_data);
|
||||
lv_free(user_data);
|
||||
dsc->user_data = NULL;
|
||||
}
|
||||
}
|
||||
@@ -594,7 +594,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
||||
}
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
uint8_t * fs_buf = lv_mem_buf_get(w);
|
||||
uint8_t * fs_buf = lv_malloc(w);
|
||||
if(fs_buf == NULL) return LV_RES_INV;
|
||||
|
||||
const uint8_t * data_tmp = NULL;
|
||||
@@ -621,7 +621,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
||||
data_tmp++;
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(fs_buf);
|
||||
lv_free(fs_buf);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
@@ -663,7 +663,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
|
||||
uint8_t * fs_buf = lv_mem_buf_get(w);
|
||||
uint8_t * fs_buf = lv_malloc(w);
|
||||
if(fs_buf == NULL) return LV_RES_INV;
|
||||
const uint8_t * data_tmp = NULL;
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
@@ -700,6 +700,6 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
data_tmp++;
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(fs_buf);
|
||||
lv_free(fs_buf);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ static void lv_draw_nxp_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t
|
||||
lv_draw_rect_dsc_t nxp_dsc;
|
||||
|
||||
lv_memcpy(&nxp_dsc, dsc, sizeof(nxp_dsc));
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
/* Draw only the shadow */
|
||||
nxp_dsc.bg_opa = 0;
|
||||
nxp_dsc.bg_img_opa = 0;
|
||||
@@ -330,7 +330,7 @@ static void lv_draw_nxp_rect(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t
|
||||
nxp_dsc.shadow_opa = 0;
|
||||
nxp_dsc.bg_opa = dsc->bg_opa;
|
||||
done = (draw_nxp_bg(draw_ctx, &nxp_dsc, coords) == LV_RES_OK);
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
#endif /*LV_USE_DRAW_MASKS*/
|
||||
|
||||
/* Draw the remaining parts */
|
||||
nxp_dsc.shadow_opa = 0;
|
||||
@@ -393,7 +393,7 @@ static void lv_draw_nxp_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t *
|
||||
{
|
||||
bool done = false;
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
#if LV_USE_DRAW_MASKS
|
||||
if(dsc->opa <= LV_OPA_MIN)
|
||||
return;
|
||||
if(dsc->width == 0)
|
||||
@@ -409,7 +409,7 @@ static void lv_draw_nxp_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_dsc_t *
|
||||
VG_LITE_LOG_TRACE("VG-Lite draw arc failed. Fallback.");
|
||||
}
|
||||
#endif
|
||||
#endif/*LV_DRAW_COMPLEX*/
|
||||
#endif/*LV_USE_DRAW_MASKS*/
|
||||
|
||||
if(!done)
|
||||
lv_draw_sw_arc(draw_ctx, dsc, center, radius, start_angle, end_angle);
|
||||
|
||||
@@ -386,7 +386,7 @@ static lv_res_t lv_gpu_nxp_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t *
|
||||
if(ROUND_UP(size, ALIGN_SIZE) >= LV_MEM_SIZE)
|
||||
PXP_RETURN_INV("Insufficient memory for temporary buffer. Please increase LV_MEM_SIZE.");
|
||||
|
||||
lv_color_t * tmp_buf = (lv_color_t *)lv_mem_buf_get(size);
|
||||
lv_color_t * tmp_buf = (lv_color_t *)lv_malloc(size);
|
||||
if(!tmp_buf)
|
||||
PXP_RETURN_INV("Allocating temporary buffer failed.");
|
||||
|
||||
@@ -401,7 +401,7 @@ static lv_res_t lv_gpu_nxp_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t *
|
||||
res = lv_gpu_nxp_pxp_blit_cover(tmp_buf, &tmp_area, dest_w, src_buf, src_area, dsc, cf);
|
||||
if(res != LV_RES_OK) {
|
||||
PXP_LOG_TRACE("Blit cover with full opacity failed.");
|
||||
lv_mem_buf_release(tmp_buf);
|
||||
lv_free(tmp_buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ static lv_res_t lv_gpu_nxp_pxp_blit_opa(lv_color_t * dest_buf, const lv_area_t *
|
||||
res = lv_gpu_nxp_pxp_blit_cf(dest_buf, dest_area, dest_stride, tmp_buf, &tmp_area, dsc, cf);
|
||||
|
||||
/*Clean-up memory*/
|
||||
lv_mem_buf_release(tmp_buf);
|
||||
lv_free(tmp_buf);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ lv_res_t lv_gpu_nxp_vglite_draw_arc(lv_draw_ctx_t * draw_ctx, const lv_draw_arc_
|
||||
|
||||
/* path: max size = 16 cubic bezier (7 words each) */
|
||||
int32_t arc_path[16 * 7];
|
||||
lv_memset_00(arc_path, sizeof(arc_path));
|
||||
lv_memzero(arc_path, sizeof(arc_path));
|
||||
|
||||
/*** Init destination buffer ***/
|
||||
if(lv_vglite_init_buf(&vgbuf, (uint32_t)dest_width, (uint32_t)dest_height, (uint32_t)dest_width * sizeof(lv_color_t),
|
||||
|
||||
@@ -168,7 +168,7 @@ lv_res_t lv_gpu_nxp_vglite_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_
|
||||
#endif
|
||||
}
|
||||
|
||||
lv_memset_00(&gradient, sizeof(vg_lite_linear_gradient_t));
|
||||
lv_memzero(&gradient, sizeof(vg_lite_linear_gradient_t));
|
||||
|
||||
err = vg_lite_init_grad(&gradient);
|
||||
VG_LITE_ERR_RETURN_INV(err, "Init gradient failed");
|
||||
|
||||
@@ -93,7 +93,7 @@ lv_res_t lv_vglite_init_buf(vg_lite_buffer_t * vgbuf, uint32_t width, uint32_t h
|
||||
vgbuf->height = (int32_t)height;
|
||||
vgbuf->stride = (int32_t)stride;
|
||||
|
||||
lv_memset_00(&vgbuf->yuv, sizeof(vgbuf->yuv));
|
||||
lv_memzero(&vgbuf->yuv, sizeof(vgbuf->yuv));
|
||||
|
||||
vgbuf->memory = (void *)ptr;
|
||||
vgbuf->address = (uint32_t)vgbuf->memory;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
@@ -62,7 +62,7 @@ void lv_draw_sdl_draw_bg(lv_draw_ctx_t * draw_ctx, const lv_draw_rect_dsc_t * ds
|
||||
void lv_draw_sdl_init_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
_lv_draw_sdl_utils_init();
|
||||
lv_memset_00(draw_ctx, sizeof(lv_draw_sdl_ctx_t));
|
||||
lv_memzero(draw_ctx, sizeof(lv_draw_sdl_ctx_t));
|
||||
draw_ctx->draw_rect = lv_draw_sdl_draw_rect;
|
||||
draw_ctx->draw_img = lv_draw_sdl_img_core;
|
||||
draw_ctx->draw_letter = lv_draw_sdl_draw_letter;
|
||||
@@ -76,8 +76,8 @@ void lv_draw_sdl_init_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)
|
||||
draw_ctx->layer_instance_size = sizeof(lv_draw_sdl_layer_ctx_t);
|
||||
lv_draw_sdl_ctx_t * draw_ctx_sdl = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
draw_ctx_sdl->renderer = ((lv_draw_sdl_drv_param_t *) disp_drv->user_data)->renderer;
|
||||
draw_ctx_sdl->internals = lv_mem_alloc(sizeof(lv_draw_sdl_context_internals_t));
|
||||
lv_memset_00(draw_ctx_sdl->internals, sizeof(lv_draw_sdl_context_internals_t));
|
||||
draw_ctx_sdl->internals = lv_malloc(sizeof(lv_draw_sdl_context_internals_t));
|
||||
lv_memzero(draw_ctx_sdl->internals, sizeof(lv_draw_sdl_context_internals_t));
|
||||
lv_draw_sdl_texture_cache_init(draw_ctx_sdl);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ void lv_draw_sdl_deinit_ctx(lv_disp_drv_t * disp_drv, lv_draw_ctx_t * draw_ctx)
|
||||
{
|
||||
lv_draw_sdl_ctx_t * draw_ctx_sdl = (lv_draw_sdl_ctx_t *) draw_ctx;
|
||||
lv_draw_sdl_texture_cache_deinit(draw_ctx_sdl);
|
||||
lv_mem_free(draw_ctx_sdl->internals);
|
||||
lv_free(draw_ctx_sdl->internals);
|
||||
_lv_draw_sdl_utils_deinit();
|
||||
}
|
||||
|
||||
@@ -100,4 +100,4 @@ SDL_Texture * lv_draw_sdl_create_screen_texture(SDL_Renderer * renderer, lv_coor
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -16,9 +16,9 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
#include LV_DARW_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
#include "../../core/lv_disp.h"
|
||||
@@ -87,7 +87,7 @@ SDL_Texture * lv_draw_sdl_create_screen_texture(SDL_Renderer * renderer, lv_coor
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
@@ -151,17 +151,17 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords, const in
|
||||
int pitch;
|
||||
if(SDL_LockTexture(texture, &rect, (void **) &pixels, &pitch) != 0) return;
|
||||
|
||||
lv_opa_t * line_buf = lv_mem_buf_get(rect.w);
|
||||
lv_opa_t * line_buf = lv_malloc(rect.w);
|
||||
for(lv_coord_t y = 0; y < rect.h; y++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_memset(line_buf, 0xff, rect.w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) rect.w;
|
||||
lv_draw_mask_res_t res;
|
||||
res = lv_draw_mask_apply_ids(line_buf, abs_x, abs_y, len, ids, ids_count);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memzero(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memset(&pixels[y * pitch], 0xff, 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
@@ -172,13 +172,13 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords, const in
|
||||
}
|
||||
if(caps) {
|
||||
for(int i = 0; i < 2; i++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_memset(line_buf, 0xff, rect.w);
|
||||
res = lv_draw_mask_apply_ids(line_buf, abs_x, abs_y, len, &caps[i], 1);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
/* Ignore */
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memset(&pixels[y * pitch], 0xff, 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
@@ -191,7 +191,7 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords, const in
|
||||
}
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(line_buf);
|
||||
lv_free(line_buf);
|
||||
SDL_UnlockTexture(texture);
|
||||
}
|
||||
|
||||
@@ -235,4 +235,4 @@ static void get_cap_area(int16_t angle, lv_coord_t thickness, uint16_t radius, c
|
||||
lv_area_move(out, center->x, center->y);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "../lv_draw_rect.h"
|
||||
#include "../lv_draw_img.h"
|
||||
@@ -103,4 +103,4 @@ static void draw_bg_img(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coords, const
|
||||
lv_draw_rect((lv_draw_ctx_t *) ctx, dsc, coords);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "../../misc/lv_gc.h"
|
||||
#include "../../core/lv_refr.h"
|
||||
@@ -79,7 +79,7 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
if(!_lv_area_intersect(apply_area, &full_coords, clip_in)) return false;
|
||||
bool has_mask = lv_draw_mask_is_any(apply_area);
|
||||
|
||||
const bool draw_mask = has_mask && LV_GPU_SDL_CUSTOM_BLEND_MODE;
|
||||
const bool draw_mask = has_mask && LV_DARW_SDL_CUSTOM_BLEND_MODE;
|
||||
const bool draw_blend = blend_mode != LV_BLEND_MODE_NORMAL;
|
||||
if(draw_mask || draw_blend) {
|
||||
lv_draw_sdl_context_internals_t * internals = ctx->internals;
|
||||
@@ -96,7 +96,7 @@ bool lv_draw_sdl_composite_begin(lv_draw_sdl_ctx_t * ctx, const lv_area_t * coor
|
||||
SDL_SetRenderTarget(ctx->renderer, internals->composition);
|
||||
SDL_SetRenderDrawColor(ctx->renderer, 255, 255, 255, 0);
|
||||
SDL_RenderClear(ctx->renderer);
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
#if LV_DARW_SDL_CUSTOM_BLEND_MODE
|
||||
internals->mask = lv_draw_sdl_composite_texture_obtain(ctx, LV_DRAW_SDL_COMPOSITE_TEXTURE_ID_STREAM0, w, h);
|
||||
dump_masks(internals->mask, apply_area);
|
||||
#endif
|
||||
@@ -125,7 +125,7 @@ void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_
|
||||
{
|
||||
lv_draw_sdl_context_internals_t * internals = ctx->internals;
|
||||
SDL_Rect src_rect = {0, 0, lv_area_get_width(apply_area), lv_area_get_height(apply_area)};
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
#if LV_DARW_SDL_CUSTOM_BLEND_MODE
|
||||
if(internals->mask) {
|
||||
SDL_BlendMode mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE,
|
||||
SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_ZERO,
|
||||
@@ -148,7 +148,7 @@ void lv_draw_sdl_composite_end(lv_draw_sdl_ctx_t * ctx, const lv_area_t * apply_
|
||||
case LV_BLEND_MODE_ADDITIVE:
|
||||
SDL_SetTextureBlendMode(internals->composition, SDL_BLENDMODE_ADD);
|
||||
break;
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
#if LV_DARW_SDL_CUSTOM_BLEND_MODE
|
||||
case LV_BLEND_MODE_SUBTRACTIVE: {
|
||||
SDL_BlendMode mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE,
|
||||
SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ONE,
|
||||
@@ -193,9 +193,9 @@ SDL_Texture * lv_draw_sdl_composite_texture_obtain(lv_draw_sdl_ctx_t * ctx, lv_d
|
||||
access = SDL_TEXTUREACCESS_TARGET;
|
||||
}
|
||||
result = SDL_CreateTexture(ctx->renderer, LV_DRAW_SDL_TEXTURE_FORMAT, access, size, size);
|
||||
tex_size = lv_mem_alloc(sizeof(lv_point_t));
|
||||
tex_size = lv_malloc(sizeof(lv_point_t));
|
||||
tex_size->x = tex_size->y = size;
|
||||
lv_draw_sdl_texture_cache_put_advanced(ctx, &mask_key, sizeof(composite_key_t), result, tex_size, lv_mem_free, 0);
|
||||
lv_draw_sdl_texture_cache_put_advanced(ctx, &mask_key, sizeof(composite_key_t), result, tex_size, lv_free, 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -232,17 +232,17 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords)
|
||||
int pitch;
|
||||
if(SDL_LockTexture(texture, &rect, (void **) &pixels, &pitch) != 0) return;
|
||||
|
||||
lv_opa_t * line_buf = lv_mem_buf_get(rect.w);
|
||||
lv_opa_t * line_buf = lv_malloc(rect.w);
|
||||
for(lv_coord_t y = 0; y < rect.h; y++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_memset(line_buf, 0xff, rect.w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) rect.w;
|
||||
lv_draw_mask_res_t res;
|
||||
res = lv_draw_mask_apply(line_buf, abs_x, abs_y, len);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memzero(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memset(&pixels[y * pitch], 0xff, 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
@@ -252,8 +252,8 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords)
|
||||
}
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(line_buf);
|
||||
lv_free(line_buf);
|
||||
SDL_UnlockTexture(texture);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
#include LV_DARW_SDL_INCLUDE_PATH
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "../../misc/lv_area.h"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "../lv_draw_img.h"
|
||||
#include "../lv_img_cache.h"
|
||||
@@ -254,7 +254,7 @@ static SDL_Texture * upload_img_texture_fallback(SDL_Renderer * renderer, lv_img
|
||||
{
|
||||
lv_coord_t h = (lv_coord_t) dsc->header.h;
|
||||
lv_coord_t w = (lv_coord_t) dsc->header.w;
|
||||
uint8_t * data = lv_mem_buf_get(w * h * sizeof(lv_color_t));
|
||||
uint8_t * data = lv_malloc(w * h * sizeof(lv_color_t));
|
||||
for(lv_coord_t y = 0; y < h; y++) {
|
||||
lv_img_decoder_read_line(dsc, 0, y, w, &data[y * w * sizeof(lv_color_t)]);
|
||||
}
|
||||
@@ -267,7 +267,7 @@ static SDL_Texture * upload_img_texture_fallback(SDL_Renderer * renderer, lv_img
|
||||
SDL_SetColorKey(surface, SDL_TRUE, lv_color_to32(LV_COLOR_CHROMA_KEY));
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
lv_mem_buf_release(data);
|
||||
lv_free(data);
|
||||
return texture;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ static SDL_Texture * img_rounded_frag_obtain(lv_draw_sdl_ctx_t * ctx, SDL_Textur
|
||||
|
||||
SDL_SetTextureAlphaMod(texture, 0xFF);
|
||||
SDL_SetTextureColorMod(texture, 0xFF, 0xFF, 0xFF);
|
||||
#if LV_GPU_SDL_CUSTOM_BLEND_MODE
|
||||
#if LV_DARW_SDL_CUSTOM_BLEND_MODE
|
||||
SDL_BlendMode blend_mode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO,
|
||||
SDL_BLENDOPERATION_ADD, SDL_BLENDFACTOR_DST_ALPHA,
|
||||
SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD);
|
||||
@@ -461,4 +461,4 @@ static lv_draw_img_rounded_key_t rounded_key_create(const SDL_Texture * texture,
|
||||
return key;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -16,9 +16,9 @@ extern "C" {
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
#include LV_DARW_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw.h"
|
||||
|
||||
@@ -63,7 +63,7 @@ bool lv_draw_sdl_img_load_texture(lv_draw_sdl_ctx_t * ctx, lv_draw_sdl_cache_key
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
#include LV_DARW_SDL_INCLUDE_PATH
|
||||
|
||||
#include "../lv_draw_label.h"
|
||||
#include "../../misc/lv_utils.h"
|
||||
@@ -122,12 +122,12 @@ void lv_draw_sdl_draw_letter(lv_draw_ctx_t * draw_ctx, const lv_draw_label_dsc_t
|
||||
font_p = g.resolved_font;
|
||||
}
|
||||
const uint8_t * bmp = lv_font_get_glyph_bitmap(font_p, letter);
|
||||
uint8_t * buf = lv_mem_alloc(g.box_w * g.box_h);
|
||||
uint8_t * buf = lv_malloc(g.box_w * g.box_h);
|
||||
lv_sdl_to_8bpp(buf, bmp, g.box_w, g.box_h, g.box_w, g.bpp);
|
||||
SDL_Surface * mask = lv_sdl_create_opa_surface(buf, g.box_w, g.box_h, g.box_w);
|
||||
texture = SDL_CreateTextureFromSurface(renderer, mask);
|
||||
SDL_FreeSurface(mask);
|
||||
lv_mem_free(buf);
|
||||
lv_free(buf);
|
||||
lv_draw_sdl_texture_cache_put(ctx, &glyph_key, sizeof(glyph_key), texture);
|
||||
}
|
||||
if(!texture) {
|
||||
@@ -173,4 +173,4 @@ static lv_font_glyph_key_t font_key_glyph_create(const lv_font_t * font_p, uint3
|
||||
return key;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "../../core/lv_refr.h"
|
||||
|
||||
@@ -129,4 +129,4 @@ void lv_draw_sdl_transform_areas_offset(lv_draw_sdl_ctx_t * ctx, bool has_compos
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
@@ -110,7 +110,7 @@ void lv_draw_sdl_draw_line(lv_draw_ctx_t * draw_ctx, const lv_draw_line_dsc_t *
|
||||
static lv_draw_line_key_t line_key_create(const lv_draw_line_dsc_t * dsc, lv_coord_t length)
|
||||
{
|
||||
lv_draw_line_key_t key;
|
||||
lv_memset_00(&key, sizeof(lv_draw_line_key_t));
|
||||
lv_memzero(&key, sizeof(lv_draw_line_key_t));
|
||||
key.magic = LV_GPU_CACHE_KEY_MAGIC_LINE;
|
||||
key.length = length;
|
||||
key.width = dsc->width;
|
||||
@@ -151,4 +151,4 @@ static SDL_Texture * line_texture_create(lv_draw_sdl_ctx_t * sdl_ctx, const lv_d
|
||||
return texture;
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "../../misc/lv_gc.h"
|
||||
#include "lv_draw_sdl_mask.h"
|
||||
@@ -46,10 +46,10 @@ lv_opa_t * lv_draw_sdl_mask_dump_opa(const lv_area_t * coords, const int16_t * i
|
||||
SDL_assert(coords->x2 >= coords->x1);
|
||||
SDL_assert(coords->y2 >= coords->y1);
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
lv_opa_t * mask_buf = lv_mem_buf_get(w * h);
|
||||
lv_opa_t * mask_buf = lv_malloc(w * h);
|
||||
for(lv_coord_t y = 0; y < h; y++) {
|
||||
lv_opa_t * line_buf = &mask_buf[y * w];
|
||||
lv_memset_ff(line_buf, w);
|
||||
lv_memset(line_buf, 0xff, w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) w;
|
||||
lv_draw_mask_res_t res;
|
||||
if(ids) {
|
||||
@@ -59,7 +59,7 @@ lv_opa_t * lv_draw_sdl_mask_dump_opa(const lv_area_t * coords, const int16_t * i
|
||||
res = lv_draw_mask_apply(line_buf, abs_x, abs_y, len);
|
||||
}
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(line_buf, w);
|
||||
lv_memzero(line_buf, w);
|
||||
}
|
||||
}
|
||||
return mask_buf;
|
||||
@@ -71,7 +71,7 @@ SDL_Texture * lv_draw_sdl_mask_dump_texture(SDL_Renderer * renderer, const lv_ar
|
||||
lv_coord_t w = lv_area_get_width(coords), h = lv_area_get_height(coords);
|
||||
lv_opa_t * mask_buf = lv_draw_sdl_mask_dump_opa(coords, ids, ids_count);
|
||||
SDL_Surface * surface = lv_sdl_create_opa_surface(mask_buf, w, h, w);
|
||||
lv_mem_buf_release(mask_buf);
|
||||
lv_free(mask_buf);
|
||||
SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, surface);
|
||||
SDL_FreeSurface(surface);
|
||||
return texture;
|
||||
@@ -81,4 +81,4 @@ SDL_Texture * lv_draw_sdl_mask_dump_texture(SDL_Renderer * renderer, const lv_ar
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#include LV_GPU_SDL_INCLUDE_PATH
|
||||
#include LV_DARW_SDL_INCLUDE_PATH
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "../../misc/lv_area.h"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*********************/
|
||||
#include "../../lv_conf_internal.h"
|
||||
|
||||
#if LV_USE_GPU_SDL
|
||||
#if LV_USE_DRAW_SDL
|
||||
|
||||
#include "lv_draw_sdl.h"
|
||||
#include "lv_draw_sdl_utils.h"
|
||||
@@ -106,17 +106,17 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords)
|
||||
int pitch;
|
||||
if(SDL_LockTexture(texture, &rect, (void **) &pixels, &pitch) != 0) return;
|
||||
|
||||
lv_opa_t * line_buf = lv_mem_buf_get(rect.w);
|
||||
lv_opa_t * line_buf = lv_malloc(rect.w);
|
||||
for(lv_coord_t y = 0; y < rect.h; y++) {
|
||||
lv_memset_ff(line_buf, rect.w);
|
||||
lv_memset(line_buf, 0xff, rect.w);
|
||||
lv_coord_t abs_x = (lv_coord_t) coords->x1, abs_y = (lv_coord_t)(y + coords->y1), len = (lv_coord_t) rect.w;
|
||||
lv_draw_mask_res_t res;
|
||||
res = lv_draw_mask_apply(line_buf, abs_x, abs_y, len);
|
||||
if(res == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memzero(&pixels[y * pitch], 4 * rect.w);
|
||||
}
|
||||
else if(res == LV_DRAW_MASK_RES_FULL_COVER) {
|
||||
lv_memset_ff(&pixels[y * pitch], 4 * rect.w);
|
||||
lv_memset(&pixels[y * pitch], 0xff, 4 * rect.w);
|
||||
}
|
||||
else {
|
||||
for(int x = 0; x < rect.w; x++) {
|
||||
@@ -126,8 +126,8 @@ static void dump_masks(SDL_Texture * texture, const lv_area_t * coords)
|
||||
}
|
||||
}
|
||||
}
|
||||
lv_mem_buf_release(line_buf);
|
||||
lv_free(line_buf);
|
||||
SDL_UnlockTexture(texture);
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GPU_SDL*/
|
||||
#endif /*LV_USE_DRAW_SDL*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user