aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-06-12 15:44:31 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-12 16:53:14 +0900
commit8b897144ac1c61da0d30c747a2d77928d6e238ff (patch)
tree038bbb619bd4474b1750f91328070d7fba52a000
parentedje: Remove unused variable (diff)
downloadefl-8b897144ac1c61da0d30c747a2d77928d6e238ff.tar.gz
Evas filters: Fix blend with color with rgba buffers
- blend { color = red } - blur { color = red } were not working with RGBA input. This patch fixes that. @fix
-rw-r--r--src/lib/evas/filters/evas_filter.c3
-rw-r--r--src/lib/evas/filters/evas_filter_blend.c14
2 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index 894f0fd172..36bedbb19f 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -927,7 +927,8 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
ERR("Output and input don't have the same format");
goto fail;
}
- else if (blend || (in->alpha_only && !out->alpha_only))
+ else if ((blend || (in->alpha_only && !out->alpha_only)) ||
+ (!blend && !in->alpha_only && !out->alpha_only && (color != 0xFFFFFFFF)))
{
DBG("Adding extra blending step %d --> %d (%s --> %s)", in->id, out->id,
in->alpha_only ? "Alpha" : "RGBA",
diff --git a/src/lib/evas/filters/evas_filter_blend.c b/src/lib/evas/filters/evas_filter_blend.c
index ceda99eccb..e12ed64332 100644
--- a/src/lib/evas/filters/evas_filter_blend.c
+++ b/src/lib/evas/filters/evas_filter_blend.c
@@ -208,7 +208,12 @@ _image_draw_cpu_rgba2rgba(void *data EINA_UNUSED, void *context,
EINA_SAFETY_ON_FALSE_RETURN_VAL((src_w == dst_w) && (src_h == dst_h), EINA_FALSE);
- func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, 1, dc->render_op);
+ if (!dc->color)
+ return EINA_TRUE;
+ else if (dc->color == 0xFFFFFFFF)
+ func = evas_common_gfx_func_composite_pixel_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dst->cache_entry.flags.alpha, 1, dc->render_op);
+ else
+ func = evas_common_gfx_func_composite_pixel_color_span_get(src->cache_entry.flags.alpha, src->cache_entry.flags.alpha_sparse, dc->color, dst->cache_entry.flags.alpha, 1, dc->render_op);
EINA_SAFETY_ON_NULL_RETURN_VAL(func, EINA_FALSE);
sw = src->cache_entry.w;
@@ -276,8 +281,11 @@ _filter_blend_cpu_rgba(Evas_Filter_Command *cmd)
return EINA_TRUE;
drawctx = cmd->ENFN->context_new(cmd->ENDT);
- cmd->ENFN->context_color_set(cmd->ENDT, drawctx, cmd->draw.R, cmd->draw.G,
- cmd->draw.B, cmd->draw.A);
+ cmd->ENFN->context_color_set(cmd->ENDT, drawctx, 255, 255, 255, 255);
+ if ((cmd->draw.R != 255) || (cmd->draw.G != 255) || (cmd->draw.B != 255) || (cmd->draw.A != 255))
+ cmd->ENFN->context_multiplier_set(cmd->ENDT, drawctx, cmd->draw.R, cmd->draw.G, cmd->draw.B, cmd->draw.A);
+ else
+ cmd->ENFN->context_multiplier_unset(cmd->ENDT, drawctx);
cmd->ENFN->context_render_op_set(cmd->ENDT, drawctx, cmd->draw.render_op);
if (cmd->draw.clip_use)