initial commit

This commit is contained in:
Carter Essen committed 2026-11-09 17:35:03 -05:00
commit cff2a21efc
550 files changed
+154887

No files matched your search

@@ -0,0 +1,589 @@
/**
* @file lv_draw_sw_arm2d.h
*
*/
#ifndef LV_DRAW_SW_ARM2D_H
#define LV_DRAW_SW_ARM2D_H
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-OFF* */
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
#include "../../../misc/lv_area_private.h"
#if LV_USE_DRAW_ARM2D_SYNC
#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
*********************/
#ifndef LV_DRAW_SW_RGB565_SWAP
#define LV_DRAW_SW_RGB565_SWAP(__buf_ptr, __buf_size_px) \
lv_draw_sw_rgb565_swap_helium((__buf_ptr), (__buf_size_px))
#endif
#ifndef LV_DRAW_SW_IMAGE
#define LV_DRAW_SW_IMAGE(__transformed, \
__cf, \
__src_buf, \
__img_coords, \
__src_stride, \
__blend_area, \
__draw_unit, \
__draw_dsc) \
lv_draw_sw_image_helium( (__transformed), \
(__cf), \
(uint8_t *)(__src_buf), \
(__img_coords), \
(__src_stride), \
(__blend_area), \
(__draw_unit), \
(__draw_dsc))
#endif
#ifndef LV_DRAW_SW_RGB565_RECOLOR
#define LV_DRAW_SW_RGB565_RECOLOR(__src_buf, __blend_area, __color, __opa) \
lv_draw_sw_image_recolor_rgb565( (__src_buf), \
&(__blend_area), \
(__color), \
(__opa))
#endif
#ifndef LV_DRAW_SW_RGB888_RECOLOR
#define LV_DRAW_SW_RGB888_RECOLOR( __src_buf, \
__blend_area, \
__color, \
__opa, \
__cf) \
lv_draw_sw_image_recolor_rgb888( (__src_buf), \
&(__blend_area), \
(__color), \
(__opa), \
(__cf))
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
extern void arm_2d_helper_swap_rgb16(uint16_t * phwBuffer, uint32_t wCount);
/**********************
* MACROS
**********************/
#define __RECOLOUR_BEGIN() \
do { \
lv_color_t *rgb_tmp_buf = NULL; \
if(draw_dsc->recolor_opa > LV_OPA_MIN) { \
if(LV_COLOR_FORMAT_RGB565 == des_cf) { \
rgb_tmp_buf \
= lv_malloc(src_w * src_h * sizeof(uint16_t)); \
if (NULL == rgb_tmp_buf) { \
LV_LOG_WARN( \
"Failed to allocate memory for accelerating recolor, " \
"use normal route instead."); \
break; \
} \
lv_memcpy( rgb_tmp_buf, \
src_buf, \
src_w * src_h * sizeof(uint16_t)); \
arm_2d_size_t copy_size = { \
.iWidth = src_w, \
.iHeight = src_h, \
}; \
/* apply re-color */ \
__arm_2d_impl_rgb565_colour_filling_with_opacity( \
(uint16_t *)rgb_tmp_buf, \
src_w, \
&copy_size, \
lv_color_to_u16(draw_dsc->recolor), \
draw_dsc->recolor_opa); \
\
/* replace src_buf for the following operation */ \
src_buf = (const uint8_t *)rgb_tmp_buf; \
} \
else if(LV_COLOR_FORMAT_XRGB8888 == des_cf) { \
rgb_tmp_buf \
= lv_malloc(src_w * src_h * sizeof(uint32_t)); \
if (NULL == rgb_tmp_buf) { \
LV_LOG_WARN( \
"Failed to allocate memory for accelerating recolor, " \
"use normal route instead."); \
break; \
} \
lv_memcpy( rgb_tmp_buf, \
src_buf, \
src_w * src_h * sizeof(uint32_t)); \
arm_2d_size_t copy_size = { \
.iWidth = src_w, \
.iHeight = src_h, \
}; \
/* apply re-color */ \
__arm_2d_impl_cccn888_colour_filling_with_opacity( \
(uint32_t *)rgb_tmp_buf, \
src_w, \
&copy_size, \
lv_color_to_u32(draw_dsc->recolor), \
draw_dsc->recolor_opa); \
\
/* replace src_buf for the following operation */ \
src_buf = (const uint8_t *)rgb_tmp_buf; \
} \
} \
do {
#define __RECOLOUR_END() \
} while(0); \
if (NULL != rgb_tmp_buf) { \
lv_free(rgb_tmp_buf); \
} \
} while(0);
static inline lv_result_t lv_draw_sw_rgb565_swap_helium(void * buf, uint32_t buf_size_px)
{
arm_2d_helper_swap_rgb16((uint16_t *)buf, buf_size_px);
return LV_RESULT_OK;
}
static inline lv_result_t lv_draw_sw_image_helium(
bool is_transform,
lv_color_format_t src_cf,
const uint8_t *src_buf,
const lv_area_t * coords,
int32_t src_stride,
const lv_area_t * des_area,
lv_draw_unit_t * draw_unit,
const lv_draw_image_dsc_t * draw_dsc)
{
lv_result_t result = LV_RESULT_INVALID;
lv_layer_t * layer = draw_unit->target_layer;
lv_color_format_t des_cf = layer->color_format;
static bool arm_2d_initialized = false;
if (!arm_2d_initialized) {
arm_2d_initialized = true;
arm_2d_init();
}
do {
if (!is_transform) {
break;
}
if(draw_dsc->scale_x != draw_dsc->scale_y) {
break;
}
/* filter the unsupported colour format combination */
if((LV_COLOR_FORMAT_RGB565 == des_cf)
&& !( (LV_COLOR_FORMAT_RGB565 == src_cf)
|| (LV_COLOR_FORMAT_RGB565A8 == src_cf))) {
break;
}
#if 0 /* a temporary patch */
if((LV_COLOR_FORMAT_XRGB8888 == des_cf)
&& !( (LV_COLOR_FORMAT_ARGB8888 == src_cf)
|| (LV_COLOR_FORMAT_XRGB8888 == src_cf))) {
break;
}
#else
if((LV_COLOR_FORMAT_XRGB8888 == des_cf)
|| (LV_COLOR_FORMAT_RGB888 == des_cf)
|| (LV_COLOR_FORMAT_ARGB8888 == des_cf)) {
break;
}
#endif
/* ------------- prepare parameters for arm-2d APIs - BEGIN --------- */
lv_area_t blend_area;
if(!lv_area_intersect(&blend_area, des_area, draw_unit->clip_area)) {
break;
}
int32_t src_w = lv_area_get_width(coords);
int32_t src_h = lv_area_get_height(coords);
arm_2d_size_t src_size = {
.iWidth = (int16_t)src_w,
.iHeight = (int16_t)src_h,
};
// arm_2d_size_t des_size;
// do{
// int32_t des_w = lv_area_get_width(&blend_area);
// int32_t des_h = lv_area_get_height(&blend_area);
// LV_ASSERT(des_w <= INT16_MAX);
// LV_ASSERT(des_h <= INT16_MAX);
// des_size.iWidth = (int16_t)des_w;
// des_size.iHeight = (int16_t)des_h;
// } while(0);
//
// arm_2d_size_t copy_size = {
// .iWidth = MIN(des_size.iWidth, src_size.iWidth),
// .iHeight = MIN(des_size.iHeight, src_size.iHeight),
// };
//
// int32_t des_stride = lv_draw_buf_width_to_stride(
// lv_area_get_width(&layer->buf_area),
// des_cf);
// uint8_t *des_buf_moved = (uint8_t *)lv_draw_layer_go_to_xy(
// layer,
// blend_area.x1 - layer->buf_area.x1,
// blend_area.y1 - layer->buf_area.y1);
uint8_t *des_buf = (uint8_t *)lv_draw_layer_go_to_xy(layer, 0, 0);
uint8_t opa = draw_dsc->opa;
/* ------------- prepare parameters for arm-2d APIs - END ----------- */
__RECOLOUR_BEGIN()
static arm_2d_tile_t target_tile_origin;
static arm_2d_tile_t target_tile;
arm_2d_region_t clip_region;
static arm_2d_region_t target_region;
target_region = (arm_2d_region_t) {
.tLocation = {
.iX = (int16_t)(coords->x1 - draw_unit->clip_area->x1),
.iY = (int16_t)(coords->y1 - draw_unit->clip_area->y1),
},
.tSize = src_size,
};
target_tile_origin = (arm_2d_tile_t) {
.tRegion = {
.tSize = {
.iWidth = (int16_t)lv_area_get_width(&layer->buf_area),
.iHeight = (int16_t)lv_area_get_height(&layer->buf_area),
},
},
.tInfo = {
.bIsRoot = true,
},
.phwBuffer = (uint16_t *)des_buf,
};
clip_region = (arm_2d_region_t) {
.tLocation = {
.iX = (int16_t)(draw_unit->clip_area->x1 - layer->buf_area.x1),
.iY = (int16_t)(draw_unit->clip_area->y1 - layer->buf_area.y1),
},
.tSize = {
.iWidth = (int16_t)lv_area_get_width(draw_unit->clip_area),
.iHeight = (int16_t)lv_area_get_height(draw_unit->clip_area),
},
};
arm_2d_tile_generate_child(&target_tile_origin,
&clip_region,
&target_tile,
false);
static arm_2d_tile_t source_tile;
source_tile = (arm_2d_tile_t) {
.tRegion = {
.tSize = {
.iWidth = (int16_t)src_w,
.iHeight = (int16_t)src_h,
},
},
.tInfo = {
.bIsRoot = true,
},
.pchBuffer = (uint8_t *)src_buf,
};
static arm_2d_location_t source_center, target_center;
source_center.iX = draw_dsc->pivot.x;
source_center.iY = draw_dsc->pivot.y;
target_center = target_region.tLocation;
target_center.iX += draw_dsc->pivot.x;
target_center.iY += draw_dsc->pivot.y;
if(LV_COLOR_FORMAT_A8 == src_cf) {
source_tile.tInfo.bHasEnforcedColour = true;
source_tile.tInfo.tColourInfo.chScheme = ARM_2D_COLOUR_GRAY8;
if(LV_COLOR_FORMAT_RGB565 == des_cf) {
arm_2d_rgb565_fill_colour_with_mask_opacity_and_transform(
&source_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
lv_color_to_u16(draw_dsc->recolor),
opa,
&target_center
);
}
else if(LV_COLOR_FORMAT_XRGB8888 == des_cf) {
arm_2d_cccn888_fill_colour_with_mask_opacity_and_transform(
&source_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
lv_color_to_int(draw_dsc->recolor),
opa,
&target_center
);
}
else {
break;
}
}
else if(LV_COLOR_FORMAT_RGB565A8 == src_cf) {
LV_ASSERT(LV_COLOR_FORMAT_RGB565 == des_cf);
/* mask_buf = src_buf + src_stride * src_w / header->w * src_h; */
const uint8_t *mask_buf = src_buf + src_stride * src_h;
int32_t mask_stride = src_stride / 2;
static arm_2d_tile_t mask_tile;
mask_tile = source_tile;
mask_tile.tInfo.bHasEnforcedColour = true;
mask_tile.tInfo.tColourInfo.chScheme = ARM_2D_COLOUR_GRAY8;
mask_tile.pchBuffer = (uint8_t *)mask_buf;
if(opa >= LV_OPA_MAX) {
arm_2d_rgb565_tile_transform_with_src_mask(
&source_tile,
&mask_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
&target_center
);
}
else {
arm_2d_rgb565_tile_transform_with_src_mask_and_opacity(
&source_tile,
&mask_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
opa,
&target_center
);
}
}
else if(LV_COLOR_FORMAT_RGB565 == src_cf) {
LV_ASSERT(LV_COLOR_FORMAT_RGB565 == des_cf);
if(opa >= LV_OPA_MAX) {
#if ARM_2D_VERSION >= 10106
arm_2d_rgb565_tile_transform_only(
&source_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
&target_center);
#else
arm_2dp_rgb565_tile_transform_only_prepare(
NULL,
&source_tile,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
(float)(draw_dsc->scale_x / 256.0f));
arm_2dp_tile_transform(NULL,
&target_tile,
NULL,
&target_center);
#endif
}
else {
arm_2d_rgb565_tile_transform_only_with_opacity(
&source_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
opa,
&target_center
);
}
}
#if 0 /* a temporary patch */
else if(LV_COLOR_FORMAT_ARGB8888 == src_cf) {
LV_ASSERT(LV_COLOR_FORMAT_XRGB8888 == des_cf);
static arm_2d_tile_t mask_tile;
mask_tile = source_tile;
mask_tile.tInfo.bHasEnforcedColour = true;
mask_tile.tInfo.tColourInfo.chScheme = ARM_2D_CHANNEL_8in32;
mask_tile.pchBuffer = (uint8_t *)src_buf + 3;
if(opa >= LV_OPA_MAX) {
arm_2d_cccn888_tile_transform_with_src_mask(
&source_tile,
&mask_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
&target_center
);
}
else {
arm_2d_cccn888_tile_transform_with_src_mask_and_opacity(
&source_tile,
&mask_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
opa,
&target_center
);
}
}
else if(LV_COLOR_FORMAT_XRGB8888 == src_cf) {
LV_ASSERT(LV_COLOR_FORMAT_XRGB8888 == des_cf);
if(opa >= LV_OPA_MAX) {
arm_2d_cccn888_tile_transform_only(
&source_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
&target_center
);
}
else {
arm_2d_cccn888_tile_transform_only_with_opacity(
&source_tile,
&target_tile,
NULL,
source_center,
ARM_2D_ANGLE((draw_dsc->rotation / 10.0f)),
draw_dsc->scale_x / 256.0f,
opa,
&target_center
);
}
}
#endif
else {
break;
}
result = LV_RESULT_OK;
__RECOLOUR_END()
} while(0);
return result;
}
static inline lv_result_t lv_draw_sw_image_recolor_rgb565(
const uint8_t *src_buf,
const lv_area_t * blend_area,
lv_color_t color,
lv_opa_t opa)
{
int32_t src_w = lv_area_get_width(blend_area);
int32_t src_h = lv_area_get_height(blend_area);
arm_2d_size_t copy_size = {
.iWidth = (int16_t)src_w,
.iHeight = (int16_t)src_h,
};
__arm_2d_impl_rgb565_colour_filling_with_opacity(
(uint16_t *)src_buf,
src_w,
&copy_size,
lv_color_to_u16(color),
opa);
return LV_RESULT_OK;
}
static inline lv_result_t lv_draw_sw_image_recolor_rgb888(
const uint8_t *src_buf,
const lv_area_t * blend_area,
lv_color_t color,
lv_opa_t opa,
lv_color_format_t src_cf)
{
if(LV_COLOR_FORMAT_XRGB8888 != src_cf) {
return LV_RESULT_INVALID;
}
int32_t src_w = lv_area_get_width(blend_area);
int32_t src_h = lv_area_get_height(blend_area);
arm_2d_size_t copy_size = {
.iWidth = (int16_t)src_w,
.iHeight = (int16_t)src_h,
};
__arm_2d_impl_cccn888_colour_filling_with_opacity(
(uint32_t *)src_buf,
src_w,
&copy_size,
lv_color_to_u32(color),
opa);
return LV_RESULT_OK;
}
#endif /* LV_USE_DRAW_ARM2D_SYNC */
/* *INDENT-ON* */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_ARM2D_H */
@@ -0,0 +1,60 @@
/**
* @file lv_draw_sw_helium.h
*
*/
#ifndef LV_DRAW_SW_HELIUM_H
#define LV_DRAW_SW_HELIUM_H
#ifdef __cplusplus
extern "C" {
#endif
/* *INDENT-OFF* */
/*********************
* INCLUDES
*********************/
#include "../../../lv_conf_internal.h"
/* detect whether helium is available based on arm compilers' standard */
#if defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE
#ifdef LV_DRAW_SW_HELIUM_CUSTOM_INCLUDE
#include LV_DRAW_SW_HELIUM_CUSTOM_INCLUDE
#endif
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/*********************
* POST INCLUDES
*********************/
/* use arm-2d as the default helium acceleration */
#include "lv_draw_sw_arm2d.h"
#endif /* defined(__ARM_FEATURE_MVE) && __ARM_FEATURE_MVE */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_HELIUM_H*/
@@ -0,0 +1,937 @@
/**
* @file lv_blend_arm2d.h
*
*/
#ifndef LV_BLEND_ARM2D_H
#define LV_BLEND_ARM2D_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../../../lv_conf_internal.h"
#if LV_USE_DRAW_ARM2D_SYNC
#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
#if ARM_2D_VERSION < 10106ul
#error Please upgrade to Arm-2D v1.1.6 or above
#endif
#ifndef LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
#define LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF 1
#endif
/*********************
* DEFINES
*********************/
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc) \
lv_color_blend_to_rgb565_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc) \
lv_color_blend_to_rgb565_with_opa_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc) \
lv_color_blend_to_rgb565_with_mask_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc) \
lv_color_blend_to_rgb565_mix_mask_opa_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc) \
lv_rgb565_blend_normal_to_rgb565_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \
lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \
lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \
lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size) \
lv_rgb888_blend_normal_to_rgb565_arm2d(dsc, src_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size) \
lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(dsc, src_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size) \
lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(dsc, src_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
#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_arm2d(dsc, src_px_size)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc) \
lv_argb8888_blend_normal_to_rgb565_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \
lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \
lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \
lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dst_px_size) \
lv_color_blend_to_rgb888_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dst_px_size) \
lv_color_blend_to_rgb888_with_opa_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dst_px_size) \
lv_color_blend_to_rgb888_with_mask_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA
#define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \
lv_color_blend_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \
lv_rgb565_blend_normal_to_rgb888_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \
lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK
#define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \
lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
#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_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size, src_px_size) \
lv_rgb888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size, src_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA
#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_arm2d(dsc, dst_px_size, src_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK
#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_arm2d(dsc, dst_px_size, src_px_size)
#endif
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
#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_arm2d(dsc, dst_px_size, src_px_size)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \
lv_argb8888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \
lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \
lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size)
#endif
#ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA
#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_arm2d(dsc, dst_px_size)
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
static inline lv_result_t lv_color_blend_to_rgb565_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_with_src_mask_and_opacity((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,
dsc->opa);
return LV_RESULT_OK;
}
static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_arm2d(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_arm2d(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;
}
#if !LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
__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);
#else
__arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_opacity((uint32_t *)dsc->src_buf,
src_stride,
(uint16_t *)dsc->dest_buf,
des_stride,
&draw_size,
dsc->opa);
#endif
lv_free(tmp_buf);
return LV_RESULT_OK;
}
static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(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;
}
#if !LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
__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);
#else
__arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask((uint32_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);
#endif
lv_free(tmp_buf);
return LV_RESULT_OK;
}
static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(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;
}
#if !LV_ARM2D_XRGB888_ALPHA_ALWAYS_FF
__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_with_src_mask_and_opacity(tmp_buf,
des_stride,
(uint8_t *)dsc->mask_buf,
dsc->mask_stride,
&draw_size,
(uint16_t *)dsc->dest_buf,
des_stride,
&draw_size,
dsc->opa);
#else
__arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask_and_opacity((uint32_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,
dsc->opa);
#endif
lv_free(tmp_buf);
return LV_RESULT_OK;
}
static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_arm2d(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);
__arm_2d_impl_ccca8888_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_argb8888_blend_normal_to_rgb565_with_opa_arm2d(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);
__arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_opacity((uint32_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_argb8888_blend_normal_to_rgb565_with_mask_arm2d(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);
__arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask((uint32_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_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(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);
__arm_2d_impl_ccca8888_tile_copy_to_rgb565_with_src_mask_and_opacity((uint32_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,
dsc->opa);
return LV_RESULT_OK;
}
static inline lv_result_t lv_color_blend_to_rgb888_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_arm2d(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_tile_copy_with_src_mask_and_opacity(tmp_buf,
des_stride,
(uint8_t *)dsc->mask_buf,
dsc->mask_stride,
&draw_size,
(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_rgb888_blend_normal_to_rgb888_arm2d(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_arm2d(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_arm2d(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_arm2d(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_with_src_mask_and_opacity((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,
dsc->opa);
return LV_RESULT_OK;
}
static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_arm2d(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_ccca8888_to_cccn888((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_argb8888_blend_normal_to_rgb888_with_opa_arm2d(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_ccca8888_tile_copy_to_cccn888_with_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_argb8888_blend_normal_to_rgb888_with_mask_arm2d(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_ccca8888_tile_copy_to_cccn888_with_src_mask((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_mix_mask_opa_arm2d(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_ccca8888_tile_copy_to_cccn888_with_src_mask_and_opacity((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,
dsc->opa);
return LV_RESULT_OK;
}
/**********************
* MACROS
**********************/
#endif /* LV_USE_DRAW_ARM2D_SYNC */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_BLEND_ARM2D_H*/
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,52 @@
/**
* @file lv_draw_sw_blend.h
*
*/
#ifndef LV_DRAW_SW_BLEND_H
#define LV_DRAW_SW_BLEND_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw_mask.h"
#if LV_USE_DRAW_SW
#include "../../../misc/lv_color.h"
#include "../../../misc/lv_area.h"
#include "../../../misc/lv_style.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Call the blend function of the `layer`.
* @param draw_unit pointer to a draw unit
* @param dsc pointer to an initialized blend descriptor
*/
void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t * dsc);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_H*/
@@ -0,0 +1,92 @@
/**
* @file lv_draw_sw_blend_private.h
*
*/
#ifndef LV_DRAW_SW_BLEND_PRIVATE_H
#define LV_DRAW_SW_BLEND_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_sw_blend.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_draw_sw_blend_dsc_t {
const lv_area_t * blend_area; /**< The area with absolute coordinates to draw on `layer->buf`
* will be clipped to `layer->clip_area` */
const void * src_buf; /**< Pointer to an image to blend. If set `fill_color` is ignored */
uint32_t src_stride;
lv_color_format_t src_color_format;
const lv_area_t * src_area;
lv_opa_t opa; /**< The overall opacity*/
lv_color_t color; /**< Fill color*/
const lv_opa_t * mask_buf; /**< NULL if ignored, or an alpha mask to apply on `blend_area`*/
lv_draw_sw_mask_res_t mask_res; /**< The result of the previous mask operation */
const lv_area_t * mask_area; /**< The area of `mask_buf` with absolute coordinates*/
int32_t mask_stride;
lv_blend_mode_t blend_mode; /**< E.g. LV_BLEND_MODE_ADDITIVE*/
};
struct _lv_draw_sw_blend_fill_dsc_t {
void * dest_buf;
int32_t dest_w;
int32_t dest_h;
int32_t dest_stride;
const lv_opa_t * mask_buf;
int32_t mask_stride;
lv_color_t color;
lv_opa_t opa;
lv_area_t relative_area;
};
struct _lv_draw_sw_blend_image_dsc_t {
void * dest_buf;
int32_t dest_w;
int32_t dest_h;
int32_t dest_stride;
const lv_opa_t * mask_buf;
int32_t mask_stride;
const void * src_buf;
int32_t src_stride;
lv_color_format_t src_color_format;
lv_opa_t opa;
lv_blend_mode_t blend_mode;
lv_area_t relative_area; /**< The blend area relative to the layer's buffer area. */
lv_area_t src_area; /**< The original src area. */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_DRAW_SW */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_PRIVATE_H*/
@@ -0,0 +1,45 @@
/**
* @file lv_draw_sw_blend_to_al88.h
*
*/
#ifndef LV_DRAW_SW_BLEND_TO_AL88_H
#define LV_DRAW_SW_BLEND_TO_AL88_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_al88(lv_draw_sw_blend_fill_dsc_t * dsc);
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_al88(lv_draw_sw_blend_image_dsc_t * dsc);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_TO_AL88_H*/
@@ -0,0 +1,45 @@
/**
* @file lv_draw_sw_blend_to_argb8888.h
*
*/
#ifndef LV_DRAW_SW_BLEND_TO_ARGB8888_H
#define LV_DRAW_SW_BLEND_TO_ARGB8888_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_argb8888(lv_draw_sw_blend_fill_dsc_t * dsc);
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_argb8888(lv_draw_sw_blend_image_dsc_t * dsc);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_TO_ARGB8888_H*/
@@ -0,0 +1,45 @@
/**
* @file lv_draw_sw_blend_to_i1.h
*
*/
#ifndef LV_DRAW_SW_BLEND_TO_I1_H
#define LV_DRAW_SW_BLEND_TO_I1_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_i1(lv_draw_sw_blend_fill_dsc_t * dsc);
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_i1(lv_draw_sw_blend_image_dsc_t * dsc);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_TO_I1_H*/
@@ -0,0 +1,45 @@
/**
* @file lv_draw_sw_blend_to_l8.h
*
*/
#ifndef LV_DRAW_SW_BLEND_TO_L8_H
#define LV_DRAW_SW_BLEND_TO_L8_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_l8(lv_draw_sw_blend_fill_dsc_t * dsc);
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_l8(lv_draw_sw_blend_image_dsc_t * dsc);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_TO_L8_H*/
@@ -0,0 +1,45 @@
/**
* @file lv_draw_sw_blend_to_rgb565.h
*
*/
#ifndef LV_DRAW_SW_BLEND_TO_RGB565_H
#define LV_DRAW_SW_BLEND_TO_RGB565_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb565(lv_draw_sw_blend_fill_dsc_t * dsc);
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb565(lv_draw_sw_blend_image_dsc_t * dsc);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_TO_RGB565_H*/
@@ -0,0 +1,47 @@
/**
* @file lv_draw_sw_blend_to_rgb888.h
*
*/
#ifndef LV_DRAW_SW_BLEND_TO_RGB888_H
#define LV_DRAW_SW_BLEND_TO_RGB888_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw_sw.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb888(lv_draw_sw_blend_fill_dsc_t * dsc,
uint32_t dest_px_size);
void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb888(lv_draw_sw_blend_image_dsc_t * dsc,
uint32_t dest_px_size);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_BLEND_TO_RGB888_H*/
File diff suppressed because it is too large. Load diff
+204
View File
@@ -0,0 +1,204 @@
/**
* @file lv_draw_sw.h
*
*/
#ifndef LV_DRAW_SW_H
#define LV_DRAW_SW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_draw.h"
#if LV_USE_DRAW_SW
#include "../../misc/lv_area.h"
#include "../../misc/lv_color.h"
#include "../../display/lv_display.h"
#include "../../osal/lv_os.h"
#include "../lv_draw_vector.h"
#include "../lv_draw_triangle.h"
#include "../lv_draw_label.h"
#include "../lv_draw_image.h"
#include "../lv_draw_line.h"
#include "../lv_draw_arc.h"
/*********************
* DEFINES
*********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Initialize the SW renderer. Called in internally.
* It creates as many SW renderers as defined in LV_DRAW_SW_DRAW_UNIT_CNT
*/
void lv_draw_sw_init(void);
/**
* Deinitialize the SW renderers
*/
void lv_draw_sw_deinit(void);
/**
* Fill an area using SW render. Handle gradient and radius.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
* @param coords the coordinates of the rectangle
*/
void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const lv_area_t * coords);
/**
* Draw border with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
* @param coords the coordinates of the rectangle
*/
void lv_draw_sw_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * dsc, const lv_area_t * coords);
/**
* Draw box shadow with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
* @param coords the coordinates of the rectangle for which the box shadow should be drawn
*/
void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_dsc_t * dsc, const lv_area_t * coords);
/**
* Draw an image with SW render. It handles image decoding, tiling, transformations, and recoloring.
* @param draw_unit pointer to a draw unit
* @param draw_dsc the draw descriptor
* @param coords the coordinates of the image
*/
void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc,
const lv_area_t * coords);
/**
* Draw a label with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
* @param coords the coordinates of the label
*/
void lv_draw_sw_label(lv_draw_unit_t * draw_unit, const lv_draw_label_dsc_t * dsc, const lv_area_t * coords);
/**
* Draw an arc with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
* @param coords the coordinates of the arc
*/
void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, const lv_area_t * coords);
/**
* Draw a line with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
*/
void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc);
/**
* Blend a layer with SW render
* @param draw_unit pointer to a draw unit
* @param draw_dsc the draw descriptor
* @param coords the coordinates of the layer
*/
void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, const lv_area_t * coords);
/**
* Draw a triangle with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
*/
void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_t * dsc);
/**
* Mask out a rectangle with radius from a current layer
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
* @param coords the coordinates of the mask
*/
void lv_draw_sw_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_dsc_t * dsc, const lv_area_t * coords);
/**
* Used internally to get a transformed are of an image
* @param draw_unit pointer to a draw unit
* @param dest_area area to calculate, i.e. get this area from the transformed image
* @param src_buf source buffer
* @param src_w source buffer width in pixels
* @param src_h source buffer height in pixels
* @param src_stride source buffer stride in bytes
* @param draw_dsc draw descriptor
* @param sup supplementary data
* @param cf color format of the source buffer
* @param dest_buf the destination buffer
*/
void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_area, const void * src_buf,
int32_t src_w, int32_t src_h, int32_t src_stride,
const lv_draw_image_dsc_t * draw_dsc, const lv_draw_image_sup_t * sup, lv_color_format_t cf, void * dest_buf);
#if LV_USE_VECTOR_GRAPHIC && LV_USE_THORVG
/**
* Draw vector graphics with SW render.
* @param draw_unit pointer to a draw unit
* @param dsc the draw descriptor
*/
void lv_draw_sw_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc_t * dsc);
#endif
/**
* Swap the upper and lower byte of an RGB565 buffer.
* Might be required if a 8bit parallel port or an SPI port send the bytes in the wrong order.
* The bytes will be swapped in place.
* @param buf pointer to buffer
* @param buf_size_px number of pixels in the buffer
*/
void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px);
/**
* Invert a draw buffer in the I1 color format.
* Conventionally, a bit is set to 1 during blending if the luminance is greater than 127.
* Depending on the display controller used, you might want to have different behavior.
* The inversion will be performed in place.
* @param buf pointer to the buffer to be inverted
* @param buf_size size of the buffer in bytes
*/
void lv_draw_sw_i1_invert(void * buf, uint32_t buf_size);
/**
* Rotate a buffer into another buffer
* @param src the source buffer
* @param dest the destination buffer
* @param src_width source width in pixels
* @param src_height source height in pixels
* @param src_stride source stride in bytes (number of bytes in a row)
* @param dest_stride destination stride in bytes (number of bytes in a row)
* @param rotation LV_DISPLAY_ROTATION_0/90/180/270
* @param color_format LV_COLOR_FORMAT_RGB565/RGB888/XRGB8888/ARGB8888
*/
void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t src_height, int32_t src_stride,
int32_t dest_stride, lv_display_rotation_t rotation, lv_color_format_t color_format);
/***********************
* GLOBAL VARIABLES
***********************/
/**********************
* MACROS
**********************/
#include "blend/lv_draw_sw_blend.h"
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_H*/
@@ -0,0 +1,203 @@
/**
* @file lv_draw_sw_gradient.h
*
*/
#ifndef LV_DRAW_SW_GRADIENT_H
#define LV_DRAW_SW_GRADIENT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../misc/lv_color.h"
#include "../../misc/lv_style.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
#if LV_GRADIENT_MAX_STOPS < 2
#error LVGL needs at least 2 stops for gradients. Please increase the LV_GRADIENT_MAX_STOPS
#endif
#define LV_GRAD_LEFT LV_PCT(0)
#define LV_GRAD_RIGHT LV_PCT(100)
#define LV_GRAD_TOP LV_PCT(0)
#define LV_GRAD_BOTTOM LV_PCT(100)
#define LV_GRAD_CENTER LV_PCT(50)
/**********************
* TYPEDEFS
**********************/
typedef lv_color_t lv_grad_color_t;
/**********************
* PROTOTYPES
**********************/
/** Compute the color in the given gradient and fraction
* Gradient are specified in a virtual [0-255] range, so this function scales the virtual range to the given range
* @param dsc The gradient descriptor to use
* @param range The range to use in computation.
* @param frac The current part used in the range. frac is in [0; range]
* @param color_out Calculated gradient color
* @param opa_out Calculated opacity
*/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_gradient_color_calculate(const lv_grad_dsc_t * dsc, int32_t range,
int32_t frac, lv_grad_color_t * color_out, lv_opa_t * opa_out);
/** Get a gradient cache from the given parameters */
lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * gradient, int32_t w, int32_t h);
/**
* Clean up the gradient item after it was get with `lv_grad_get_from_cache`.
* @param grad pointer to a gradient
*/
void lv_gradient_cleanup(lv_grad_t * grad);
/**
* Initialize gradient color map from a table
* @param grad pointer to a gradient descriptor
* @param colors color array
* @param fracs position array (0..255): if NULL, then colors are distributed evenly
* @param opa opacity array: if NULL, then LV_OPA_COVER is assumed
* @param num_stops number of gradient stops (1..LV_GRADIENT_MAX_STOPS)
*/
void lv_gradient_init_stops(lv_grad_dsc_t * grad, const lv_color_t colors[], const lv_opa_t opa[],
const uint8_t fracs[], int num_stops);
#if LV_USE_DRAW_SW_COMPLEX_GRADIENTS
/**
* Helper function to initialize linear gradient
* @param dsc gradient descriptor
* @param from_x start x position: can be a coordinate or an lv_pct() value
* predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well
* @param from_y start y position
* @param to_x end x position
* @param to_y end y position
* @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT
*/
void lv_grad_linear_init(lv_grad_dsc_t * dsc, int32_t from_x, int32_t from_y, int32_t to_x, int32_t to_y,
lv_grad_extend_t extend);
/**
* Helper function to initialize radial gradient
* @param dsc gradient descriptor
* @param center_x center x position: can be a coordinate or an lv_pct() value
* predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well
* @param center_y center y position
* @param to_x point on the end circle x position
* @param to_y point on the end circle y position
* @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT
*/
void lv_grad_radial_init(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t to_x, int32_t to_y,
lv_grad_extend_t extend);
/**
* Set focal (starting) circle of a radial gradient
* @param dsc gradient descriptor
* @param center_x center x position: can be a coordinate or an lv_pct() value
* predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well
* @param center_y center y position
* @param radius radius of the starting circle (NOTE: this must be a scalar number, not percentage)
*/
void lv_grad_radial_set_focal(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t radius);
/**
* Helper function to initialize conical gradient
* @param dsc gradient descriptor
* @param center_x center x position: can be a coordinate or an lv_pct() value
* predefined constants LV_GRAD_LEFT, LV_GRAD_RIGHT, LV_GRAD_TOP, LV_GRAD_BOTTOM, LV_GRAD_CENTER can be used as well
* @param center_y center y position
* @param start_angle start angle in degrees
* @param end_angle end angle in degrees
* @param extend one of LV_GRAD_EXTEND_PAD, LV_GRAD_EXTEND_REPEAT or LV_GRAD_EXTEND_REFLECT
*/
void lv_grad_conical_init(lv_grad_dsc_t * dsc, int32_t center_x, int32_t center_y, int32_t start_angle,
int32_t end_angle, lv_grad_extend_t extend);
/**
* Calculate constants from the given parameters that are used during rendering
* @param dsc gradient descriptor
*/
void lv_gradient_linear_setup(lv_grad_dsc_t * dsc, const lv_area_t * coords);
/**
* Free up the allocated memory for the gradient calculation
* @param dsc gradient descriptor
*/
void lv_gradient_linear_cleanup(lv_grad_dsc_t * dsc);
/**
* Calculate a line segment of a linear gradient
* @param dsc gradient descriptor
* @param xp starting point x coordinate in gradient space
* @param yp starting point y coordinate in gradient space
* @param width width of the line segment in pixels
* @param result color buffer for the resulting line segment
*/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_gradient_linear_get_line(lv_grad_dsc_t * dsc, int32_t xp, int32_t yp, int32_t width,
lv_grad_t * result);
/**
* Calculate constants from the given parameters that are used during rendering
* @param dsc gradient descriptor
*/
void lv_gradient_radial_setup(lv_grad_dsc_t * dsc, const lv_area_t * coords);
/**
* Free up the allocated memory for the gradient calculation
* @param dsc gradient descriptor
*/
void lv_gradient_radial_cleanup(lv_grad_dsc_t * dsc);
/**
* Calculate a line segment of a radial gradient
* @param dsc gradient descriptor
* @param xp starting point x coordinate in gradient space
* @param yp starting point y coordinate in gradient space
* @param width width of the line segment in pixels
* @param result color buffer for the resulting line segment
*/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_gradient_radial_get_line(lv_grad_dsc_t * dsc, int32_t xp, int32_t yp, int32_t width,
lv_grad_t * result);
/**
* Calculate constants from the given parameters that are used during rendering
* @param dsc gradient descriptor
*/
void lv_gradient_conical_setup(lv_grad_dsc_t * dsc, const lv_area_t * coords);
/**
* Free up the allocated memory for the gradient calculation
* @param dsc gradient descriptor
*/
void lv_gradient_conical_cleanup(lv_grad_dsc_t * dsc);
/**
* Calculate a line segment of a conical gradient
* @param dsc gradient descriptor
* @param xp starting point x coordinate in gradient space
* @param yp starting point y coordinate in gradient space
* @param width width of the line segment in pixels
* @param result color buffer for the resulting line segment
*/
void /* LV_ATTRIBUTE_FAST_MEM */ lv_gradient_conical_get_line(lv_grad_dsc_t * dsc, int32_t xp, int32_t yp,
int32_t width,
lv_grad_t * result);
#endif /*LV_USE_DRAW_SW_COMPLEX_GRADIENTS*/
#endif /*LV_USE_DRAW_SW*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_GRADIENT_H*/
@@ -0,0 +1,50 @@
/**
* @file lv_draw_sw_gradient_private.h
*
*/
#ifndef LV_DRAW_SW_GRADIENT_PRIVATE_H
#define LV_DRAW_SW_GRADIENT_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_sw_gradient.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_grad_t {
lv_color_t * color_map;
lv_opa_t * opa_map;
uint32_t size;
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_DRAW_SW */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_GRADIENT_PRIVATE_H*/
+185
View File
@@ -0,0 +1,185 @@
/**
* @file lv_draw_sw_mask.h
*
*/
#ifndef LV_DRAW_SW_MASK_H
#define LV_DRAW_SW_MASK_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../../misc/lv_area.h"
#include "../../misc/lv_color.h"
#include "../../misc/lv_math.h"
#include "../../misc/lv_types.h"
/*********************
* DEFINES
*********************/
#define LV_MASK_ID_INV (-1)
#if LV_DRAW_SW_COMPLEX
# define LV_MASK_MAX_NUM 16
#else
# define LV_MASK_MAX_NUM 1
#endif
/**********************
* TYPEDEFS
**********************/
typedef enum {
LV_DRAW_SW_MASK_RES_TRANSP,
LV_DRAW_SW_MASK_RES_FULL_COVER,
LV_DRAW_SW_MASK_RES_CHANGED,
LV_DRAW_SW_MASK_RES_UNKNOWN
} lv_draw_sw_mask_res_t;
#if LV_DRAW_SW_COMPLEX
typedef enum {
LV_DRAW_SW_MASK_TYPE_LINE,
LV_DRAW_SW_MASK_TYPE_ANGLE,
LV_DRAW_SW_MASK_TYPE_RADIUS,
LV_DRAW_SW_MASK_TYPE_FADE,
LV_DRAW_SW_MASK_TYPE_MAP,
} lv_draw_sw_mask_type_t;
typedef enum {
LV_DRAW_SW_MASK_LINE_SIDE_LEFT = 0,
LV_DRAW_SW_MASK_LINE_SIDE_RIGHT,
LV_DRAW_SW_MASK_LINE_SIDE_TOP,
LV_DRAW_SW_MASK_LINE_SIDE_BOTTOM,
} lv_draw_sw_mask_line_side_t;
/**
* A common callback type for every mask type.
* Used internally by the library.
*/
typedef lv_draw_sw_mask_res_t (*lv_draw_sw_mask_xcb_t)(lv_opa_t * mask_buf, int32_t abs_x, int32_t abs_y,
int32_t len,
void * p);
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_draw_sw_mask_init(void);
void lv_draw_sw_mask_deinit(void);
//! @cond Doxygen_Suppress
/**
* Apply the added buffers on a line. Used internally by the library's drawing routines.
* @param masks the masks list to apply, must be ended with NULL pointer in array.
* @param mask_buf store the result mask here. Has to be `len` byte long. Should be initialized with `0xFF`.
* @param abs_x absolute X coordinate where the line to calculate start
* @param abs_y absolute Y coordinate where the line to calculate start
* @param len length of the line to calculate (in pixel count)
* @return One of these values:
* - `LV_DRAW_MASK_RES_FULL_TRANSP`: the whole line is transparent. `mask_buf` is not set to zero
* - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged
* - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line
*/
lv_draw_sw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_mask_apply(void * masks[], lv_opa_t * mask_buf,
int32_t abs_x,
int32_t abs_y,
int32_t len);
//! @endcond
/**
* Free the data from the parameter.
* It's called inside `lv_draw_sw_mask_remove_id` and `lv_draw_sw_mask_remove_custom`
* Needs to be called only in special cases when the mask is not added by `lv_draw_mask_add`
* and not removed by `lv_draw_mask_remove_id` or `lv_draw_mask_remove_custom`
* @param p pointer to a mask parameter
*/
void lv_draw_sw_mask_free_param(void * p);
/**
*Initialize a line mask from two points.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param p1x X coordinate of the first point of the line
* @param p1y Y coordinate of the first point of the line
* @param p2x X coordinate of the second point of the line
* @param p2y y coordinate of the second point of the line
* @param side and element of `lv_draw_mask_line_side_t` to describe which side to keep.
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
* With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept
*/
void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, int32_t p1x, int32_t p1y,
int32_t p2x,
int32_t p2y, lv_draw_sw_mask_line_side_t side);
/**
*Initialize a line mask from a point and an angle.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param px X coordinate of a point of the line
* @param py X coordinate of a point of the line
* @param angle right 0 deg, bottom: 90
* @param side an element of `lv_draw_mask_line_side_t` to describe which side to keep.
* With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept
* With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept
*/
void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, int32_t px, int32_t py, int16_t angle,
lv_draw_sw_mask_line_side_t side);
/**
* Initialize an angle mask.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param vertex_x X coordinate of the angle vertex (absolute coordinates)
* @param vertex_y Y coordinate of the angle vertex (absolute coordinates)
* @param start_angle start angle in degrees. 0 deg on the right, 90 deg, on the bottom
* @param end_angle end angle
*/
void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, int32_t vertex_x, int32_t vertex_y,
int32_t start_angle, int32_t end_angle);
/**
* Initialize a fade mask.
* @param param pointer to an `lv_draw_mask_radius_param_t` to initialize
* @param rect coordinates of the rectangle to affect (absolute coordinates)
* @param radius radius of the rectangle
* @param inv true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle
*/
void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const lv_area_t * rect, int32_t radius,
bool inv);
/**
* Initialize a fade mask.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param coords coordinates of the area to affect (absolute coordinates)
* @param opa_top opacity on the top
* @param y_top at which coordinate start to change to opacity to `opa_bottom`
* @param opa_bottom opacity at the bottom
* @param y_bottom at which coordinate reach `opa_bottom`.
*/
void lv_draw_sw_mask_fade_init(lv_draw_sw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top,
int32_t y_top,
lv_opa_t opa_bottom, int32_t y_bottom);
/**
* Initialize a map mask.
* @param param pointer to a `lv_draw_mask_param_t` to initialize
* @param coords coordinates of the map (absolute coordinates)
* @param map array of bytes with the mask values
*/
void lv_draw_sw_mask_map_init(lv_draw_sw_mask_map_param_t * param, const lv_area_t * coords, const lv_opa_t * map);
#endif /*LV_DRAW_SW_COMPLEX*/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_MASK_H*/
@@ -0,0 +1,157 @@
/**
* @file lv_draw_sw_mask_private.h
*
*/
#ifndef LV_DRAW_SW_MASK_PRIVATE_H
#define LV_DRAW_SW_MASK_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_sw_mask.h"
#if LV_DRAW_SW_COMPLEX
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
uint8_t * buf;
lv_opa_t * cir_opa; /**< Opacity of values on the circumference of an 1/4 circle */
uint16_t * x_start_on_y; /**< The x coordinate of the circle for each y value */
uint16_t * opa_start_on_y; /**< The index of `cir_opa` for each y value */
int32_t life; /**< How many times the entry way used */
uint32_t used_cnt; /**< Like a semaphore to count the referencing masks */
int32_t radius; /**< The radius of the entry */
} lv_draw_sw_mask_radius_circle_dsc_t;
struct _lv_draw_sw_mask_common_dsc_t {
lv_draw_sw_mask_xcb_t cb;
lv_draw_sw_mask_type_t type;
};
struct _lv_draw_sw_mask_line_param_t {
/** The first element must be the common descriptor */
lv_draw_sw_mask_common_dsc_t dsc;
struct {
/*First point*/
lv_point_t p1;
/*Second point*/
lv_point_t p2;
/*Which side to keep?*/
lv_draw_sw_mask_line_side_t side : 2;
} cfg;
/** A point of the line */
lv_point_t origo;
/** X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y? */
int32_t xy_steep;
/** Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X? */
int32_t yx_steep;
/** Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines */
int32_t steep;
/** Steepness in 1 px in 0..255 range. Used only by flat lines. */
int32_t spx;
/** 1: It's a flat line? (Near to horizontal) */
uint8_t flat : 1;
/** Invert the mask. The default is: Keep the left part.
*It is used to select left/right/top/bottom */
uint8_t inv: 1;
};
struct _lv_draw_sw_mask_angle_param_t {
/** The first element must be the common descriptor */
lv_draw_sw_mask_common_dsc_t dsc;
struct {
lv_point_t vertex_p;
int32_t start_angle;
int32_t end_angle;
} cfg;
lv_draw_sw_mask_line_param_t start_line;
lv_draw_sw_mask_line_param_t end_line;
uint16_t delta_deg;
};
struct _lv_draw_sw_mask_radius_param_t {
/** The first element must be the common descriptor */
lv_draw_sw_mask_common_dsc_t dsc;
struct {
lv_area_t rect;
int32_t radius;
/** Invert the mask. 0: Keep the pixels inside. */
uint8_t outer: 1;
} cfg;
lv_draw_sw_mask_radius_circle_dsc_t * circle;
};
struct _lv_draw_sw_mask_fade_param_t {
/** The first element must be the common descriptor */
lv_draw_sw_mask_common_dsc_t dsc;
struct {
lv_area_t coords;
int32_t y_top;
int32_t y_bottom;
lv_opa_t opa_top;
lv_opa_t opa_bottom;
} cfg;
};
struct _lv_draw_sw_mask_map_param_t {
/** The first element must be the common descriptor */
lv_draw_sw_mask_common_dsc_t dsc;
struct {
lv_area_t coords;
const lv_opa_t * map;
} cfg;
};
typedef lv_draw_sw_mask_radius_circle_dsc_t lv_draw_sw_mask_radius_circle_dsc_arr_t[LV_DRAW_SW_CIRCLE_CACHE_SIZE];
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Called by LVGL the rendering of a screen is ready to clean up
* the temporal (cache) data of the masks
*/
void lv_draw_sw_mask_cleanup(void);
/**********************
* MACROS
**********************/
#endif /*LV_DRAW_SW_COMPLEX*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_MASK_PRIVATE_H*/
@@ -0,0 +1,68 @@
/**
* @file lv_draw_sw_private.h
*
*/
#ifndef LV_DRAW_SW_PRIVATE_H
#define LV_DRAW_SW_PRIVATE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "lv_draw_sw.h"
#include "../lv_draw_private.h"
#if LV_USE_DRAW_SW
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* TYPEDEFS
**********************/
struct _lv_draw_sw_unit_t {
lv_draw_unit_t base_unit;
lv_draw_task_t * task_act;
#if LV_USE_OS
lv_thread_sync_t sync;
lv_thread_t thread;
volatile bool inited;
volatile bool exit_status;
#endif
uint32_t idx;
};
#if LV_DRAW_SW_SHADOW_CACHE_SIZE
typedef struct {
uint8_t cache[LV_DRAW_SW_SHADOW_CACHE_SIZE * LV_DRAW_SW_SHADOW_CACHE_SIZE];
int32_t cache_size;
int32_t cache_r;
} lv_draw_sw_shadow_cache_t;
#endif
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#endif /* LV_USE_DRAW_SW */
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif /*LV_DRAW_SW_PRIVATE_H*/