evas: fix Evas Map AA changes the alpha flag of an image issue.

Evas map supports anti-alias(aa) rendering on sw backened.
When aa is toggled on, map forcely turns alpha channel on while it draws on the surface.
Actually, it was intended to blend polygon edges with destination,
but it breaks one case if the original source image alpha channel were turned off.

Simply, it fixed the issue, new implmentation removes the alpha channel switching,
instead fill the alpha values with 255 when map + aa + alpha_off is drawing on it.

@fix T1975
This commit is contained in:
Hermet Park 2018-04-03 19:23:52 +09:00
parent 224049fa18
commit 63b6d9c17f
3 changed files with 30 additions and 15 deletions

View File

@ -111,7 +111,7 @@
}
static inline DATA32
_aa_coverage_apply(Line *line, int ww, int w, DATA32 val)
_aa_coverage_apply(Line *line, int ww, int w, DATA32 val, Eina_Bool src_alpha)
{
//Left Edge Anti Anliasing
if ((w - line->aa_len[0]) < ww)
@ -124,6 +124,13 @@ _aa_coverage_apply(Line *line, int ww, int w, DATA32 val)
return MUL_256(256 - (line->aa_cov[1] * (line->aa_len[1] - ww + 1)),
val);
}
//Remove Transparency if src image alpha is off.
if (!src_alpha)
{
if (((val & 0xff000000) >> 24) < 0xff)
return (val | 0xff000000);
}
return val;
}

View File

@ -15,6 +15,7 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
RGBA_Gfx_Func func = NULL, func2 = NULL;
Eina_Bool havea = EINA_FALSE;
Eina_Bool sa, ssa, da;
Eina_Bool saa; //Source alpha overriding with anti-alias flag.
int havecol = 4;
cx = clip_x;
@ -102,21 +103,24 @@ FUNC_NAME(RGBA_Image *src, RGBA_Image *dst,
else
{
buf = alloca(cw * sizeof(DATA32));
if (havea) sa = 1;
if (havea) sa = EINA_TRUE;
saa = (anti_alias | sa);
if (!mask_ie)
{
if (mul_col != 0xffffffff)
func = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, mul_col, da, cw, render_op);
func = evas_common_gfx_func_composite_pixel_color_span_get(saa, ssa, mul_col, da, cw, render_op);
else
func = evas_common_gfx_func_composite_pixel_span_get(sa, ssa, da, cw, render_op);
func = evas_common_gfx_func_composite_pixel_span_get(saa, ssa, da, cw, render_op);
}
else
{
func = evas_common_gfx_func_composite_pixel_mask_span_get(sa, ssa, da, cw, render_op);
func = evas_common_gfx_func_composite_pixel_mask_span_get(saa, ssa, da, cw, render_op);
if (mul_col != 0xffffffff)
func2 = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, mul_col, da, cw, EVAS_RENDER_COPY);
func2 = evas_common_gfx_func_composite_pixel_color_span_get(saa, ssa, mul_col, da, cw, EVAS_RENDER_COPY);
}
if (sa || anti_alias) src->cache_entry.flags.alpha = EINA_TRUE;
if (sa) src->cache_entry.flags.alpha = EINA_TRUE;
}
if (havecol == 0)
{
@ -145,6 +149,7 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
int havecol;
int i;
Eina_Bool sa, ssa, da;
Eina_Bool saa; //Source alpha overriding with anti-alias flag.
RGBA_Image *mask_ie = dc->clip.mask;
int mask_x = dc->clip.mask_x;
@ -184,21 +189,24 @@ FUNC_NAME_DO(RGBA_Image *src, RGBA_Image *dst,
if (!direct)
{
buf = alloca(cw * sizeof(DATA32));
if (ms->havea) sa = 1;
if (ms->havea) sa = EINA_TRUE;
saa = (anti_alias | sa);
if (!mask_ie)
{
if (mul_col != 0xffffffff)
func = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, dc->mul.col, da, cw, dc->render_op);
func = evas_common_gfx_func_composite_pixel_color_span_get(saa, ssa, dc->mul.col, da, cw, dc->render_op);
else
func = evas_common_gfx_func_composite_pixel_span_get(sa, ssa, da, cw, dc->render_op);
func = evas_common_gfx_func_composite_pixel_span_get(saa, ssa, da, cw, dc->render_op);
}
else
{
func = evas_common_gfx_func_composite_pixel_mask_span_get(sa, ssa, da, cw, dc->render_op);
func = evas_common_gfx_func_composite_pixel_mask_span_get(saa, ssa, da, cw, dc->render_op);
if (mul_col != 0xffffffff)
func2 = evas_common_gfx_func_composite_pixel_color_span_get(sa, ssa, dc->mul.col, da, cw, EVAS_RENDER_COPY);
func2 = evas_common_gfx_func_composite_pixel_color_span_get(saa, ssa, dc->mul.col, da, cw, EVAS_RENDER_COPY);
}
if (sa || anti_alias) src->cache_entry.flags.alpha = EINA_TRUE;
if (sa) src->cache_entry.flags.alpha = EINA_TRUE;
}
if (havecol == 0)

View File

@ -237,7 +237,7 @@
u += ud;
v += vd;
# endif //COLBLACK
if (anti_alias) *d = _aa_coverage_apply(line, ww, w, *d);
if (anti_alias) *d = _aa_coverage_apply(line, ww, w, *d, sa);
d++;
ww--;
}
@ -359,7 +359,7 @@
u += ud;
v += vd;
# endif //COLBLACK
if (anti_alias) *d = _aa_coverage_apply(line, ww, w, *d);
if (anti_alias) *d = _aa_coverage_apply(line, ww, w, *d, sa);
d++;
ww--;
}