mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-13 07:18:06 +08:00
feat(draw): add a configuration to reduce code size (#6313)
Co-authored-by: Zoltan Janosy <zjanosy@fishman.com>
This commit is contained in:
@@ -199,6 +199,46 @@ menu "LVGL configuration"
|
||||
help
|
||||
Required to draw anything on the screen.
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_RGB565
|
||||
bool "Enable support for RGB565 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
bool "Enable support for RGB565A8 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_RGB888
|
||||
bool "Enable support for RGB888 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
bool "Enable support for XRGB8888 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
bool "Enable support for ARGB8888 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_L8
|
||||
bool "Enable support for L8 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_AL88
|
||||
bool "Enable support for AL88 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_SUPPORT_A8
|
||||
bool "Enable support for A8 color format"
|
||||
default y
|
||||
depends on LV_USE_DRAW_SW
|
||||
|
||||
config LV_DRAW_SW_DRAW_UNIT_CNT
|
||||
int "Number of draw units"
|
||||
default 1
|
||||
|
||||
+18
-1
@@ -121,7 +121,24 @@
|
||||
|
||||
#define LV_USE_DRAW_SW 1
|
||||
#if LV_USE_DRAW_SW == 1
|
||||
/* Set the number of draw unit.
|
||||
|
||||
/*
|
||||
* Selectively disable color format support in order to reduce code size.
|
||||
* NOTE: some features use certain color formats internally, e.g.
|
||||
* - gradients use RGB888
|
||||
* - bitmaps with transparency may use ARGB8888
|
||||
*/
|
||||
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565 1
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565A8 1
|
||||
#define LV_DRAW_SW_SUPPORT_RGB888 1
|
||||
#define LV_DRAW_SW_SUPPORT_XRGB8888 1
|
||||
#define LV_DRAW_SW_SUPPORT_ARGB8888 1
|
||||
#define LV_DRAW_SW_SUPPORT_L8 1
|
||||
#define LV_DRAW_SW_SUPPORT_AL88 1
|
||||
#define LV_DRAW_SW_SUPPORT_A8 1
|
||||
|
||||
/* Set the number of draw unit.
|
||||
* > 1 requires an operating system enabled in `LV_USE_OS`
|
||||
* > 1 means multiply threads will render the screen in parallel */
|
||||
#define LV_DRAW_SW_DRAW_UNIT_CNT 1
|
||||
|
||||
@@ -7,11 +7,21 @@
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../lv_draw_sw.h"
|
||||
#include "lv_draw_sw_blend_to_l8.h"
|
||||
#include "lv_draw_sw_blend_to_al88.h"
|
||||
#include "lv_draw_sw_blend_to_rgb565.h"
|
||||
#include "lv_draw_sw_blend_to_argb8888.h"
|
||||
#include "lv_draw_sw_blend_to_rgb888.h"
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
#include "lv_draw_sw_blend_to_l8.h"
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
#include "lv_draw_sw_blend_to_al88.h"
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
#include "lv_draw_sw_blend_to_rgb565.h"
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
#include "lv_draw_sw_blend_to_argb8888.h"
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
#include "lv_draw_sw_blend_to_rgb888.h"
|
||||
#endif
|
||||
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
@@ -76,21 +86,31 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t *
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
lv_draw_sw_blend_color_to_rgb565(&fill_dsc);
|
||||
break;
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
lv_draw_sw_blend_color_to_argb8888(&fill_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
lv_draw_sw_blend_color_to_rgb888(&fill_dsc, 3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
lv_draw_sw_blend_color_to_rgb888(&fill_dsc, 4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
lv_draw_sw_blend_color_to_l8(&fill_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
lv_draw_sw_blend_color_to_al88(&fill_dsc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -137,25 +157,37 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t *
|
||||
blend_area.y1 - layer->buf_area.y1);
|
||||
|
||||
switch(layer->color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
case LV_COLOR_FORMAT_RGB565A8:
|
||||
lv_draw_sw_blend_image_to_rgb565(&image_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
lv_draw_sw_blend_image_to_argb8888(&image_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
lv_draw_sw_blend_image_to_rgb888(&image_dsc, 3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
lv_draw_sw_blend_image_to_rgb888(&image_dsc, 4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
lv_draw_sw_blend_image_to_l8(&image_dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
lv_draw_sw_blend_image_to_al88(&image_dsc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "lv_draw_sw_blend_to_al88.h"
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
|
||||
#include "lv_draw_sw_blend.h"
|
||||
#include "../../../misc/lv_math.h"
|
||||
#include "../../../display/lv_display.h"
|
||||
@@ -44,16 +46,24 @@ typedef struct {
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void lv_color_mix_with_alpha_cache_init(lv_color_mix_alpha_cache_t * cache);
|
||||
|
||||
@@ -64,10 +74,10 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b
|
||||
|
||||
static inline bool lv_color16a_eq(lv_color16a_t c1, lv_color16a_t c2);
|
||||
|
||||
static inline lv_color16a_t LV_ATTRIBUTE_FAST_MEM lv_color_mix16a(lv_color16a_t fg, lv_color16a_t bg);
|
||||
static inline lv_color16a_t /* LV_ATTRIBUTE_FAST_MEM */ lv_color_mix16a(lv_color16a_t fg, lv_color16a_t bg);
|
||||
|
||||
static inline void LV_ATTRIBUTE_FAST_MEM lv_color_16a_16a_mix(lv_color16a_t src, lv_color16a_t * dest,
|
||||
lv_color_mix_alpha_cache_t * cache);
|
||||
static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_16a_16a_mix(lv_color16a_t src, lv_color16a_t * dest,
|
||||
lv_color_mix_alpha_cache_t * cache);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -277,21 +287,31 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_al88(_lv_draw_sw_blend_fill
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
switch(dsc->src_color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
rgb888_image_blend(dsc, 4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
argb8888_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
l8_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
al88_image_blend(dsc);
|
||||
break;
|
||||
@@ -305,6 +325,8 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_imag
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -396,6 +418,8 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t *
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -482,6 +506,8 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -573,6 +599,10 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size)
|
||||
{
|
||||
@@ -671,6 +701,10 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -766,6 +800,8 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Check if two AL88 colors are equal
|
||||
* @param c1 the first color
|
||||
@@ -869,3 +905,5 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "lv_draw_sw_blend_to_argb8888.h"
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
#include "lv_draw_sw_blend.h"
|
||||
#include "../../../misc/lv_math.h"
|
||||
#include "../../../display/lv_display.h"
|
||||
@@ -44,14 +46,22 @@ typedef struct {
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
@@ -286,24 +296,34 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
switch(dsc->src_color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
rgb888_image_blend(dsc, 4);
|
||||
break;
|
||||
#endif
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
argb8888_image_blend(dsc);
|
||||
break;
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
l8_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
al88_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
LV_LOG_WARN("Not supported source color format");
|
||||
break;
|
||||
@@ -314,6 +334,8 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -406,6 +428,10 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -493,6 +519,10 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t *
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -588,6 +618,10 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size)
|
||||
{
|
||||
|
||||
@@ -706,6 +740,8 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -896,3 +932,5 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "lv_draw_sw_blend_to_l8.h"
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
|
||||
#include "lv_draw_sw_blend.h"
|
||||
#include "../../../misc/lv_math.h"
|
||||
#include "../../../display/lv_display.h"
|
||||
@@ -38,14 +40,22 @@
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_8_mix(const uint8_t src, uint8_t * dest, uint8_t mix);
|
||||
|
||||
@@ -251,24 +261,34 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_l8(_lv_draw_sw_blend_fill_d
|
||||
void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_l8(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
switch(dsc->src_color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
rgb888_image_blend(dsc, 4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
argb8888_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
l8_image_blend(dsc);
|
||||
break;
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
al88_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
LV_LOG_WARN("Not supported source color format");
|
||||
break;
|
||||
@@ -359,6 +379,8 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t *
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -443,6 +465,10 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -525,6 +551,10 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size)
|
||||
{
|
||||
@@ -612,6 +642,10 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -691,6 +725,8 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline void LV_ATTRIBUTE_FAST_MEM lv_color_8_8_mix(const uint8_t src, uint8_t * dest, uint8_t mix)
|
||||
{
|
||||
|
||||
@@ -732,3 +768,5 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "lv_draw_sw_blend_to_rgb565.h"
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
|
||||
#include "lv_draw_sw_blend.h"
|
||||
#include "../../../misc/lv_math.h"
|
||||
#include "../../../display/lv_display.h"
|
||||
@@ -36,16 +38,24 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t src_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
static inline uint16_t /* LV_ATTRIBUTE_FAST_MEM */ l8_to_rgb565(const uint8_t c1);
|
||||
|
||||
@@ -333,21 +343,31 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_im
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rgb565_image_blend(dsc);
|
||||
break;
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, 3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
rgb888_image_blend(dsc, 4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
argb8888_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
l8_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
al88_image_blend(dsc);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
LV_LOG_WARN("Not supported source color format");
|
||||
break;
|
||||
@@ -358,6 +378,8 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_im
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -472,6 +494,10 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -583,6 +609,8 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t *
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -691,6 +719,8 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -799,6 +829,10 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -912,6 +946,8 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline uint16_t LV_ATTRIBUTE_FAST_MEM l8_to_rgb565(const uint8_t c1)
|
||||
{
|
||||
return ((c1 & 0xF8) << 8) + ((c1 & 0xFC) << 3) + ((c1 & 0xF8) >> 3);
|
||||
@@ -958,3 +994,5 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "lv_draw_sw_blend_to_rgb888.h"
|
||||
#if LV_USE_DRAW_SW
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
#include "lv_draw_sw_blend.h"
|
||||
#include "../../../misc/lv_math.h"
|
||||
#include "../../../display/lv_display.h"
|
||||
@@ -36,18 +38,26 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size);
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size);
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size);
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size);
|
||||
#endif
|
||||
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
const uint8_t dest_px_size,
|
||||
uint32_t src_px_size);
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc,
|
||||
uint32_t dest_px_size);
|
||||
#endif
|
||||
|
||||
static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_24_mix(const uint8_t src, uint8_t * dest, uint8_t mix);
|
||||
|
||||
@@ -280,24 +290,34 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_im
|
||||
{
|
||||
|
||||
switch(dsc->src_color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rgb565_image_blend(dsc, dest_px_size);
|
||||
break;
|
||||
#endif
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rgb888_image_blend(dsc, dest_px_size, 3);
|
||||
break;
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
rgb888_image_blend(dsc, dest_px_size, 4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
argb8888_image_blend(dsc, dest_px_size);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
l8_image_blend(dsc, dest_px_size);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
case LV_COLOR_FORMAT_AL88:
|
||||
al88_image_blend(dsc, dest_px_size);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
LV_LOG_WARN("Not supported source color format");
|
||||
break;
|
||||
@@ -308,6 +328,8 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_im
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -390,6 +412,10 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -474,6 +500,10 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t *
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -570,6 +600,8 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t dest_px_size,
|
||||
uint32_t src_px_size)
|
||||
{
|
||||
@@ -668,6 +700,8 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
@@ -751,6 +785,8 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static inline void LV_ATTRIBUTE_FAST_MEM blend_non_normal_pixel(uint8_t * dest, lv_color32_t src, lv_blend_mode_t mode)
|
||||
{
|
||||
uint8_t res[3] = {0, 0, 0};
|
||||
@@ -819,3 +855,5 @@ static inline void * LV_ATTRIBUTE_FAST_MEM drawbuf_next_row(const void * buf, ui
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -91,6 +91,7 @@ static int32_t dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer);
|
||||
static int32_t evaluate(lv_draw_unit_t * draw_unit, lv_draw_task_t * task);
|
||||
static int32_t lv_draw_sw_delete(lv_draw_unit_t * draw_unit);
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
static void rotate90_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
|
||||
int32_t srcStride,
|
||||
int32_t dstStride);
|
||||
@@ -99,12 +100,16 @@ static void rotate180_argb8888(const uint32_t * src, uint32_t * dst, int32_t wid
|
||||
static void rotate270_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
|
||||
int32_t srcStride,
|
||||
int32_t dstStride);
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
static void rotate90_rgb888(const uint8_t * src, uint8_t * dst, int32_t srcWidth, int32_t srcHeight, int32_t srcStride,
|
||||
int32_t dstStride);
|
||||
static void rotate180_rgb888(const uint8_t * src, uint8_t * dst, int32_t width, int32_t height, int32_t src_stride,
|
||||
int32_t dest_stride);
|
||||
static void rotate270_rgb888(const uint8_t * src, uint8_t * dst, int32_t width, int32_t height, int32_t srcStride,
|
||||
int32_t dstStride);
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
static void rotate90_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
|
||||
int32_t srcStride,
|
||||
int32_t dstStride);
|
||||
@@ -113,6 +118,7 @@ static void rotate180_rgb565(const uint16_t * src, uint16_t * dst, int32_t width
|
||||
static void rotate270_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
|
||||
int32_t srcStride,
|
||||
int32_t dstStride);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -221,16 +227,22 @@ void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t
|
||||
{
|
||||
if(rotation == LV_DISPLAY_ROTATION_90) {
|
||||
switch(color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rotate90_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rotate90_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
rotate90_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -240,16 +252,22 @@ void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t
|
||||
|
||||
if(rotation == LV_DISPLAY_ROTATION_180) {
|
||||
switch(color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rotate180_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rotate180_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
rotate180_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -259,16 +277,22 @@ void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t
|
||||
|
||||
if(rotation == LV_DISPLAY_ROTATION_270) {
|
||||
switch(color_format) {
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
rotate270_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
rotate270_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
rotate270_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -489,6 +513,8 @@ static void execute_drawing(lv_draw_sw_unit_t * u)
|
||||
LV_PROFILER_END;
|
||||
}
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
static void rotate270_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcWidth, int32_t srcHeight,
|
||||
int32_t srcStride,
|
||||
int32_t dstStride)
|
||||
@@ -550,6 +576,10 @@ static void rotate90_argb8888(const uint32_t * src, uint32_t * dst, int32_t srcW
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
static void rotate270_rgb888(const uint8_t * src, uint8_t * dst, int32_t srcWidth, int32_t srcHeight, int32_t srcStride,
|
||||
int32_t dstStride)
|
||||
{
|
||||
@@ -604,6 +634,10 @@ static void rotate90_rgb888(const uint8_t * src, uint8_t * dst, int32_t width, i
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565
|
||||
|
||||
static void rotate270_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWidth, int32_t srcHeight,
|
||||
int32_t srcStride,
|
||||
int32_t dstStride)
|
||||
@@ -665,4 +699,6 @@ static void rotate90_rgb565(const uint16_t * src, uint16_t * dst, int32_t srcWid
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /*LV_USE_DRAW_SW*/
|
||||
|
||||
@@ -51,22 +51,31 @@ typedef struct {
|
||||
static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout,
|
||||
int32_t * yout);
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
static void transform_rgb888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * dest_buf, bool aa, uint32_t px_size);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
static void transform_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * dest_buf, bool aa);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_A8
|
||||
static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * abuf, bool aa);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
static void transform_l8_to_al88(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * abuf, bool aa);
|
||||
@@ -74,6 +83,7 @@ static void transform_l8_to_al88(const uint8_t * src, int32_t src_w, int32_t src
|
||||
static void transform_l8_to_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * abuf, bool aa);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -215,30 +225,43 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are
|
||||
}
|
||||
|
||||
switch(src_cf) {
|
||||
#if LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
transform_rgb888(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa,
|
||||
4);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
transform_rgb888(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa,
|
||||
3);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_A8
|
||||
case LV_COLOR_FORMAT_A8:
|
||||
transform_a8(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
transform_argb8888(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf,
|
||||
aa);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565 && LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
transform_rgb565a8(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf,
|
||||
alpha_buf, false, aa);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
case LV_COLOR_FORMAT_RGB565A8:
|
||||
transform_rgb565a8(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w,
|
||||
(uint16_t *)dest_buf,
|
||||
alpha_buf, true, aa);
|
||||
break;
|
||||
#endif
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
if(draw_dsc->recolor_opa >= LV_OPA_MIN)
|
||||
transform_l8_to_argb8888(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf,
|
||||
@@ -246,6 +269,7 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are
|
||||
else
|
||||
transform_l8_to_al88(src_buf, src_w, src_h, src_stride, xs_ups, ys_ups, xs_step_256, ys_step_256, dest_w, dest_buf, aa);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -259,6 +283,8 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888
|
||||
|
||||
static void transform_rgb888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * dest_buf, bool aa, uint32_t px_size)
|
||||
@@ -355,6 +381,10 @@ static void transform_rgb888(const uint8_t * src, int32_t src_w, int32_t src_h,
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
static void transform_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * dest_buf, bool aa)
|
||||
@@ -444,6 +474,10 @@ static void transform_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
|
||||
static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa)
|
||||
@@ -555,6 +589,10 @@ static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_A8
|
||||
|
||||
static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * abuf, bool aa)
|
||||
@@ -629,6 +667,12 @@ static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int3
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_L8
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_AL88
|
||||
|
||||
/* L8 will be transformed into an AL88 buffer, because it will not be recolored */
|
||||
static void transform_l8_to_al88(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
@@ -706,6 +750,10 @@ static void transform_l8_to_al88(const uint8_t * src, int32_t src_w, int32_t src
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
|
||||
/* L8 has to be transformed into an ARGB8888 buffer, because it will be recolored as well */
|
||||
static void transform_l8_to_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
@@ -782,6 +830,10 @@ static void transform_l8_to_argb8888(const uint8_t * src, int32_t src_w, int32_t
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout,
|
||||
int32_t * yout)
|
||||
{
|
||||
|
||||
+98
-1
@@ -330,7 +330,104 @@
|
||||
#endif
|
||||
#endif
|
||||
#if LV_USE_DRAW_SW == 1
|
||||
/* Set the number of draw unit.
|
||||
|
||||
/*
|
||||
* Selectively disable color format support in order to reduce code size.
|
||||
* NOTE: some features use certain color formats internally, e.g.
|
||||
* - gradients use RGB888
|
||||
* - bitmaps with transparency may use ARGB8888
|
||||
*/
|
||||
|
||||
#ifndef LV_DRAW_SW_SUPPORT_RGB565
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565 CONFIG_LV_DRAW_SW_SUPPORT_RGB565
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565A8 CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565A8 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB565A8 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_RGB888
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB888
|
||||
#define LV_DRAW_SW_SUPPORT_RGB888 CONFIG_LV_DRAW_SW_SUPPORT_RGB888
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB888 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_RGB888 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
#define LV_DRAW_SW_SUPPORT_XRGB8888 CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_XRGB8888 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_XRGB8888 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
#define LV_DRAW_SW_SUPPORT_ARGB8888 CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_ARGB8888 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_ARGB8888 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_L8
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_L8
|
||||
#define LV_DRAW_SW_SUPPORT_L8 CONFIG_LV_DRAW_SW_SUPPORT_L8
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_L8 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_L8 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_AL88
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_AL88
|
||||
#define LV_DRAW_SW_SUPPORT_AL88 CONFIG_LV_DRAW_SW_SUPPORT_AL88
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_AL88 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_AL88 1
|
||||
#endif
|
||||
#endif
|
||||
#ifndef LV_DRAW_SW_SUPPORT_A8
|
||||
#ifdef _LV_KCONFIG_PRESENT
|
||||
#ifdef CONFIG_LV_DRAW_SW_SUPPORT_A8
|
||||
#define LV_DRAW_SW_SUPPORT_A8 CONFIG_LV_DRAW_SW_SUPPORT_A8
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_A8 0
|
||||
#endif
|
||||
#else
|
||||
#define LV_DRAW_SW_SUPPORT_A8 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Set the number of draw unit.
|
||||
* > 1 requires an operating system enabled in `LV_USE_OS`
|
||||
* > 1 means multiply threads will render the screen in parallel */
|
||||
#ifndef LV_DRAW_SW_DRAW_UNIT_CNT
|
||||
|
||||
Reference in New Issue
Block a user