mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
draw_img: blend argb images directly with DMA2D in trivial cases
This commit is contained in:
parent
6f87d29ac7
commit
23368fa704
@ -655,7 +655,7 @@ static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
int32_t map_w = lv_area_get_width(map_area);
|
||||
|
||||
/*Create a temp. disp_buf which always point to first pixel to draw*/
|
||||
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area->y1 + draw_area->x1;;
|
||||
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area->y1 + draw_area->x1;
|
||||
|
||||
/*Create a temp. map_buf which always point to first pixel to draw from the map*/
|
||||
const lv_color_t * map_buf_first = map_buf + map_w * (draw_area->y1 - (map_area->y1 - disp_area->y1));
|
||||
@ -687,7 +687,7 @@ static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
if(opa > LV_OPA_MAX) {
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_blend_normal_cover(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h);
|
||||
lv_gpu_stm32_dma2d_copy(disp_buf_first, disp_w, map_buf_first, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -702,7 +702,7 @@ static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
else {
|
||||
#if LV_USE_GPU_STM32_DMA2D
|
||||
if(lv_area_get_size(draw_area) >= 240) {
|
||||
lv_gpu_stm32_dma2d_blend_normal_opa(disp_buf_first, disp_w, map_buf_first, opa, map_w, draw_area_w, draw_area_h);
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, map_buf_first, opa, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_math.h"
|
||||
#include "../lv_gpu/lv_gpu_stm32_dma2d.h"
|
||||
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@ -395,6 +397,16 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
|
||||
|
||||
/*Simple ARGB image. Handle it as special case because it's very common*/
|
||||
if(other_mask_cnt == 0 && !transform && !chroma_key && draw_dsc->recolor_opa == LV_OPA_TRANSP && alpha_byte) {
|
||||
#if LV_USE_GPU_STM32_DMA2D && LV_COLOR_DEPTH == 32
|
||||
/*Blend ARGB images directly*/
|
||||
if(lv_area_get_size(draw_area) > 240) {
|
||||
int32_t disp_w = lv_area_get_width(disp_area);
|
||||
lv_color_t * disp_buf = vdb->buf_act;
|
||||
lv_color_t * disp_buf_first = disp_buf + disp_w * draw_area.y1 + draw_area.x1;
|
||||
lv_gpu_stm32_dma2d_blend(disp_buf_first, disp_w, (const lv_color_t *)map_buf_tmp, draw_dsc->opa, map_w, draw_area_w, draw_area_h);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
for(y = 0; y < draw_area_h; y++) {
|
||||
|
@ -101,7 +101,7 @@ void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t
|
||||
HAL_DMA2D_PollForTransfer(&hdma2d, HAL_MAX_DELAY);
|
||||
}
|
||||
|
||||
void lv_gpu_stm32_dma2d_blend_normal_cover(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
{
|
||||
#if __DCACHE_PRESENT
|
||||
SCB_CleanInvalidateDCache();
|
||||
@ -128,7 +128,7 @@ void lv_gpu_stm32_dma2d_blend_normal_cover(lv_color_t * buf, lv_coord_t buf_w, c
|
||||
}
|
||||
}
|
||||
|
||||
void lv_gpu_stm32_dma2d_blend_normal_opa(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h)
|
||||
{
|
||||
#if __DCACHE_PRESENT
|
||||
SCB_CleanInvalidateDCache();
|
||||
@ -145,7 +145,7 @@ void lv_gpu_stm32_dma2d_blend_normal_opa(lv_color_t * buf, lv_coord_t buf_w, con
|
||||
hdma2d.LayerCfg[0].AlphaInverted = DMA2D_REGULAR_ALPHA;
|
||||
|
||||
/* Foreground layer */
|
||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_REPLACE_ALPHA;
|
||||
hdma2d.LayerCfg[1].AlphaMode = DMA2D_COMBINE_ALPHA;
|
||||
hdma2d.LayerCfg[1].InputAlpha = opa;
|
||||
hdma2d.LayerCfg[1].InputColorMode = DMA2D_INPUT_FORMAT;
|
||||
hdma2d.LayerCfg[1].InputOffset = map_w - copy_w;
|
||||
@ -160,6 +160,7 @@ void lv_gpu_stm32_dma2d_blend_normal_opa(lv_color_t * buf, lv_coord_t buf_w, con
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
@ -28,8 +28,8 @@ extern "C" {
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
void lv_gpu_stm32_dma2d_fill(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
void lv_gpu_stm32_dma2d_blend_normal_cover(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_blend_normal_opa(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_copy(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_blend(lv_color_t * buf, lv_coord_t buf_w, const lv_color_t * map, lv_opa_t opa, lv_coord_t map_w, lv_coord_t copy_w, lv_coord_t copy_h);
|
||||
void lv_gpu_stm32_dma2d_fill_mask(lv_color_t * buf, lv_coord_t buf_w, lv_color_t color, const lv_opa_t * mask, lv_opa_t opa, lv_coord_t fill_w, lv_coord_t fill_h);
|
||||
|
||||
/**********************
|
||||
|
Loading…
x
Reference in New Issue
Block a user