diff --git a/Kconfig b/Kconfig index c4c4ae4c36..cfcd6561a9 100644 --- a/Kconfig +++ b/Kconfig @@ -325,7 +325,7 @@ menu "LVGL configuration" endmenu menu "GPU" - config LV_USE_GPU_ARM2D + config LV_USE_DRAW_ARM2D bool "Enable Arm's 2D image processing library (Arm-2D) for all Cortex-M processors." default n help diff --git a/env_support/cmsis-pack/LVGL.lvgl.9.0.0-dev1.pack b/env_support/cmsis-pack/LVGL.lvgl.9.0.0-dev2.pack similarity index 90% rename from env_support/cmsis-pack/LVGL.lvgl.9.0.0-dev1.pack rename to env_support/cmsis-pack/LVGL.lvgl.9.0.0-dev2.pack index c62961010c..e09066c8c6 100644 Binary files a/env_support/cmsis-pack/LVGL.lvgl.9.0.0-dev1.pack and b/env_support/cmsis-pack/LVGL.lvgl.9.0.0-dev2.pack differ diff --git a/env_support/cmsis-pack/LVGL.lvgl.pdsc b/env_support/cmsis-pack/LVGL.lvgl.pdsc index 86d2d63cfd..bad78b6e07 100644 --- a/env_support/cmsis-pack/LVGL.lvgl.pdsc +++ b/env_support/cmsis-pack/LVGL.lvgl.pdsc @@ -36,9 +36,10 @@ https://github.com/lvgl/lvgl.git - + - LVGL 9.0.0-dev - New Driver Architecture + - Adds Helium support - Other fixes @@ -265,6 +266,12 @@ + + Require LVGL Essential Service and Demo Assets + + + + Require Arm-2D Support @@ -542,7 +549,7 @@ - + @@ -562,7 +569,7 @@ - + @@ -590,6 +597,7 @@ + @@ -598,7 +606,7 @@ - + @@ -1376,21 +1384,6 @@ - - Add an observer pattern implementation - - - - - - - -/*! \brief enable an observer pattern implementation*/ -#define LV_USE_OBSERVER 1 - - - - Add the API to take snapshot for object @@ -1406,13 +1399,10 @@ - - + Add the official benchmark. - - @@ -1421,60 +1411,8 @@ - - - - - - -/*! \brief enable demo:bencharmk */ -#define LV_USE_DEMO_BENCHMARK 1 - - - - - - Add the Flex layout demo - - - - - - - - - - - - -/*! \brief enable the Flex layout demo */ -#define LV_USE_DEMO_FLEX_LAYOUT 1 - - - - - - Add the demonstrate the usage of encoder and keyboard - - - - - - - - -/*! \brief enable the demonstrate the usage of encoder and keyboard */ -#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 - - - - - - - Add the Smart-phone like multi-language demo. - + - @@ -1516,26 +1454,8 @@ - - - - - - -/*! \brief enable the Smart-phone like multi-language demo */ -#define LV_USE_DEMO_MULTILANG 1 - - - - - - Add the music player demo - - - - @@ -1580,7 +1500,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + Add the official benchmark. + + + + + + + + +/*! \brief enable demo:bencharmk */ +#define LV_USE_DEMO_BENCHMARK 1 + + + + + + Add the Flex layout demo + + + + + + + + + + + + +/*! \brief enable the Flex layout demo */ +#define LV_USE_DEMO_FLEX_LAYOUT 1 + + + + + + Add the demonstrate the usage of encoder and keyboard + + + + + + + + +/*! \brief enable the demonstrate the usage of encoder and keyboard */ +#define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 + + + + + + + Add the Smart-phone like multi-language demo. + + + + + + + + +/*! \brief enable the Smart-phone like multi-language demo */ +#define LV_USE_DEMO_MULTILANG 1 + + + + + + Add the music player demo + + + + + @@ -1592,7 +1610,7 @@ - + Add the demonstration for scroll settings @@ -1607,7 +1625,7 @@ - + Add the Stress test for LVGL @@ -1622,12 +1640,11 @@ - + Add the Widget transformation demo - @@ -1638,12 +1655,11 @@ - + Add the Vector graphic demo - @@ -1654,16 +1670,11 @@ - + Add the demo:widgets - - - - - @@ -1674,18 +1685,11 @@ - + Add the Render test for each primitives. Requires at least 480x272 display - - - - - - - diff --git a/env_support/cmsis-pack/LVGL.pidx b/env_support/cmsis-pack/LVGL.pidx index a919885df9..3f47654412 100644 --- a/env_support/cmsis-pack/LVGL.pidx +++ b/env_support/cmsis-pack/LVGL.pidx @@ -2,8 +2,8 @@ LVGL https://raw.githubusercontent.com/lvgl/lvgl/master/env_support/cmsis-pack/ - 2023-12-12 + 2023-12-24 - + diff --git a/env_support/cmsis-pack/README.md b/env_support/cmsis-pack/README.md index 1dbd844a14..1de0ead6c1 100644 --- a/env_support/cmsis-pack/README.md +++ b/env_support/cmsis-pack/README.md @@ -40,39 +40,66 @@ remove the misleading guide above this code segment. 4. Remove macro definitions for - LV_USE_DEMO_WIDGETS + - LV_USE_DEMO_BENCHMARK + - LV_USE_IME_PINYIN + - LV_USE_OS + - LV_USE_FILE_EXPLORER + - LV_USE_DEMO_WIDGETS + - LV_USE_DEMO_KEYPAD_AND_ENCODER + - LV_USE_DEMO_BENCHMARK + - LV_USE_DEMO_RENDER + - LV_USE_DEMO_STRESS + - LV_USE_DEMO_MUSIC + - LV_USE_DEMO_FLEX_LAYOUT + - LV_USE_DEMO_MULTILANG + - LV_USE_DEMO_TRANSFORM + - LV_USE_DEMO_SCROLL + - LV_USE_DEMO_VECTOR_GRAPHIC + - LV_USE_DRAW_VGLITE + - LV_USE_DRAW_PXP + - LV_USE_DRAW_SDL + + - LV_USE_DRAW_ARM2D + - LV_USE_SNAPSHOT + - LV_USE_MONKEY + - LV_USE_GRIDNAV + - LV_USE_FRAGMENT + - LV_USE_IMGFONT - - LV_USE_OBSERVER + + + 5. Update `LV_LOG_PRINTF` to `1` and `LV_LOG_LEVEL` to `LV_LOG_LEVEL_USER` -6. Set `LV_FONT_MONTSERRAT_12` and `LV_FONT_MONTSERRAT_16` to `1` (So Widgets and Benchmark can be compiled correctly, this is for improving the out of box experience.) +6. Set `LV_FONT_MONTSERRAT_12`, `LV_FONT_MONTSERRAT_24` and `LV_FONT_MONTSERRAT_16` to `1` (So Widgets and Benchmark can be compiled correctly, this is for improving the out of box experience.) 7. Update macro `LV_ATTRIBUTE_MEM_ALIGN` and `LV_ATTRIBUTE_MEM_ALIGN_SIZE` to force a WORD alignment. ```c -#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 4 +#define LV_ATTRIBUTE_MEM_ALIGN_SIZE 1 #define LV_DRAW_BUF_STRIDE_ALIGN 4 #define LV_ATTRIBUTE_MEM_ALIGN __attribute__((aligned(4))) ``` @@ -130,7 +157,47 @@ Make sure `LV_MEM_SIZE` is no less than `(256*1024U)`. ``` -11. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'. +11. Add the following code to `HAL SETTINGS`: + +```c +/*customize tick-get */ +#if defined(__PERF_COUNTER__) && __PERF_COUNTER__ + #define LV_GLOBAL_INIT(__GLOBAL_PTR) \ + do { \ + lv_global_init((lv_global_t *)(__GLOBAL_PTR)); \ + extern uint32_t perfc_tick_get(void); \ + (__GLOBAL_PTR)->tick_state.tick_get_cb = perfc_tick_get; \ + } while(0) +#endif +``` + + + +12. Replace the macro definition: + +```c +#define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE +``` + +with: + +```c + #if !defined(LV_USE_DRAW_SW_ASM) && defined(RTE_Acceleration_Arm_2D) + /*turn-on helium acceleration when Arm-2D and the Helium-powered device are detected */ + #if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_HELIUM + #define LV_USE_DRAW_ARM2D 1 + #endif + #endif + + #ifndef LV_USE_DRAW_SW_ASM + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE + #endif +``` + + + +13. rename '**lv_conf_template.h**' to '**lv_conf_cmsis.h**'. diff --git a/env_support/cmsis-pack/lv_cmsis_pack.txt b/env_support/cmsis-pack/lv_cmsis_pack.txt index 7e83c7dc2a..b7fa415635 100644 --- a/env_support/cmsis-pack/lv_cmsis_pack.txt +++ b/env_support/cmsis-pack/lv_cmsis_pack.txt @@ -126,14 +126,8 @@ _ARMABI time_t time(time_t * time) * Get the elapsed milliseconds since start up from perf_counter * @return the elapsed milliseconds */ -uint32_t $Sub$$lv_tick_get(void) +uint32_t perfc_tick_get(void) { - lv_tick_state_t * state_p = &state; - - if (state_p->tick_get_cb){ - return state_p->tick_get_cb(); - } - return (uint32_t)get_system_ms(); } diff --git a/env_support/cmsis-pack/lv_conf_cmsis.h b/env_support/cmsis-pack/lv_conf_cmsis.h index c46bd0fda0..558ff2a968 100644 --- a/env_support/cmsis-pack/lv_conf_cmsis.h +++ b/env_support/cmsis-pack/lv_conf_cmsis.h @@ -61,12 +61,22 @@ *(Not so important, you can adjust it to modify default sizes and spaces)*/ #define LV_DPI_DEF 130 /*[px/inch]*/ +/*customize tick-get */ +#if defined(__PERF_COUNTER__) && __PERF_COUNTER__ + #define LV_GLOBAL_INIT(__GLOBAL_PTR) \ + do { \ + lv_global_init((lv_global_t *)(__GLOBAL_PTR)); \ + extern uint32_t perfc_tick_get(void); \ + (__GLOBAL_PTR)->tick_state.tick_get_cb = perfc_tick_get; \ + } while(0) +#endif + /*======================== * RENDERING CONFIGURATION *========================*/ /*Align the stride of all layers and images to this bytes*/ -#define LV_DRAW_BUF_STRIDE_ALIGN 4 +#define LV_DRAW_BUF_STRIDE_ALIGN 1 /*Align the start address of draw_buf addresses to this bytes*/ #define LV_DRAW_BUF_ALIGN 4 @@ -103,7 +113,17 @@ #define LV_DRAW_SW_CIRCLE_CACHE_SIZE 4 #endif - #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE + #if !defined(LV_USE_DRAW_SW_ASM) && defined(RTE_Acceleration_Arm_2D) + /*turn-on helium acceleration when Arm-2D and the Helium-powered device are detected */ + #if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_HELIUM + #define LV_USE_DRAW_ARM2D 1 + #endif + #endif + + #ifndef LV_USE_DRAW_SW_ASM + #define LV_USE_DRAW_SW_ASM LV_DRAW_SW_ASM_NONE + #endif #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM #define LV_DRAW_SW_ASM_CUSTOM_INCLUDE "" @@ -680,6 +700,8 @@ #define LV_IMGFONT_USE_IMAGE_CACHE_HEADER 0 #endif +/*1: Enable an observer pattern implementation*/ +#define LV_USE_OBSERVER 1 /*1: Enable Pinyin input method*/ /*Requires: lv_keyboard*/ diff --git a/lv_conf_template.h b/lv_conf_template.h index d17e61a921..7a52ab65b3 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -116,6 +116,9 @@ #endif #endif +/* Use Arm-2D on Cortex-M based devices. Please only enable it for Helium Powered devices for now */ +#define LV_USE_DRAW_ARM2D 0 + /* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ #define LV_USE_DRAW_VGLITE 0 diff --git a/scripts/lv_conf_internal_gen.py b/scripts/lv_conf_internal_gen.py index e283918a77..6a7cee6289 100755 --- a/scripts/lv_conf_internal_gen.py +++ b/scripts/lv_conf_internal_gen.py @@ -47,7 +47,7 @@ fout.write( #define LV_DRAW_SW_ASM_NONE 0 #define LV_DRAW_SW_ASM_NEON 1 -#define LV_DRAW_SW_ASM_MVE 2 +#define LV_DRAW_SW_ASM_HELIUM 2 #define LV_DRAW_SW_ASM_CUSTOM 255 /* Handle special Kconfig options */ diff --git a/src/draw/sw/blend/helium/lv_blend_helium.h b/src/draw/sw/blend/helium/lv_blend_helium.h new file mode 100644 index 0000000000..73b3d871fe --- /dev/null +++ b/src/draw/sw/blend/helium/lv_blend_helium.h @@ -0,0 +1,1345 @@ +/** + * @file lv_blend_to_helium.h + * + */ + +#ifndef LV_BLEND_TO_HELIUM_H +#define LV_BLEND_TO_HELIUM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../../../lv_conf_internal.h" + +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM && !defined(__ASSEMBLY__) && LV_USE_DRAW_ARM2D + +#define __ARM_2D_IMPL__ +#include "arm_2d.h" +#include "__arm_2d_impl.h" + +#if defined(__IS_COMPILER_ARM_COMPILER_5__) +#pragma diag_suppress 174,177,188,68,513,144,1296 +#elif defined(__IS_COMPILER_IAR__) +#pragma diag_suppress=Pa093 +#elif defined(__IS_COMPILER_GCC__) +#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" +#endif +/********************* + * DEFINES + *********************/ + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc) \ + _lv_color_blend_to_rgb565_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc) \ + _lv_color_blend_to_rgb565_with_opa_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc) \ + _lv_color_blend_to_rgb565_with_mask_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc) \ + _lv_color_blend_to_rgb565_mix_mask_opa_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc) \ + _lv_rgb565_blend_normal_to_rgb565_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ + _lv_rgb565_blend_normal_to_rgb565_with_opa_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ + _lv_rgb565_blend_normal_to_rgb565_with_mask_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ + _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(dsc) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb565_helium(dsc, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb565_with_opa_helium(dsc, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb565_with_mask_helium(dsc, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(dsc, src_px_size) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc) \ + _lv_argb8888_blend_normal_to_rgb565_helium(dsc) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ + _lv_argb8888_blend_normal_to_rgb565_with_opa_helium(dsc) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ + _lv_argb8888_blend_normal_to_rgb565_with_mask_helium(dsc) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ + _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dst_px_size) \ + _lv_color_blend_to_rgb888_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ + _lv_color_blend_to_rgb888_with_opa_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ + _lv_color_blend_to_rgb888_with_mask_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ + _lv_color_blend_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ + _lv_rgb565_blend_normal_to_rgb888_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ + _lv_rgb565_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ + _lv_rgb565_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ + _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb888_helium(dsc, dst_px_size, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size, src_px_size) \ + _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size, src_px_size) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ + _lv_argb8888_blend_normal_to_rgb888_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ + _lv_argb8888_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ + _lv_argb8888_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ + _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) + +#define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(dsc) \ + _lv_color_blend_to_argb8888_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(dsc) \ + _lv_color_blend_to_argb8888_with_opa_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(dsc) \ + _lv_color_blend_to_argb8888_with_mask_helium(dsc) + +#define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(dsc) \ + _lv_color_blend_to_argb8888_mix_mask_opa_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc) \ + _lv_rgb565_blend_normal_to_argb8888_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc) \ + _lv_rgb565_blend_normal_to_argb8888_with_opa_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc) \ + _lv_rgb565_blend_normal_to_argb8888_with_mask_helium(dsc) + +#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc) \ + _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(dsc) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_argb8888_helium(dsc, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_argb8888_with_opa_helium(dsc, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_argb8888_with_mask_helium(dsc, src_px_size) + +#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc, src_px_size) \ + _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(dsc, src_px_size) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(dsc) \ + _lv_argb8888_blend_normal_to_argb8888_helium(dsc) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc) \ + _lv_argb8888_blend_normal_to_argb8888_with_opa_helium(dsc) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc) \ + _lv_argb8888_blend_normal_to_argb8888_with_mask_helium(dsc) + +#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc) \ + _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(dsc) + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +static inline lv_result_t _lv_color_blend_to_rgb565_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); + __arm_2d_impl_rgb16_colour_filling((uint16_t *)dsc->dest_buf, + stride, + &draw_size, + lv_color_to_u16(dsc->color)); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); + __arm_2d_impl_rgb565_colour_filling_with_opacity((uint16_t *)dsc->dest_buf, + stride, + &draw_size, + lv_color_to_u16(dsc->color), + dsc->opa); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); + __arm_2d_impl_rgb565_colour_filling_mask((uint16_t *)dsc->dest_buf, + stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + lv_color_to_u16(dsc->color)); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); + __arm_2d_impl_rgb565_colour_filling_mask_opacity((uint16_t *)dsc->dest_buf, + stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + lv_color_to_u16(dsc->color), + dsc->opa); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + __arm_2d_impl_rgb16_copy((uint16_t *)dsc->src_buf, + src_stride, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + __arm_2d_impl_rgb565_tile_copy_opacity((uint16_t *)dsc->src_buf, + src_stride, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size, + dsc->opa); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + __arm_2d_impl_rgb565_src_msk_copy((uint16_t *)dsc->src_buf, + src_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + + __arm_2d_impl_gray8_colour_filling_with_opacity((uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + 0x00, + 255 - dsc->opa); + + __arm_2d_impl_rgb565_src_msk_copy((uint16_t *)dsc->src_buf, + src_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ + if(src_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ + if(src_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_rgb565_tile_copy_opacity(tmp_buf, + des_stride, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size, + dsc->opa); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ + if(src_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_rgb565_src_msk_copy(tmp_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ + if(src_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_gray8_colour_filling_with_opacity((uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + 0x00, + 255 - dsc->opa); + + __arm_2d_impl_rgb565_src_msk_copy(tmp_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_rgb565_src_chn_msk_copy(tmp_buf, + des_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + uint8_t * tmp_msk = (uint8_t *)lv_malloc(des_stride * dsc->dest_h); + if(NULL == tmp_msk) { + lv_free(tmp_buf); + return LV_RESULT_INVALID; + } + + /* get rgb565 */ + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + lv_memzero(tmp_msk, des_stride * dsc->dest_h); + + /* get mask */ + __arm_2d_impl_gray8_colour_filling_channel_mask_opacity(tmp_msk, + des_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + 0xFF, + dsc->opa); + + __arm_2d_impl_rgb565_src_msk_copy(tmp_buf, + des_stride, + tmp_msk, + des_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_msk); + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + uint8_t * tmp_msk = (uint8_t *)lv_malloc(des_stride * dsc->dest_h); + if(NULL == tmp_msk) { + lv_free(tmp_buf); + return LV_RESULT_INVALID; + } + + /* get rgb565 */ + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + lv_memzero(tmp_msk, des_stride * dsc->dest_h); + + /* get mask */ + __arm_2d_impl_gray8_colour_filling_channel_mask(tmp_msk, + des_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + 0xFF); + + __arm_2d_impl_rgb565_masks_copy(tmp_buf, + des_stride, + tmp_msk, + des_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + &draw_size); + + lv_free(tmp_msk); + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint16_t * tmp_buf = (uint16_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + uint8_t * tmp_msk = (uint8_t *)lv_malloc(des_stride * dsc->dest_h); + if(NULL == tmp_msk) { + lv_free(tmp_buf); + return LV_RESULT_INVALID; + } + + /* get rgb565 */ + __arm_2d_impl_cccn888_to_rgb565((uint32_t *)dsc->src_buf, + src_stride, + (uint16_t *)tmp_buf, + des_stride, + &draw_size); + + lv_memzero(tmp_msk, des_stride * dsc->dest_h); + + /* get mask */ + __arm_2d_impl_gray8_colour_filling_channel_mask_opacity(tmp_msk, + des_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + 0xFF, + dsc->opa); + + __arm_2d_impl_rgb565_masks_copy(tmp_buf, + des_stride, + tmp_msk, + des_stride, + &draw_size, + (uint16_t *)dsc->dest_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + &draw_size); + + lv_free(tmp_msk); + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_rgb888_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +{ + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint32_t); + __arm_2d_impl_rgb32_colour_filling((uint32_t *)dsc->dest_buf, + stride, + &draw_size, + lv_color_to_u32(dsc->color)); + return LV_RESULT_OK; + +} + +static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) +{ + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint32_t); + __arm_2d_impl_cccn888_colour_filling_with_opacity((uint32_t *)dsc->dest_buf, + stride, + &draw_size, + lv_color_to_u32(dsc->color), + dsc->opa); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint32_t); + __arm_2d_impl_cccn888_colour_filling_mask((uint32_t *)dsc->dest_buf, + stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + lv_color_to_u32(dsc->color)); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t stride = (dsc->dest_stride) / sizeof(uint32_t); + __arm_2d_impl_cccn888_colour_filling_mask_opacity((uint32_t *)dsc->dest_buf, + stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + lv_color_to_u32(dsc->color), + dsc->opa); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + + __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf, + src_stride, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + + return LV_RESULT_OK; + +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + + uint32_t * tmp_buf = (uint32_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + /* get rgb565 */ + __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf, + src_stride, + (uint32_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_cccn888_tile_copy_opacity(tmp_buf, + des_stride, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size, + dsc->opa); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + + uint32_t * tmp_buf = (uint32_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf, + src_stride, + (uint32_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_cccn888_src_msk_copy(tmp_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint16_t); + + uint32_t * tmp_buf = (uint32_t *)lv_malloc(dsc->dest_stride * dsc->dest_h); + if(NULL == tmp_buf) { + return LV_RESULT_INVALID; + } + + __arm_2d_impl_rgb565_to_cccn888((uint16_t *)dsc->src_buf, + src_stride, + (uint32_t *)tmp_buf, + des_stride, + &draw_size); + + __arm_2d_impl_gray8_colour_filling_with_opacity((uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + 0x00, + 255 - dsc->opa); + + __arm_2d_impl_cccn888_src_msk_copy(tmp_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_buf); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, + uint32_t src_px_size) +{ + if((dst_px_size == 3) || (src_px_size == 3)) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_rgb32_copy((uint32_t *)dsc->src_buf, + src_stride, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) +{ + if((dst_px_size == 3) || (src_px_size == 3)) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_cccn888_tile_copy_opacity((uint32_t *)dsc->src_buf, + src_stride, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size, + dsc->opa); + + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) +{ + if((dst_px_size == 3) || (src_px_size == 3)) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_cccn888_src_msk_copy((uint32_t *)dsc->src_buf, + src_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) +{ + if((dst_px_size == 3) || (src_px_size == 3)) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_gray8_colour_filling_with_opacity((uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + 0x00, + 255 - dsc->opa); + + __arm_2d_impl_cccn888_src_msk_copy((uint32_t *)dsc->src_buf, + src_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_cccn888_src_chn_msk_copy((uint32_t *)dsc->src_buf, + src_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + uint8_t * tmp_msk = (uint8_t *)lv_malloc(des_stride * dsc->dest_h); + if(NULL == tmp_msk) { + return LV_RESULT_INVALID; + } + + lv_memzero(tmp_msk, des_stride * dsc->dest_h); + + /* get mask */ + __arm_2d_impl_gray8_colour_filling_channel_mask_opacity(tmp_msk, + des_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + 0xFF, + dsc->opa); + + __arm_2d_impl_cccn888_src_msk_copy((uint32_t *)dsc->src_buf, + src_stride, + tmp_msk, + des_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + &draw_size); + + lv_free(tmp_msk); + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_cccn888_src_chn_msk_des_msk_copy((uint32_t *)dsc->src_buf, + src_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + &draw_size); + + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) +{ + if(dst_px_size == 3) { + return LV_RESULT_INVALID; + } + + arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; + int16_t des_stride = dsc->dest_stride / sizeof(uint32_t); + int16_t src_stride = dsc->src_stride / sizeof(uint32_t); + + __arm_2d_impl_gray8_colour_filling_with_opacity((uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + 0x00, + 255 - dsc->opa); + + __arm_2d_impl_cccn888_src_chn_msk_des_msk_copy((uint32_t *)dsc->src_buf, + src_stride, + (uint32_t *)((uintptr_t)(dsc->src_buf) + 3), + src_stride, + &draw_size, + (uint32_t *)dsc->dest_buf, + des_stride, + (uint8_t *)dsc->mask_buf, + dsc->mask_stride, + &draw_size, + &draw_size); + + return LV_RESULT_OK; +} + +static inline lv_result_t _lv_color_blend_to_argb8888_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = &dsc->color + }; + + lv_color_blend_to_argb8888_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_color_blend_to_argb8888_with_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = &dsc->color + }; + lv_color_blend_to_argb8888_with_opa_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_color_blend_to_argb8888_with_mask_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = &dsc->color, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + lv_color_blend_to_argb8888_with_mask_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_color_blend_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = &dsc->color, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + lv_color_blend_to_argb8888_mix_mask_opa_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride + }; + lv_rgb565_blend_normal_to_argb8888_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride + }; + lv_rgb565_blend_normal_to_argb8888_with_opa_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + lv_rgb565_blend_normal_to_argb8888_with_mask_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride + }; + if(src_px_size == 3) { + lv_rgb888_blend_normal_to_argb8888_helium(&asm_dsc); + } + else { + lv_xrgb8888_blend_normal_to_argb8888_helium(&asm_dsc); + } +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride + }; + if(src_px_size == 3) { + lv_rgb888_blend_normal_to_argb8888_with_opa_helium(&asm_dsc); + } + else { + lv_xrgb8888_blend_normal_to_argb8888_with_opa_helium(&asm_dsc); + } +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + if(src_px_size == 3) { + lv_rgb888_blend_normal_to_argb8888_with_mask_helium(&asm_dsc); + } + else { + lv_xrgb8888_blend_normal_to_argb8888_with_mask_helium(&asm_dsc); + } +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + if(src_px_size == 3) { + lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(&asm_dsc); + } + else { + lv_xrgb8888_blend_normal_to_argb8888_mix_mask_opa_helium(&asm_dsc); + } +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride + }; + lv_argb8888_blend_normal_to_argb8888_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride + }; + lv_argb8888_blend_normal_to_argb8888_with_opa_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + lv_argb8888_blend_normal_to_argb8888_with_mask_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +{ +#if 0 + asm_dsc_t asm_dsc = { + .opa = dsc->opa, + .dst_buf = dsc->dest_buf, + .dst_w = dsc->dest_w, + .dst_h = dsc->dest_h, + .dst_stride = dsc->dest_stride, + .src_buf = dsc->src_buf, + .src_stride = dsc->src_stride, + .mask_buf = dsc->mask_buf, + .mask_stride = dsc->mask_stride + }; + lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(&asm_dsc); +#endif + return LV_RESULT_INVALID; +} + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM && !defined(__ASSEMBLY__)*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BLEND_TO_HELIUM_H*/ diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c index 77658fbaa4..6d3cb5325c 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c @@ -18,6 +18,8 @@ #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM + #include "helium/lv_blend_helium.h" #elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM #include LV_DRAW_SW_ASM_CUSTOM_INCLUDE #endif @@ -65,6 +67,25 @@ LV_ATTRIBUTE_FAST_MEM static inline void * drawbuf_next_row(const void * buf, ui * MACROS **********************/ +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NONE + #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + /********************** * GLOBAL FUNCTIONS **********************/ @@ -95,91 +116,86 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_ /*Simple fill*/ if(mask == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888 - LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(dsc); -#else - uint32_t color32 = lv_color_to_u32(dsc->color); - uint32_t * dest_buf = dsc->dest_buf; - for(y = 0; y < h; y++) { - for(x = 0; x < w - 16; x += 16) { - dest_buf[x + 0] = color32; - dest_buf[x + 1] = color32; - dest_buf[x + 2] = color32; - dest_buf[x + 3] = color32; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(dsc)) { + uint32_t color32 = lv_color_to_u32(dsc->color); + uint32_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w - 16; x += 16) { + dest_buf[x + 0] = color32; + dest_buf[x + 1] = color32; + dest_buf[x + 2] = color32; + dest_buf[x + 3] = color32; - dest_buf[x + 4] = color32; - dest_buf[x + 5] = color32; - dest_buf[x + 6] = color32; - dest_buf[x + 7] = color32; + dest_buf[x + 4] = color32; + dest_buf[x + 5] = color32; + dest_buf[x + 6] = color32; + dest_buf[x + 7] = color32; - dest_buf[x + 8] = color32; - dest_buf[x + 9] = color32; - dest_buf[x + 10] = color32; - dest_buf[x + 11] = color32; + dest_buf[x + 8] = color32; + dest_buf[x + 9] = color32; + dest_buf[x + 10] = color32; + dest_buf[x + 11] = color32; - dest_buf[x + 12] = color32; - dest_buf[x + 13] = color32; - dest_buf[x + 14] = color32; - dest_buf[x + 15] = color32; + dest_buf[x + 12] = color32; + dest_buf[x + 13] = color32; + dest_buf[x + 14] = color32; + dest_buf[x + 15] = color32; + } + for(; x < w; x ++) { + dest_buf[x] = color32; + } + + dest_buf = drawbuf_next_row(dest_buf, dest_stride); } - for(; x < w; x ++) { - dest_buf[x] = color32; - } - - dest_buf = drawbuf_next_row(dest_buf, dest_stride); } -#endif + } /*Opacity only*/ else if(mask == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA - LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(dsc); -#else - lv_color32_t color_argb = lv_color_to_32(dsc->color, opa); - lv_color32_t * dest_buf = dsc->dest_buf; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(dsc)) { + lv_color32_t color_argb = lv_color_to_32(dsc->color, opa); + lv_color32_t * dest_buf = dsc->dest_buf; - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache); + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); } - dest_buf = drawbuf_next_row(dest_buf, dest_stride); } -#endif + } /*Masked with full opacity*/ else if(mask && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK - LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(dsc); -#else - lv_color32_t color_argb = lv_color_to_32(dsc->color, 0xff); - lv_color32_t * dest_buf = dsc->dest_buf; - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb.alpha = mask[x]; - dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache); - } + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(dsc)) { + lv_color32_t color_argb = lv_color_to_32(dsc->color, 0xff); + lv_color32_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb.alpha = mask[x]; + dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache); + } - dest_buf = drawbuf_next_row(dest_buf, dest_stride); - mask += mask_stride; + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + mask += mask_stride; + } } -#endif + } /*Masked with opacity*/ else { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA - LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(dsc); -#else - lv_color32_t color_argb = lv_color_to_32(dsc->color, opa); - lv_color32_t * dest_buf = dsc->dest_buf; - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb.alpha = LV_OPA_MIX2(mask[x], opa); - dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(dsc)) { + lv_color32_t color_argb = lv_color_to_32(dsc->color, opa); + lv_color32_t * dest_buf = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb.alpha = LV_OPA_MIX2(mask[x], opa); + dest_buf[x] = lv_color_32_32_mix(color_argb, dest_buf[x], &cache); + } + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + mask += mask_stride; } - dest_buf = drawbuf_next_row(dest_buf, dest_stride); - mask += mask_stride; } -#endif } } @@ -231,62 +247,58 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888 + lv_result_t accelerated; if(opa >= LV_OPA_MAX) { - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc); + accelerated = LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc); } else { - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc); + accelerated = LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc); } -#else - color_argb.alpha = opa; - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb.red = (src_buf_c16[x].red * 2106) >> 8; /*To make it rounded*/ - color_argb.green = (src_buf_c16[x].green * 1037) >> 8; - color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8; - dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == accelerated) { + color_argb.alpha = opa; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb.red = (src_buf_c16[x].red * 2106) >> 8; /*To make it rounded*/ + color_argb.green = (src_buf_c16[x].green * 1037) >> 8; + color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8; + dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); } -#endif } else if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb.alpha = mask_buf[x]; - color_argb.red = (src_buf_c16[x].red * 2106) >> 8; /*To make it rounded*/ - color_argb.green = (src_buf_c16[x].green * 1037) >> 8; - color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8; - dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb.alpha = mask_buf[x]; + color_argb.red = (src_buf_c16[x].red * 2106) >> 8; /*To make it rounded*/ + color_argb.green = (src_buf_c16[x].green * 1037) >> 8; + color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8; + dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); - mask_buf += mask_stride; } -#endif } else { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb.alpha = LV_OPA_MIX2(mask_buf[x], opa); - color_argb.red = (src_buf_c16[x].red * 2106) >> 8; /*To make it rounded*/ - color_argb.green = (src_buf_c16[x].green * 1037) >> 8; - color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8; - dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb.alpha = LV_OPA_MIX2(mask_buf[x], opa); + color_argb.red = (src_buf_c16[x].red * 2106) >> 8; /*To make it rounded*/ + color_argb.green = (src_buf_c16[x].green * 1037) >> 8; + color_argb.blue = (src_buf_c16[x].blue * 2106) >> 8; + dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); - mask_buf += mask_stride; } -#endif } } else { @@ -333,83 +345,77 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { /*Special case*/ if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888 - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(dsc, src_px_size); -#else - if(src_px_size == 4) { - uint32_t line_in_bytes = w * 4; - for(y = 0; y < h; y++) { - lv_memcpy(dest_buf_c32, src_buf, line_in_bytes); - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf = drawbuf_next_row(src_buf, src_stride); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(dsc, src_px_size)) { + if(src_px_size == 4) { + uint32_t line_in_bytes = w * 4; + for(y = 0; y < h; y++) { + lv_memcpy(dest_buf_c32, src_buf, line_in_bytes); + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf = drawbuf_next_row(src_buf, src_stride); + } + } + else if(src_px_size == 3) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 3) { + dest_buf_c32[dest_x].red = src_buf[src_x + 2]; + dest_buf_c32[dest_x].green = src_buf[src_x + 1]; + dest_buf_c32[dest_x].blue = src_buf[src_x + 0]; + dest_buf_c32[dest_x].alpha = 0xff; + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf = drawbuf_next_row(src_buf, src_stride); + } } } - else if(src_px_size == 3) { + + } + if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc, src_px_size)) { + color_argb.alpha = opa; for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 3) { - dest_buf_c32[dest_x].red = src_buf[src_x + 2]; - dest_buf_c32[dest_x].green = src_buf[src_x + 1]; - dest_buf_c32[dest_x].blue = src_buf[src_x + 0]; - dest_buf_c32[dest_x].alpha = 0xff; + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + color_argb.red = src_buf[src_x + 2]; + color_argb.green = src_buf[src_x + 1]; + color_argb.blue = src_buf[src_x + 0]; + dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache); } dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); src_buf = drawbuf_next_row(src_buf, src_stride); } } -#endif - } - if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc, src_px_size); -#else - color_argb.alpha = opa; - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - color_argb.red = src_buf[src_x + 2]; - color_argb.green = src_buf[src_x + 1]; - color_argb.blue = src_buf[src_x + 0]; - dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache); - } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf = drawbuf_next_row(src_buf, src_stride); - } -#endif + } if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - color_argb.alpha = mask_buf[dest_x]; - color_argb.red = src_buf[src_x + 2]; - color_argb.green = src_buf[src_x + 1]; - color_argb.blue = src_buf[src_x + 0]; - dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + color_argb.alpha = mask_buf[dest_x]; + color_argb.red = src_buf[src_x + 2]; + color_argb.green = src_buf[src_x + 1]; + color_argb.blue = src_buf[src_x + 0]; + dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf = drawbuf_next_row(src_buf, src_stride); + mask_buf += mask_stride; } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf = drawbuf_next_row(src_buf, src_stride); - mask_buf += mask_stride; } -#endif } if(mask_buf && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - color_argb.alpha = (opa * mask_buf[dest_x]) >> 8; - color_argb.red = src_buf[src_x + 2]; - color_argb.green = src_buf[src_x + 1]; - color_argb.blue = src_buf[src_x + 0]; - dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + color_argb.alpha = (opa * mask_buf[dest_x]) >> 8; + color_argb.red = src_buf[src_x + 2]; + color_argb.green = src_buf[src_x + 1]; + color_argb.blue = src_buf[src_x + 0]; + dest_buf_c32[dest_x] = lv_color_32_32_mix(color_argb, dest_buf_c32[dest_x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf = drawbuf_next_row(src_buf, src_stride); + mask_buf += mask_stride; } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf = drawbuf_next_row(src_buf, src_stride); - mask_buf += mask_stride; } -#endif } } else { @@ -452,64 +458,56 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888 - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - dest_buf_c32[x] = lv_color_32_32_mix(src_buf_c32[x], dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_c32[x] = lv_color_32_32_mix(src_buf_c32[x], dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } -#endif } else if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb = src_buf_c32[x]; - color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, opa); - dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb = src_buf_c32[x]; + color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, opa); + dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } -#endif } else if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb = src_buf_c32[x]; - color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, mask_buf[x]); - dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb = src_buf_c32[x]; + color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, mask_buf[x]); + dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); - mask_buf += mask_stride; } -#endif } else if(mask_buf && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - color_argb = src_buf_c32[x]; - color_argb.alpha = LV_OPA_MIX3(color_argb.alpha, opa, mask_buf[x]); - dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + color_argb = src_buf_c32[x]; + color_argb.alpha = LV_OPA_MIX3(color_argb.alpha, opa, mask_buf[x]); + dest_buf_c32[x] = lv_color_32_32_mix(color_argb, dest_buf_c32[x], &cache); + } + dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; } - dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride); - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); - mask_buf += mask_stride; } -#endif } } else { diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c index 369f5e5a5e..5876809492 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c @@ -18,6 +18,8 @@ #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM + #include "helium/lv_blend_helium.h" #elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM #include LV_DRAW_SW_ASM_CUSTOM_INCLUDE #endif @@ -52,6 +54,25 @@ LV_ATTRIBUTE_FAST_MEM static inline void * drawbuf_next_row(const void * buf, ui * MACROS **********************/ +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NONE + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + /********************** * GLOBAL FUNCTIONS **********************/ @@ -96,142 +117,137 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi /*Simple fill*/ if(mask == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565 - LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc); -#else - for(y = 0; y < h; y++) { - uint16_t * dest_end_final = dest_buf_u16 + w; - uint32_t * dest_end_mid = (uint32_t *)((uint16_t *) dest_buf_u16 + ((w - 1) & ~(0xF))); - if((lv_uintptr_t)&dest_buf_u16[0] & 0x3) { - dest_buf_u16[0] = color16; - dest_buf_u16++; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc)) { + for(y = 0; y < h; y++) { + uint16_t * dest_end_final = dest_buf_u16 + w; + uint32_t * dest_end_mid = (uint32_t *)((uint16_t *) dest_buf_u16 + ((w - 1) & ~(0xF))); + if((lv_uintptr_t)&dest_buf_u16[0] & 0x3) { + dest_buf_u16[0] = color16; + dest_buf_u16++; + } + + uint32_t c32 = (uint32_t)color16 + ((uint32_t)color16 << 16); + uint32_t * dest32 = (uint32_t *)dest_buf_u16; + while(dest32 < dest_end_mid) { + dest32[0] = c32; + dest32[1] = c32; + dest32[2] = c32; + dest32[3] = c32; + dest32[4] = c32; + dest32[5] = c32; + dest32[6] = c32; + dest32[7] = c32; + dest32 += 8; + } + + dest_buf_u16 = (uint16_t *)dest32; + + while(dest_buf_u16 < dest_end_final) { + *dest_buf_u16 = color16; + dest_buf_u16++; + } + + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + dest_buf_u16 -= w; } - - uint32_t c32 = (uint32_t)color16 + ((uint32_t)color16 << 16); - uint32_t * dest32 = (uint32_t *)dest_buf_u16; - while(dest32 < dest_end_mid) { - dest32[0] = c32; - dest32[1] = c32; - dest32[2] = c32; - dest32[3] = c32; - dest32[4] = c32; - dest32[5] = c32; - dest32[6] = c32; - dest32[7] = c32; - dest32 += 8; - } - - dest_buf_u16 = (uint16_t *)dest32; - - while(dest_buf_u16 < dest_end_final) { - *dest_buf_u16 = color16; - dest_buf_u16++; - } - - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - dest_buf_u16 -= w; } -#endif + } /*Opacity only*/ else if(mask == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA - LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc); -#else - uint32_t last_dest32_color = dest_buf_u16[0] + 1; /*Set to value which is not equal to the first pixel*/ - uint32_t last_res32_color = 0; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc)) { + uint32_t last_dest32_color = dest_buf_u16[0] + 1; /*Set to value which is not equal to the first pixel*/ + uint32_t last_res32_color = 0; - for(y = 0; y < h; y++) { - x = 0; - if((lv_uintptr_t)&dest_buf_u16[0] & 0x3) { - dest_buf_u16[0] = lv_color_16_16_mix(color16, dest_buf_u16[0], opa); - x = 1; - } - - for(; x < w - 2; x += 2) { - if(dest_buf_u16[x] != dest_buf_u16[x + 1]) { - dest_buf_u16[x + 0] = lv_color_16_16_mix(color16, dest_buf_u16[x + 0], opa); - dest_buf_u16[x + 1] = lv_color_16_16_mix(color16, dest_buf_u16[x + 1], opa); + for(y = 0; y < h; y++) { + x = 0; + if((lv_uintptr_t)&dest_buf_u16[0] & 0x3) { + dest_buf_u16[0] = lv_color_16_16_mix(color16, dest_buf_u16[0], opa); + x = 1; } - else { - volatile uint32_t * dest32 = (uint32_t *)&dest_buf_u16[x]; - if(last_dest32_color == *dest32) { - *dest32 = last_res32_color; + + for(; x < w - 2; x += 2) { + if(dest_buf_u16[x] != dest_buf_u16[x + 1]) { + dest_buf_u16[x + 0] = lv_color_16_16_mix(color16, dest_buf_u16[x + 0], opa); + dest_buf_u16[x + 1] = lv_color_16_16_mix(color16, dest_buf_u16[x + 1], opa); } else { - last_dest32_color = *dest32; + volatile uint32_t * dest32 = (uint32_t *)&dest_buf_u16[x]; + if(last_dest32_color == *dest32) { + *dest32 = last_res32_color; + } + else { + last_dest32_color = *dest32; - dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x + 0], opa); - dest_buf_u16[x + 1] = dest_buf_u16[x]; + dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x + 0], opa); + dest_buf_u16[x + 1] = dest_buf_u16[x]; - last_res32_color = *dest32; + last_res32_color = *dest32; + } } } - } - for(; x < w ; x++) { - dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], opa); + for(; x < w ; x++) { + dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], opa); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); } -#endif + } /*Masked with full opacity*/ else if(mask && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK - LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc); -#else - uint32_t c32 = color16 + ((uint32_t)color16 << 16); - for(y = 0; y < h; y++) { - for(x = 0; x < w && ((lv_uintptr_t)(mask) & 0x3); x++) { - dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], mask[x]); - } + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc)) { + uint32_t c32 = color16 + ((uint32_t)color16 << 16); + for(y = 0; y < h; y++) { + for(x = 0; x < w && ((lv_uintptr_t)(mask) & 0x3); x++) { + dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], mask[x]); + } - for(; x <= w - 4; x += 4) { - uint32_t mask32 = *((uint32_t *)&mask[x]); - if(mask32 == 0xFFFFFFFF) { - if((lv_uintptr_t)&dest_buf_u16[x] & 0x3) { - dest_buf_u16[x] = color16; - uint32_t * d32 = (uint32_t *)(&dest_buf_u16[x + 1]); - *d32 = c32; - dest_buf_u16[x + 3] = color16; + for(; x <= w - 4; x += 4) { + uint32_t mask32 = *((uint32_t *)&mask[x]); + if(mask32 == 0xFFFFFFFF) { + if((lv_uintptr_t)&dest_buf_u16[x] & 0x3) { + dest_buf_u16[x] = color16; + uint32_t * d32 = (uint32_t *)(&dest_buf_u16[x + 1]); + *d32 = c32; + dest_buf_u16[x + 3] = color16; + } + else { + uint32_t * dest32 = (uint32_t *)&dest_buf_u16[x]; + dest32[0] = c32; + dest32[1] = c32; + } } - else { - uint32_t * dest32 = (uint32_t *)&dest_buf_u16[x]; - dest32[0] = c32; - dest32[1] = c32; + else if(mask32) { + dest_buf_u16[x + 0] = lv_color_16_16_mix(color16, dest_buf_u16[x + 0], mask[x + 0]); + dest_buf_u16[x + 1] = lv_color_16_16_mix(color16, dest_buf_u16[x + 1], mask[x + 1]); + dest_buf_u16[x + 2] = lv_color_16_16_mix(color16, dest_buf_u16[x + 2], mask[x + 2]); + dest_buf_u16[x + 3] = lv_color_16_16_mix(color16, dest_buf_u16[x + 3], mask[x + 3]); } } - else if(mask32) { - dest_buf_u16[x + 0] = lv_color_16_16_mix(color16, dest_buf_u16[x + 0], mask[x + 0]); - dest_buf_u16[x + 1] = lv_color_16_16_mix(color16, dest_buf_u16[x + 1], mask[x + 1]); - dest_buf_u16[x + 2] = lv_color_16_16_mix(color16, dest_buf_u16[x + 2], mask[x + 2]); - dest_buf_u16[x + 3] = lv_color_16_16_mix(color16, dest_buf_u16[x + 3], mask[x + 3]); - } - } - for(; x < w ; x++) { - dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], mask[x]); + for(; x < w ; x++) { + dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], mask[x]); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + mask += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - mask += mask_stride; } -#endif + } /*Masked with opacity*/ else if(mask && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA - LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], LV_OPA_MIX2(mask[x], opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_u16[x] = lv_color_16_16_mix(color16, dest_buf_u16[x], LV_OPA_MIX2(mask[x], opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + mask += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - mask += mask_stride; } -#endif } } @@ -277,57 +293,49 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565 - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc); -#else - uint32_t line_in_bytes = w * 2; - for(y = 0; y < h; y++) { - lv_memcpy(dest_buf_u16, src_buf_u16, line_in_bytes); - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc)) { + uint32_t line_in_bytes = w * 2; + for(y = 0; y < h; y++) { + lv_memcpy(dest_buf_u16, src_buf_u16, line_in_bytes); + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); + } } -#endif } else if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], opa); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], opa); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); } -#endif } else if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], mask_buf[x]); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], mask_buf[x]); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); + mask_buf += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); - mask_buf += mask_stride; } -#endif } else { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(x = 0; x < w; x++) { - dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], LV_OPA_MIX2(mask_buf[x], opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(x = 0; x < w; x++) { + dest_buf_u16[x] = lv_color_16_16_mix(src_buf_u16[x], dest_buf_u16[x], LV_OPA_MIX2(mask_buf[x], opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); + mask_buf += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u16 = drawbuf_next_row(src_buf_u16, src_stride); - mask_buf += mask_stride; } -#endif } } else { @@ -394,60 +402,52 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565 - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - dest_buf_u16[dest_x] = ((src_buf_u8[src_x + 2] & 0xF8) << 8) + - ((src_buf_u8[src_x + 1] & 0xFC) << 3) + - ((src_buf_u8[src_x + 0] & 0xF8) >> 3); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + dest_buf_u16[dest_x] = ((src_buf_u8[src_x + 2] & 0xF8) << 8) + + ((src_buf_u8[src_x + 1] & 0xFC) << 3) + + ((src_buf_u8[src_x + 0] & 0xF8) >> 3); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; } -#endif } else if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], opa); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], opa); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; } -#endif } if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], mask_buf[dest_x]); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], mask_buf[dest_x]); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; + mask_buf += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; - mask_buf += mask_stride; } -#endif } if(mask_buf && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(mask_buf[dest_x], opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(mask_buf[dest_x], opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; + mask_buf += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; - mask_buf += mask_stride; } -#endif } } else { @@ -510,61 +510,53 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565 - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], src_buf_u8[src_x + 3]); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], src_buf_u8[src_x + 3]); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; } -#endif } else if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(src_buf_u8[src_x + 3], - opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], LV_OPA_MIX2(src_buf_u8[src_x + 3], + opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; } -#endif } else if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], - LV_OPA_MIX2(src_buf_u8[src_x + 3], mask_buf[dest_x])); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], + LV_OPA_MIX2(src_buf_u8[src_x + 3], mask_buf[dest_x])); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; + mask_buf += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; - mask_buf += mask_stride; } -#endif } else if(mask_buf && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { - dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], - LV_OPA_MIX3(src_buf_u8[src_x + 3], mask_buf[dest_x], opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 4) { + dest_buf_u16[dest_x] = lv_color_24_16_mix(&src_buf_u8[src_x], dest_buf_u16[dest_x], + LV_OPA_MIX3(src_buf_u8[src_x + 3], mask_buf[dest_x], opa)); + } + dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); + src_buf_u8 += src_stride; + mask_buf += mask_stride; } - dest_buf_u16 = drawbuf_next_row(dest_buf_u16, dest_stride); - src_buf_u8 += src_stride; - mask_buf += mask_stride; } -#endif } } else { diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c index 560ff55c25..a2b0aac130 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c @@ -18,6 +18,8 @@ #if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NEON #include "neon/lv_blend_neon.h" +#elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM + #include "helium/lv_blend_helium.h" #elif LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_CUSTOM #include LV_DRAW_SW_ASM_CUSTOM_INCLUDE #endif @@ -54,6 +56,25 @@ LV_ATTRIBUTE_FAST_MEM static inline void * drawbuf_next_row(const void * buf, ui * MACROS **********************/ +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_NONE + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(...) LV_RESULT_INVALID + #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(...) LV_RESULT_INVALID +#endif + /********************** * GLOBAL FUNCTIONS **********************/ @@ -81,115 +102,107 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi /*Simple fill*/ if(mask == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB888 - LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dest_px_size); -#else - if(dest_px_size == 3) { - uint8_t * dest_buf_u8 = dsc->dest_buf; - uint8_t * dest_buf_ori = dsc->dest_buf; - w *= dest_px_size; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dest_px_size)) { + if(dest_px_size == 3) { + uint8_t * dest_buf_u8 = dsc->dest_buf; + uint8_t * dest_buf_ori = dsc->dest_buf; + w *= dest_px_size; - for(x = 0; x < w; x += 3) { - dest_buf_u8[x + 0] = dsc->color.blue; - dest_buf_u8[x + 1] = dsc->color.green; - dest_buf_u8[x + 2] = dsc->color.red; - } + for(x = 0; x < w; x += 3) { + dest_buf_u8[x + 0] = dsc->color.blue; + dest_buf_u8[x + 1] = dsc->color.green; + dest_buf_u8[x + 2] = dsc->color.red; + } - dest_buf_u8 += dest_stride; - - for(y = 1; y < h; y++) { - lv_memcpy(dest_buf_u8, dest_buf_ori, w); dest_buf_u8 += dest_stride; + + for(y = 1; y < h; y++) { + lv_memcpy(dest_buf_u8, dest_buf_ori, w); + dest_buf_u8 += dest_stride; + } + } + if(dest_px_size == 4) { + uint32_t color32 = lv_color_to_u32(dsc->color); + uint32_t * dest_buf_u32 = dsc->dest_buf; + for(y = 0; y < h; y++) { + for(x = 0; x <= w - 16; x += 16) { + dest_buf_u32[x + 0] = color32; + dest_buf_u32[x + 1] = color32; + dest_buf_u32[x + 2] = color32; + dest_buf_u32[x + 3] = color32; + + dest_buf_u32[x + 4] = color32; + dest_buf_u32[x + 5] = color32; + dest_buf_u32[x + 6] = color32; + dest_buf_u32[x + 7] = color32; + + dest_buf_u32[x + 8] = color32; + dest_buf_u32[x + 9] = color32; + dest_buf_u32[x + 10] = color32; + dest_buf_u32[x + 11] = color32; + + dest_buf_u32[x + 12] = color32; + dest_buf_u32[x + 13] = color32; + dest_buf_u32[x + 14] = color32; + dest_buf_u32[x + 15] = color32; + } + for(; x < w; x ++) { + dest_buf_u32[x] = color32; + } + + dest_buf_u32 = drawbuf_next_row(dest_buf_u32, dest_stride); + } } } - if(dest_px_size == 4) { - uint32_t color32 = lv_color_to_u32(dsc->color); - uint32_t * dest_buf_u32 = dsc->dest_buf; - for(y = 0; y < h; y++) { - for(x = 0; x <= w - 16; x += 16) { - dest_buf_u32[x + 0] = color32; - dest_buf_u32[x + 1] = color32; - dest_buf_u32[x + 2] = color32; - dest_buf_u32[x + 3] = color32; - - dest_buf_u32[x + 4] = color32; - dest_buf_u32[x + 5] = color32; - dest_buf_u32[x + 6] = color32; - dest_buf_u32[x + 7] = color32; - - dest_buf_u32[x + 8] = color32; - dest_buf_u32[x + 9] = color32; - dest_buf_u32[x + 10] = color32; - dest_buf_u32[x + 11] = color32; - - dest_buf_u32[x + 12] = color32; - dest_buf_u32[x + 13] = color32; - dest_buf_u32[x + 14] = color32; - dest_buf_u32[x + 15] = color32; - } - for(; x < w; x ++) { - dest_buf_u32[x] = color32; - } - - dest_buf_u32 = drawbuf_next_row(dest_buf_u32, dest_stride); - } - } -#endif } /*Opacity only*/ else if(mask == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA - LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dest_px_size); -#else - uint32_t color32 = lv_color_to_u32(dsc->color); - uint8_t * dest_buf = dsc->dest_buf; - w *= dest_px_size; - for(y = 0; y < h; y++) { - for(x = 0; x < w; x += dest_px_size) { - lv_color_24_24_mix((const uint8_t *)&color32, &dest_buf[x], opa); - } + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dest_px_size)) { + uint32_t color32 = lv_color_to_u32(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + w *= dest_px_size; + for(y = 0; y < h; y++) { + for(x = 0; x < w; x += dest_px_size) { + lv_color_24_24_mix((const uint8_t *)&color32, &dest_buf[x], opa); + } - dest_buf = drawbuf_next_row(dest_buf, dest_stride); + dest_buf = drawbuf_next_row(dest_buf, dest_stride); + } } -#endif } /*Masked with full opacity*/ else if(mask && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK - LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dest_px_size); -#else - uint32_t color32 = lv_color_to_u32(dsc->color); - uint8_t * dest_buf = dsc->dest_buf; - w *= dest_px_size; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dest_px_size)) { + uint32_t color32 = lv_color_to_u32(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + w *= dest_px_size; - for(y = 0; y < h; y++) { - uint32_t mask_x; - for(x = 0, mask_x = 0; x < w; x += dest_px_size, mask_x++) { - lv_color_24_24_mix((const uint8_t *)&color32, &dest_buf[x], mask[mask_x]); + for(y = 0; y < h; y++) { + uint32_t mask_x; + for(x = 0, mask_x = 0; x < w; x += dest_px_size, mask_x++) { + lv_color_24_24_mix((const uint8_t *)&color32, &dest_buf[x], mask[mask_x]); + } + dest_buf += dest_stride; + mask += mask_stride; } - dest_buf += dest_stride; - mask += mask_stride; } -#endif } /*Masked with opacity*/ else { -#ifdef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA - LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size); -#else - uint32_t color32 = lv_color_to_u32(dsc->color); - uint8_t * dest_buf = dsc->dest_buf; - w *= dest_px_size; + if(LV_RESULT_INVALID == LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size)) { + uint32_t color32 = lv_color_to_u32(dsc->color); + uint8_t * dest_buf = dsc->dest_buf; + w *= dest_px_size; - for(y = 0; y < h; y++) { - uint32_t mask_x; - for(x = 0, mask_x = 0; x < w; x += dest_px_size, mask_x++) { - lv_color_24_24_mix((const uint8_t *) &color32, &dest_buf[x], LV_OPA_MIX2(opa, mask[mask_x])); + for(y = 0; y < h; y++) { + uint32_t mask_x; + for(x = 0, mask_x = 0; x < w; x += dest_px_size, mask_x++) { + lv_color_24_24_mix((const uint8_t *) &color32, &dest_buf[x], LV_OPA_MIX2(opa, mask[mask_x])); + } + dest_buf += dest_stride; + mask += mask_stride; } - dest_buf += dest_stride; - mask += mask_stride; } -#endif } } @@ -237,72 +250,64 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888 - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size); -#else - for(y = 0; y < h; y++) { - for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - dest_buf_u8[dest_x + 2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ - dest_buf_u8[dest_x + 1] = (src_buf_c16[src_x].green * 1037) >> 8; - dest_buf_u8[dest_x + 0] = (src_buf_c16[src_x].blue * 2106) >> 8; + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + dest_buf_u8[dest_x + 2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ + dest_buf_u8[dest_x + 1] = (src_buf_c16[src_x].green * 1037) >> 8; + dest_buf_u8[dest_x + 0] = (src_buf_c16[src_x].blue * 2106) >> 8; + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); } - dest_buf_u8 += dest_stride; - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); } -#endif } else if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size); -#else - uint8_t res[3]; - for(y = 0; y < h; y++) { - for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - res[2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ - res[1] = (src_buf_c16[src_x].green * 1037) >> 8; - res[0] = (src_buf_c16[src_x].blue * 2106) >> 8; - lv_color_24_24_mix(res, &dest_buf_u8[dest_x], opa); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size)) { + uint8_t res[3]; + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + res[2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ + res[1] = (src_buf_c16[src_x].green * 1037) >> 8; + res[0] = (src_buf_c16[src_x].blue * 2106) >> 8; + lv_color_24_24_mix(res, &dest_buf_u8[dest_x], opa); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); } - dest_buf_u8 += dest_stride; - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); } -#endif } else if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size); -#else - uint8_t res[3]; - for(y = 0; y < h; y++) { - for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - res[2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ - res[1] = (src_buf_c16[src_x].green * 1037) >> 8; - res[0] = (src_buf_c16[src_x].blue * 2106) >> 8; - lv_color_24_24_mix(res, &dest_buf_u8[dest_x], mask_buf[src_x]); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size)) { + uint8_t res[3]; + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + res[2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ + res[1] = (src_buf_c16[src_x].green * 1037) >> 8; + res[0] = (src_buf_c16[src_x].blue * 2106) >> 8; + lv_color_24_24_mix(res, &dest_buf_u8[dest_x], mask_buf[src_x]); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; } - dest_buf_u8 += dest_stride; - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); - mask_buf += mask_stride; } -#endif } else { -#ifdef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA - LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size); -#else - uint8_t res[3]; - for(y = 0; y < h; y++) { - for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - res[2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ - res[1] = (src_buf_c16[src_x].green * 1037) >> 8; - res[0] = (src_buf_c16[src_x].blue * 2106) >> 8; - lv_color_24_24_mix(res, &dest_buf_u8[dest_x], LV_OPA_MIX2(opa, mask_buf[src_x])); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size)) { + uint8_t res[3]; + for(y = 0; y < h; y++) { + for(src_x = 0, dest_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + res[2] = (src_buf_c16[src_x].red * 2106) >> 8; /*To make it rounded*/ + res[1] = (src_buf_c16[src_x].green * 1037) >> 8; + res[0] = (src_buf_c16[src_x].blue * 2106) >> 8; + lv_color_24_24_mix(res, &dest_buf_u8[dest_x], LV_OPA_MIX2(opa, mask_buf[src_x])); + } + dest_buf_u8 += dest_stride; + src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); + mask_buf += mask_stride; } - dest_buf_u8 += dest_stride; - src_buf_c16 = drawbuf_next_row(src_buf_c16, src_stride); - mask_buf += mask_stride; } -#endif } } else { @@ -343,71 +348,63 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { /*Special case*/ if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888 - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size, src_px_size); -#else - if(src_px_size == dest_px_size) { - for(y = 0; y < h; y++) { - lv_memcpy(dest_buf, src_buf, w); - dest_buf += dest_stride; - src_buf += src_stride; + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size, src_px_size)) { + if(src_px_size == dest_px_size) { + for(y = 0; y < h; y++) { + lv_memcpy(dest_buf, src_buf, w); + dest_buf += dest_stride; + src_buf += src_stride; + } + } + else { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; dest_x < w; dest_x += dest_px_size, src_x += src_px_size) { + dest_buf[dest_x + 0] = src_buf[src_x + 0]; + dest_buf[dest_x + 1] = src_buf[src_x + 1]; + dest_buf[dest_x + 2] = src_buf[src_x + 2]; + } + dest_buf += dest_stride; + src_buf += src_stride; + } } } - else { + } + if(mask_buf == NULL && opa < LV_OPA_MAX) { + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size, src_px_size)) { for(y = 0; y < h; y++) { for(dest_x = 0, src_x = 0; dest_x < w; dest_x += dest_px_size, src_x += src_px_size) { - dest_buf[dest_x + 0] = src_buf[src_x + 0]; - dest_buf[dest_x + 1] = src_buf[src_x + 1]; - dest_buf[dest_x + 2] = src_buf[src_x + 2]; + lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], opa); } dest_buf += dest_stride; src_buf += src_stride; } } -#endif - } - if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size, src_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; dest_x < w; dest_x += dest_px_size, src_x += src_px_size) { - lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], opa); - } - dest_buf += dest_stride; - src_buf += src_stride; - } -#endif } if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size, src_px_size); -#else - uint32_t mask_x; - for(y = 0; y < h; y++) { - for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x += dest_px_size, src_x += src_px_size) { - lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], mask_buf[mask_x]); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size, src_px_size)) { + uint32_t mask_x; + for(y = 0; y < h; y++) { + for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x += dest_px_size, src_x += src_px_size) { + lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], mask_buf[mask_x]); + } + dest_buf += dest_stride; + src_buf += src_stride; + mask_buf += mask_stride; } - dest_buf += dest_stride; - src_buf += src_stride; - mask_buf += mask_stride; } -#endif } if(mask_buf && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA - LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size, src_px_size); -#else - uint32_t mask_x; - for(y = 0; y < h; y++) { - for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x += dest_px_size, src_x += src_px_size) { - lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], LV_OPA_MIX2(opa, mask_buf[mask_x])); + if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size, src_px_size)) { + uint32_t mask_x; + for(y = 0; y < h; y++) { + for(mask_x = 0, dest_x = 0, src_x = 0; dest_x < w; mask_x++, dest_x += dest_px_size, src_x += src_px_size) { + lv_color_24_24_mix(&src_buf[src_x], &dest_buf[dest_x], LV_OPA_MIX2(opa, mask_buf[mask_x])); + } + dest_buf += dest_stride; + src_buf += src_stride; + mask_buf += mask_stride; } - dest_buf += dest_stride; - src_buf += src_stride; - mask_buf += mask_stride; } -#endif } } else { @@ -447,60 +444,52 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) { if(mask_buf == NULL && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888 - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], src_buf_c32[src_x].alpha); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], src_buf_c32[src_x].alpha); + } + dest_buf += dest_stride; + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } - dest_buf += dest_stride; - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } -#endif } else if(mask_buf == NULL && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], LV_OPA_MIX2(src_buf_c32[src_x].alpha, opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], LV_OPA_MIX2(src_buf_c32[src_x].alpha, opa)); + } + dest_buf += dest_stride; + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } - dest_buf += dest_stride; - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); } -#endif } else if(mask_buf && opa >= LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], - LV_OPA_MIX2(src_buf_c32[src_x].alpha, mask_buf[src_x])); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], + LV_OPA_MIX2(src_buf_c32[src_x].alpha, mask_buf[src_x])); + } + dest_buf += dest_stride; + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; } - dest_buf += dest_stride; - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); - mask_buf += mask_stride; } -#endif } else if(mask_buf && opa < LV_OPA_MAX) { -#ifdef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA - LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size); -#else - for(y = 0; y < h; y++) { - for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { - lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], - LV_OPA_MIX3(src_buf_c32[src_x].alpha, mask_buf[src_x], opa)); + if(LV_RESULT_INVALID == LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dest_px_size)) { + for(y = 0; y < h; y++) { + for(dest_x = 0, src_x = 0; src_x < w; dest_x += dest_px_size, src_x++) { + lv_color_24_24_mix((const uint8_t *)&src_buf_c32[src_x], &dest_buf[dest_x], + LV_OPA_MIX3(src_buf_c32[src_x].alpha, mask_buf[src_x], opa)); + } + dest_buf += dest_stride; + src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); + mask_buf += mask_stride; } - dest_buf += dest_stride; - src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride); - mask_buf += mask_stride; } -#endif } } else { diff --git a/src/draw/sw/blend/neon/lv_blend_neon.h b/src/draw/sw/blend/neon/lv_blend_neon.h index b4830a30c7..5719342d2a 100644 --- a/src/draw/sw/blend/neon/lv_blend_neon.h +++ b/src/draw/sw/blend/neon/lv_blend_neon.h @@ -186,7 +186,7 @@ typedef struct { **********************/ extern void lv_color_blend_to_rgb565_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb565_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_rgb565_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -197,10 +197,11 @@ static inline void _lv_color_blend_to_rgb565_neon(_lv_draw_sw_blend_fill_dsc_t * }; lv_color_blend_to_rgb565_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb565_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -211,10 +212,11 @@ static inline void _lv_color_blend_to_rgb565_with_opa_neon(_lv_draw_sw_blend_fil .src_buf = &dsc->color }; lv_color_blend_to_rgb565_with_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb565_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -226,10 +228,11 @@ static inline void _lv_color_blend_to_rgb565_with_mask_neon(_lv_draw_sw_blend_fi .mask_stride = dsc->mask_stride }; lv_color_blend_to_rgb565_with_mask_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -242,10 +245,11 @@ static inline void _lv_color_blend_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend .mask_stride = dsc->mask_stride }; lv_color_blend_to_rgb565_mix_mask_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -256,10 +260,11 @@ static inline void _lv_rgb565_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_imag .src_stride = dsc->src_stride }; lv_rgb565_blend_normal_to_rgb565_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -271,10 +276,11 @@ static inline void _lv_rgb565_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_b .src_stride = dsc->src_stride }; lv_rgb565_blend_normal_to_rgb565_with_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -287,10 +293,11 @@ static inline void _lv_rgb565_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_ .mask_stride = dsc->mask_stride }; lv_rgb565_blend_normal_to_rgb565_with_mask_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -304,11 +311,13 @@ static inline void _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_ .mask_stride = dsc->mask_stride }; lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -324,12 +333,13 @@ static inline void _lv_rgb888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_imag else { lv_xrgb8888_blend_normal_to_rgb565_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -346,12 +356,13 @@ static inline void _lv_rgb888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_b else { lv_xrgb8888_blend_normal_to_rgb565_with_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -369,12 +380,13 @@ static inline void _lv_rgb888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_ else { lv_xrgb8888_blend_normal_to_rgb565_with_mask_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -393,10 +405,11 @@ static inline void _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_ else { lv_xrgb8888_blend_normal_to_rgb565_mix_mask_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -407,10 +420,11 @@ static inline void _lv_argb8888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_im .src_stride = dsc->src_stride }; lv_argb8888_blend_normal_to_rgb565_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -422,10 +436,11 @@ static inline void _lv_argb8888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw .src_stride = dsc->src_stride }; lv_argb8888_blend_normal_to_rgb565_with_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -438,10 +453,11 @@ static inline void _lv_argb8888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_s .mask_stride = dsc->mask_stride }; lv_argb8888_blend_normal_to_rgb565_with_mask_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -455,11 +471,12 @@ static inline void _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_dra .mask_stride = dsc->mask_stride }; lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb888_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t _lv_color_blend_to_rgb888_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -474,11 +491,13 @@ static inline void _lv_color_blend_to_rgb888_neon(_lv_draw_sw_blend_fill_dsc_t * else { lv_color_blend_to_xrgb8888_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb888_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -494,11 +513,13 @@ static inline void _lv_color_blend_to_rgb888_with_opa_neon(_lv_draw_sw_blend_fil else { lv_color_blend_to_xrgb8888_with_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb888_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -515,11 +536,13 @@ static inline void _lv_color_blend_to_rgb888_with_mask_neon(_lv_draw_sw_blend_fi else { lv_color_blend_to_xrgb8888_with_mask_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_color_blend_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -537,11 +560,13 @@ static inline void _lv_color_blend_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend else { lv_color_blend_to_xrgb8888_mix_mask_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -557,12 +582,13 @@ static inline void _lv_rgb565_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_imag else { lv_rgb565_blend_normal_to_xrgb8888_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -579,12 +605,13 @@ static inline void _lv_rgb565_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_b else { lv_rgb565_blend_normal_to_xrgb8888_with_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -602,12 +629,13 @@ static inline void _lv_rgb565_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_ else { lv_rgb565_blend_normal_to_xrgb8888_with_mask_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -626,14 +654,16 @@ static inline void _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_ else { lv_rgb565_blend_normal_to_xrgb8888_mix_mask_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dst_px_size, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -659,14 +689,15 @@ static inline void _lv_rgb888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_imag lv_xrgb8888_blend_normal_to_xrgb8888_neon(&asm_dsc); } } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -693,14 +724,15 @@ static inline void _lv_rgb888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_b lv_xrgb8888_blend_normal_to_xrgb8888_with_opa_neon(&asm_dsc); } } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -728,14 +760,15 @@ static inline void _lv_rgb888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_ lv_xrgb8888_blend_normal_to_xrgb8888_with_mask_neon(&asm_dsc); } } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -764,11 +797,13 @@ static inline void _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_ lv_xrgb8888_blend_normal_to_xrgb8888_mix_mask_opa_neon(&asm_dsc); } } + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -784,12 +819,13 @@ static inline void _lv_argb8888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_im else { lv_argb8888_blend_normal_to_xrgb8888_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -806,12 +842,13 @@ static inline void _lv_argb8888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw else { lv_argb8888_blend_normal_to_xrgb8888_with_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -829,12 +866,13 @@ static inline void _lv_argb8888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_s else { lv_argb8888_blend_normal_to_xrgb8888_with_mask_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -853,10 +891,11 @@ static inline void _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_dra else { lv_argb8888_blend_normal_to_xrgb8888_mix_mask_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_color_blend_to_argb8888_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_argb8888_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_argb8888_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -867,10 +906,11 @@ static inline void _lv_color_blend_to_argb8888_neon(_lv_draw_sw_blend_fill_dsc_t }; lv_color_blend_to_argb8888_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_argb8888_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_argb8888_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -881,10 +921,11 @@ static inline void _lv_color_blend_to_argb8888_with_opa_neon(_lv_draw_sw_blend_f .src_buf = &dsc->color }; lv_color_blend_to_argb8888_with_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_argb8888_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_argb8888_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -896,10 +937,11 @@ static inline void _lv_color_blend_to_argb8888_with_mask_neon(_lv_draw_sw_blend_ .mask_stride = dsc->mask_stride }; lv_color_blend_to_argb8888_with_mask_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_color_blend_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_color_blend_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t _lv_color_blend_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -912,10 +954,11 @@ static inline void _lv_color_blend_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_ble .mask_stride = dsc->mask_stride }; lv_color_blend_to_argb8888_mix_mask_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -926,10 +969,11 @@ static inline void _lv_rgb565_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_im .src_stride = dsc->src_stride }; lv_rgb565_blend_normal_to_argb8888_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -941,10 +985,11 @@ static inline void _lv_rgb565_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw .src_stride = dsc->src_stride }; lv_rgb565_blend_normal_to_argb8888_with_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -957,10 +1002,11 @@ static inline void _lv_rgb565_blend_normal_to_argb8888_with_mask_neon(_lv_draw_s .mask_stride = dsc->mask_stride }; lv_rgb565_blend_normal_to_argb8888_with_mask_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -974,11 +1020,13 @@ static inline void _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_dra .mask_stride = dsc->mask_stride }; lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -994,12 +1042,13 @@ static inline void _lv_rgb888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_im else { lv_xrgb8888_blend_normal_to_argb8888_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1016,12 +1065,13 @@ static inline void _lv_rgb888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw else { lv_xrgb8888_blend_normal_to_argb8888_with_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1039,12 +1089,13 @@ static inline void _lv_rgb888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_s else { lv_xrgb8888_blend_normal_to_argb8888_with_mask_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1063,10 +1114,11 @@ static inline void _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_dra else { lv_xrgb8888_blend_normal_to_argb8888_mix_mask_opa_neon(&asm_dsc); } + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1077,10 +1129,11 @@ static inline void _lv_argb8888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_ .src_stride = dsc->src_stride }; lv_argb8888_blend_normal_to_argb8888_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1092,10 +1145,11 @@ static inline void _lv_argb8888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_ .src_stride = dsc->src_stride }; lv_argb8888_blend_normal_to_argb8888_with_opa_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1108,10 +1162,11 @@ static inline void _lv_argb8888_blend_normal_to_argb8888_with_mask_neon(_lv_draw .mask_stride = dsc->mask_stride }; lv_argb8888_blend_normal_to_argb8888_with_mask_neon(&asm_dsc); + return LV_RESULT_OK; } extern void lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline void _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1125,6 +1180,7 @@ static inline void _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_d .mask_stride = dsc->mask_stride }; lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(&asm_dsc); + return LV_RESULT_OK; } /********************** diff --git a/src/libs/gif/gifdec.c b/src/libs/gif/gifdec.c index 2443ac59df..b35a5730f8 100644 --- a/src/libs/gif/gifdec.c +++ b/src/libs/gif/gifdec.c @@ -35,7 +35,7 @@ static void f_gif_read(gd_GIF * gif, void * buf, size_t len); static int f_gif_seek(gd_GIF * gif, size_t pos, int k); static void f_gif_close(gd_GIF * gif); -#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_MVE +#if LV_USE_DRAW_SW_ASM == LV_DRAW_SW_ASM_HELIUM #include "gifdec_mve.h" #endif diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 7965b436f8..e18fbc1016 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -25,7 +25,7 @@ #define LV_DRAW_SW_ASM_NONE 0 #define LV_DRAW_SW_ASM_NEON 1 -#define LV_DRAW_SW_ASM_MVE 2 +#define LV_DRAW_SW_ASM_HELIUM 2 #define LV_DRAW_SW_ASM_CUSTOM 255 /* Handle special Kconfig options */ @@ -314,6 +314,15 @@ #endif #endif +/* Use Arm-2D on Cortex-M based devices. Please only enable it for Helium Powered devices for now */ +#ifndef LV_USE_DRAW_ARM2D + #ifdef CONFIG_LV_USE_DRAW_ARM2D + #define LV_USE_DRAW_ARM2D CONFIG_LV_USE_DRAW_ARM2D + #else + #define LV_USE_DRAW_ARM2D 0 + #endif +#endif + /* Use NXP's VG-Lite GPU on iMX RTxxx platforms. */ #ifndef LV_USE_DRAW_VGLITE #ifdef CONFIG_LV_USE_DRAW_VGLITE diff --git a/src/lv_init.c b/src/lv_init.c index 9d829cd583..f906b1fdc7 100644 --- a/src/lv_init.c +++ b/src/lv_init.c @@ -65,6 +65,10 @@ * MACROS **********************/ +#ifndef LV_GLOBAL_INIT + #define LV_GLOBAL_INIT(__GLOBAL_PTR) lv_global_init((lv_global_t *)(__GLOBAL_PTR)) +#endif + /********************** * GLOBAL FUNCTIONS **********************/ @@ -133,7 +137,7 @@ void lv_init(void) LV_LOG_INFO("begin"); /*Initialize members of static variable lv_global */ - lv_global_init(LV_GLOBAL_DEFAULT()); + LV_GLOBAL_INIT(LV_GLOBAL_DEFAULT()); lv_mem_init();