fix(draw_sw): in ARGB8888_PREMULTIPLIED fix rounding error and add RGB888 image blending support (#8264)
@@ -41,6 +41,11 @@ typedef struct {
|
||||
static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
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_premultiplied_image_blend(lv_draw_sw_blend_image_dsc_t * dsc);
|
||||
|
||||
static inline void /* LV_ATTRIBUTE_FAST_MEM */ blend_non_normal_pixel_premultiplied(
|
||||
@@ -77,6 +82,23 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b
|
||||
#define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_MIX_MASK_OPA(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED
|
||||
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_WITH_OPA
|
||||
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_WITH_OPA(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_WITH_MASK
|
||||
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_WITH_MASK(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
#ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_MIX_MASK_OPA
|
||||
#define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_MIX_MASK_OPA(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef LV_DRAW_SW_ARGB8888_PREMULTIPLIED_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED
|
||||
#define LV_DRAW_SW_ARGB8888_PREMULTIPLIED_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED(...) LV_RESULT_INVALID
|
||||
#endif
|
||||
@@ -121,11 +143,18 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888_premultiplied(lv_d
|
||||
int32_t y;
|
||||
|
||||
/* Convert source color to premultiplied */
|
||||
if(opa >= LV_OPA_MAX) opa = 0xff;
|
||||
lv_color32_t color_argb = lv_color_to_32(dsc->color, opa);
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
|
||||
lv_color32_t color_argb_premul;
|
||||
if(opa == 0xff) {
|
||||
color_argb_premul = color_argb;
|
||||
}
|
||||
else {
|
||||
color_argb_premul.alpha = opa;
|
||||
color_argb_premul.red = (color_argb.red * opa) >> 8;
|
||||
color_argb_premul.green = (color_argb.green * opa) >> 8;
|
||||
color_argb_premul.blue = (color_argb.blue * opa) >> 8;
|
||||
}
|
||||
|
||||
/* Simple fill */
|
||||
if(mask == NULL && opa >= LV_OPA_MAX) {
|
||||
@@ -144,7 +173,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888_premultiplied(lv_d
|
||||
lv_color32_t * dest_buf = dsc->dest_buf;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_argb, dest_buf[x], &cache);
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_argb_premul, dest_buf[x], &cache);
|
||||
}
|
||||
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
|
||||
}
|
||||
@@ -155,11 +184,16 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888_premultiplied(lv_d
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
lv_color32_t color_premul = color_argb;
|
||||
color_premul.alpha = mask[x];
|
||||
color_premul.red = (color_premul.red * color_premul.alpha) >> 8;
|
||||
color_premul.green = (color_premul.green * color_premul.alpha) >> 8;
|
||||
color_premul.blue = (color_premul.blue * color_premul.alpha) >> 8;
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_premul, dest_buf[x], &cache);
|
||||
if(mask[x] >= LV_OPA_MAX) {
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_premul, dest_buf[x], &cache);
|
||||
}
|
||||
else if(mask[x] > LV_OPA_MIN) {
|
||||
color_premul.alpha = mask[x];
|
||||
color_premul.red = (color_premul.red * color_premul.alpha) >> 8;
|
||||
color_premul.green = (color_premul.green * color_premul.alpha) >> 8;
|
||||
color_premul.blue = (color_premul.blue * color_premul.alpha) >> 8;
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_premul, dest_buf[x], &cache);
|
||||
}
|
||||
}
|
||||
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
|
||||
mask += mask_stride;
|
||||
@@ -171,11 +205,17 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888_premultiplied(lv_d
|
||||
for(y = 0; y < h; y++) {
|
||||
for(x = 0; x < w; x++) {
|
||||
lv_color32_t color_premul = color_argb;
|
||||
color_premul.alpha = LV_OPA_MIX2(mask[x], opa);
|
||||
color_premul.red = (color_premul.red * color_premul.alpha) >> 8;
|
||||
color_premul.green = (color_premul.green * color_premul.alpha) >> 8;
|
||||
color_premul.blue = (color_premul.blue * color_premul.alpha) >> 8;
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_premul, dest_buf[x], &cache);
|
||||
lv_opa_t alpha = LV_OPA_MIX2(mask[x], opa);
|
||||
if(alpha >= LV_OPA_MAX) {
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_premul, dest_buf[x], &cache);
|
||||
}
|
||||
else if(mask[x] > LV_OPA_MIN) {
|
||||
color_premul.alpha = alpha;
|
||||
color_premul.red = (color_premul.red * color_premul.alpha) >> 8;
|
||||
color_premul.green = (color_premul.green * color_premul.alpha) >> 8;
|
||||
color_premul.blue = (color_premul.blue * color_premul.alpha) >> 8;
|
||||
dest_buf[x] = lv_color_32_32_mix_premul(color_premul, dest_buf[x], &cache);
|
||||
}
|
||||
}
|
||||
dest_buf = drawbuf_next_row(dest_buf, dest_stride);
|
||||
mask += mask_stride;
|
||||
@@ -199,6 +239,19 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888_premultiplied(lv_d
|
||||
argb8888_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_PREMULTIPLIED:
|
||||
argb8888_premultiplied_image_blend(dsc);
|
||||
break;
|
||||
@@ -240,12 +293,23 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_ds
|
||||
for(x = 0; x < w; x++) {
|
||||
color_argb = src_buf_c32[x];
|
||||
|
||||
/* Premultiply alpha */
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
if(color_argb.alpha >= LV_OPA_MAX) {
|
||||
color_argb.alpha = 0xff;
|
||||
dest_buf_c32[x] = color_argb;
|
||||
}
|
||||
else if(color_argb.alpha > LV_OPA_MIN) {
|
||||
/*Premultiplication can cause loss of precision which can result slightly
|
||||
*darker color when blending the same color to the background.*/
|
||||
if(dest_buf_c32[x].red != color_argb.red ||
|
||||
dest_buf_c32[x].green != color_argb.green ||
|
||||
dest_buf_c32[x].blue != color_argb.blue) {
|
||||
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
|
||||
@@ -259,14 +323,25 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_ds
|
||||
color_argb = src_buf_c32[x];
|
||||
|
||||
/* Apply global opacity */
|
||||
color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, opa);
|
||||
lv_opa_t alpha = LV_OPA_MIX2(color_argb.alpha, opa);
|
||||
|
||||
/* Premultiply alpha */
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
if(alpha >= LV_OPA_MAX) {
|
||||
color_argb.alpha = 0xff;
|
||||
dest_buf_c32[x] = color_argb;
|
||||
}
|
||||
else if(alpha > LV_OPA_MIN) {
|
||||
/*Premultiplication can cause loss of precision which can result slightly
|
||||
*darker color when blending the same color to the background.*/
|
||||
if(dest_buf_c32[x].red != color_argb.red ||
|
||||
dest_buf_c32[x].green != color_argb.green ||
|
||||
dest_buf_c32[x].blue != color_argb.blue) {
|
||||
color_argb.alpha = alpha;
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
|
||||
@@ -280,14 +355,25 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_ds
|
||||
color_argb = src_buf_c32[x];
|
||||
|
||||
/* Apply mask opacity */
|
||||
color_argb.alpha = LV_OPA_MIX2(color_argb.alpha, mask_buf[x]);
|
||||
lv_opa_t alpha = LV_OPA_MIX2(color_argb.alpha, mask_buf[x]);
|
||||
|
||||
/* Premultiply alpha */
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
if(alpha >= LV_OPA_MAX) {
|
||||
color_argb.alpha = 0xff;
|
||||
dest_buf_c32[x] = color_argb;
|
||||
}
|
||||
else if(alpha > LV_OPA_MIN) {
|
||||
/*Premultiplication can cause loss of precision which can result slightly
|
||||
*darker color when blending the same color to the background.*/
|
||||
if(dest_buf_c32[x].red != color_argb.red ||
|
||||
dest_buf_c32[x].green != color_argb.green ||
|
||||
dest_buf_c32[x].blue != color_argb.blue) {
|
||||
color_argb.alpha = alpha;
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
|
||||
@@ -302,14 +388,25 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_ds
|
||||
color_argb = src_buf_c32[x];
|
||||
|
||||
/* Apply both mask and global opacity */
|
||||
color_argb.alpha = LV_OPA_MIX3(color_argb.alpha, opa, mask_buf[x]);
|
||||
lv_opa_t alpha = LV_OPA_MIX3(color_argb.alpha, opa, mask_buf[x]);
|
||||
|
||||
/* Premultiply alpha */
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
if(alpha >= LV_OPA_MAX) {
|
||||
color_argb.alpha = 0xff;
|
||||
dest_buf_c32[x] = color_argb;
|
||||
}
|
||||
else if(alpha > LV_OPA_MIN) {
|
||||
/*Premultiplication can cause loss of precision which can result slightly
|
||||
*darker color when blending the same color to the background.*/
|
||||
if(dest_buf_c32[x].red != color_argb.red ||
|
||||
dest_buf_c32[x].green != color_argb.green ||
|
||||
dest_buf_c32[x].blue != color_argb.blue) {
|
||||
color_argb.alpha = alpha;
|
||||
color_argb.red = (color_argb.red * color_argb.alpha) >> 8;
|
||||
color_argb.green = (color_argb.green * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (color_argb.blue * color_argb.alpha) >> 8;
|
||||
dest_buf_c32[x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[x], &cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf_c32 = drawbuf_next_row(src_buf_c32, src_stride);
|
||||
@@ -345,6 +442,128 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_ds
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_DRAW_SW_SUPPORT_RGB888 || LV_DRAW_SW_SUPPORT_XRGB8888
|
||||
|
||||
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;
|
||||
int32_t h = dsc->dest_h;
|
||||
lv_opa_t opa = dsc->opa;
|
||||
lv_color32_t * dest_buf_c32 = dsc->dest_buf;
|
||||
int32_t dest_stride = dsc->dest_stride;
|
||||
const uint8_t * src_buf = dsc->src_buf;
|
||||
int32_t src_stride = dsc->src_stride;
|
||||
const lv_opa_t * mask_buf = dsc->mask_buf;
|
||||
int32_t mask_stride = dsc->mask_stride;
|
||||
|
||||
lv_color32_t color_argb;
|
||||
lv_color_mix_alpha_cache_t cache;
|
||||
lv_color_mix_with_alpha_cache_init(&cache);
|
||||
|
||||
int32_t dest_x;
|
||||
int32_t src_x;
|
||||
int32_t y;
|
||||
|
||||
LV_UNUSED(color_argb);
|
||||
|
||||
if(dsc->blend_mode == LV_BLEND_MODE_NORMAL) {
|
||||
/*Special case*/
|
||||
if(mask_buf == NULL && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED(dsc, src_px_size)) {
|
||||
if(src_px_size == 4) {
|
||||
uint32_t line_in_bytes = w * 4;
|
||||
for(y = 0; y < h; y++) {
|
||||
lv_memcpy(dest_buf_c32, src_buf, line_in_bytes);
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf = drawbuf_next_row(src_buf, src_stride);
|
||||
}
|
||||
}
|
||||
else if(src_px_size == 3) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += 3) {
|
||||
dest_buf_c32[dest_x].red = src_buf[src_x + 2];
|
||||
dest_buf_c32[dest_x].green = src_buf[src_x + 1];
|
||||
dest_buf_c32[dest_x].blue = src_buf[src_x + 0];
|
||||
dest_buf_c32[dest_x].alpha = 0xff;
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf = drawbuf_next_row(src_buf, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mask_buf == NULL && opa < LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_WITH_OPA(dsc, src_px_size)) {
|
||||
color_argb.alpha = opa;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
|
||||
color_argb.red = (src_buf[src_x + 2] * color_argb.alpha) >> 8;
|
||||
color_argb.green = (src_buf[src_x + 1] * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (src_buf[src_x + 0] * color_argb.alpha) >> 8;
|
||||
dest_buf_c32[dest_x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[dest_x], &cache);
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf = drawbuf_next_row(src_buf, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mask_buf && opa >= LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_WITH_MASK(dsc, src_px_size)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
|
||||
color_argb.alpha = mask_buf[dest_x];
|
||||
color_argb.red = (src_buf[src_x + 2] * color_argb.alpha) >> 8;
|
||||
color_argb.green = (src_buf[src_x + 1] * color_argb.alpha) >> 8;
|
||||
color_argb.blue = (src_buf[src_x + 0] * color_argb.alpha) >> 8;
|
||||
dest_buf_c32[dest_x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[dest_x], &cache);
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf = drawbuf_next_row(src_buf, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mask_buf && opa < LV_OPA_MAX) {
|
||||
if(LV_RESULT_INVALID == LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_PREMULTIPLIED_MIX_MASK_OPA(dsc, src_px_size)) {
|
||||
for(y = 0; y < h; y++) {
|
||||
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
|
||||
color_argb.alpha = (opa * mask_buf[dest_x]) >> 8;
|
||||
color_argb.red = (src_buf[src_x + 2] * color_argb.alpha) >> 8;;
|
||||
color_argb.green = (src_buf[src_x + 1] * color_argb.alpha) >> 8;;
|
||||
color_argb.blue = (src_buf[src_x + 0] * color_argb.alpha) >> 8;;
|
||||
dest_buf_c32[dest_x] = lv_color_32_32_mix_premul(color_argb, dest_buf_c32[dest_x], &cache);
|
||||
}
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf = drawbuf_next_row(src_buf, src_stride);
|
||||
mask_buf += mask_stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lv_color32_t src_argb;
|
||||
for(y = 0; y < h; y++) {
|
||||
for(dest_x = 0, src_x = 0; dest_x < w; dest_x++, src_x += src_px_size) {
|
||||
src_argb.red = src_buf[src_x + 2];
|
||||
src_argb.green = src_buf[src_x + 1];
|
||||
src_argb.blue = src_buf[src_x + 0];
|
||||
if(mask_buf == NULL) src_argb.alpha = opa;
|
||||
else src_argb.alpha = LV_OPA_MIX2(mask_buf[dest_x], opa);
|
||||
|
||||
blend_non_normal_pixel_premultiplied(&dest_buf_c32[dest_x], src_argb, dsc->blend_mode, &cache);
|
||||
}
|
||||
|
||||
if(mask_buf) mask_buf += mask_stride;
|
||||
dest_buf_c32 = drawbuf_next_row(dest_buf_c32, dest_stride);
|
||||
src_buf = drawbuf_next_row(src_buf, src_stride);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static void LV_ATTRIBUTE_FAST_MEM argb8888_premultiplied_image_blend(lv_draw_sw_blend_image_dsc_t * dsc)
|
||||
{
|
||||
int32_t w = dsc->dest_w;
|
||||
|
||||
@@ -73,7 +73,6 @@ lv_color32_t lv_color_mix32_premultiplied(lv_color32_t fg, lv_color32_t bg)
|
||||
bg.red = fg.red + ((bg.red * inv_fg_alpha) >> 8);
|
||||
bg.green = fg.green + ((bg.green * inv_fg_alpha) >> 8);
|
||||
bg.blue = fg.blue + ((bg.blue * inv_fg_alpha) >> 8);
|
||||
bg.alpha = fg.alpha + ((bg.alpha * inv_fg_alpha) >> 8);
|
||||
|
||||
return bg;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 54 KiB |
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 60 KiB After Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 58 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 24 KiB |