jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=ecc7da9cbacaeda9d8bc414855e970cfc73d4612

commit ecc7da9cbacaeda9d8bc414855e970cfc73d4612
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Fri Dec 4 15:09:56 2015 +0900

    Evas filters: Use Efl.Gfx.Render_Op
    
    Some filters are now broken. Yay for refactoring! Will be fixed
    in the following commit.
---
 src/lib/evas/filters/evas_filter.c          | 11 ++++++-----
 src/lib/evas/filters/evas_filter_blend.c    | 14 +++++++-------
 src/lib/evas/filters/evas_filter_displace.c |  4 ++--
 src/lib/evas/filters/evas_filter_mask.c     | 28 +++++++++++++++++-----------
 src/lib/evas/filters/evas_filter_private.h  |  2 +-
 src/lib/evas/include/evas_private.h         | 16 ++++++++++++++++
 src/static_libs/draw/draw.h                 |  1 +
 7 files changed, 50 insertions(+), 26 deletions(-)

diff --git a/src/lib/evas/filters/evas_filter.c 
b/src/lib/evas/filters/evas_filter.c
index 484f44d..42f2da8 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -1017,7 +1017,7 @@ evas_filter_command_blend_add(Evas_Filter_Context *ctx, 
void *drawctx,
    DRAW_FILL_SET(fillmode);
    cmd->draw.ox = ox;
    cmd->draw.oy = oy;
-   cmd->draw.render_op = ENFN->context_render_op_get(ENDT, drawctx);
+   cmd->draw.rop = _evas_to_gfx_render_op(ENFN->context_render_op_get(ENDT, 
drawctx));
    cmd->draw.clip_use =
          ENFN->context_clip_get(ENDT, drawctx,
                                 &cmd->draw.clip.x, &cmd->draw.clip.y,
@@ -1213,7 +1213,7 @@ 
evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
    DRAW_FILL_SET(fillmode);
    cmd->displacement.flags = flags & EVAS_FILTER_DISPLACE_BITMASK;
    cmd->displacement.intensity = intensity;
-   cmd->draw.render_op = ENFN->context_render_op_get(ENDT, draw_context);
+   cmd->draw.rop = _evas_to_gfx_render_op(ENFN->context_render_op_get(ENDT, 
draw_context));
    cmdid = cmd->id;
 
    if (tmp)
@@ -1241,12 +1241,13 @@ evas_filter_command_mask_add(Evas_Filter_Context *ctx, 
void *draw_context,
 {
    Evas_Filter_Command *cmd;
    Evas_Filter_Buffer *in, *out, *mask;
-   int cmdid = -1, render_op;
+   Efl_Gfx_Render_Op render_op;
+   int cmdid = -1;
    int R, G, B, A;
 
    EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, -1);
 
-   render_op = ENFN->context_render_op_get(ENDT, draw_context);
+   render_op = _evas_to_gfx_render_op(ENFN->context_render_op_get(ENDT, 
draw_context));
    ENFN->context_color_get(ENDT, draw_context, &R, &G, &B, &A);
 
    in = _filter_buffer_get(ctx, inbuf);
@@ -1262,7 +1263,7 @@ evas_filter_command_mask_add(Evas_Filter_Context *ctx, 
void *draw_context,
    cmd = _command_new(ctx, EVAS_FILTER_MODE_MASK, in, mask, out);
    if (!cmd) goto end;
 
-   cmd->draw.render_op = render_op;
+   cmd->draw.rop = render_op;
    DRAW_COLOR_SET(R, G, B, A);
    DRAW_FILL_SET(fillmode);
 
diff --git a/src/lib/evas/filters/evas_filter_blend.c 
b/src/lib/evas/filters/evas_filter_blend.c
index 407563a..0c7c548 100644
--- a/src/lib/evas/filters/evas_filter_blend.c
+++ b/src/lib/evas/filters/evas_filter_blend.c
@@ -11,7 +11,7 @@ static Eina_Bool _mapped_blend(void *data, void *drawctx, 
void *in, void *out, E
 
 struct Filter_Blend_Draw_Context
 {
-   int render_op;
+   Efl_Gfx_Render_Op rop;
    DATA32 color;
 };
 
@@ -33,7 +33,7 @@ _image_draw_cpu_alpha2alpha(void *data EINA_UNUSED, void 
*context,
 
    EINA_SAFETY_ON_FALSE_RETURN_VAL((src_w == dst_w) && (src_h == dst_h), 
EINA_FALSE);
 
-   func = efl_draw_alpha_func_get(dc->render_op, EINA_FALSE);
+   func = efl_draw_alpha_func_get(dc->rop, EINA_FALSE);
    EINA_SAFETY_ON_NULL_RETURN_VAL(func, EINA_FALSE);
 
    sw = src->cache_entry.w;
@@ -70,7 +70,7 @@ _image_draw_cpu_alpha2rgba(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_mask_color_span_get
-     (dc->color, dst->cache_entry.flags.alpha, 1, dc->render_op);
+     (dc->color, dst->cache_entry.flags.alpha, 1, dc->rop);
    EINA_SAFETY_ON_NULL_RETURN_VAL(func, EINA_FALSE);
 
    sw = src->cache_entry.w;
@@ -141,7 +141,7 @@ _filter_blend_cpu_generic_do(Evas_Filter_Command *cmd,
         in = fb->backing;
      }
 
-   dc.render_op = cmd->draw.render_op;
+   dc.rop = cmd->draw.rop;
    dc.color = ARGB_JOIN(cmd->draw.A, cmd->draw.R, cmd->draw.G, cmd->draw.B);
    return _mapped_blend(cmd->ENDT, &dc, in, out, cmd->draw.fillmode,
                         sx, sy, sw, sh, dx, dy, dw, dh, image_draw);
@@ -212,9 +212,9 @@ _image_draw_cpu_rgba2rgba(void *data EINA_UNUSED, void 
*context,
    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);
+     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->rop);
    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);
+     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->rop);
    EINA_SAFETY_ON_NULL_RETURN_VAL(func, EINA_FALSE);
 
    sw = src->cache_entry.w;
@@ -287,7 +287,7 @@ _filter_blend_cpu_rgba(Evas_Filter_Command *cmd)
      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);
+   cmd->ENFN->context_render_op_set(cmd->ENDT, drawctx, 
_gfx_to_evas_render_op(cmd->draw.rop));
 
    if (cmd->draw.clip_use)
      {
diff --git a/src/lib/evas/filters/evas_filter_displace.c 
b/src/lib/evas/filters/evas_filter_displace.c
index 0ce30b6..3a1829c 100644
--- a/src/lib/evas/filters/evas_filter_displace.c
+++ b/src/lib/evas/filters/evas_filter_displace.c
@@ -218,7 +218,7 @@ _filter_displace_cpu_alpha(Evas_Filter_Command *cmd)
    map_w = cmd->mask->w;
    map_h = cmd->mask->h;
    intensity = cmd->displacement.intensity;
-   blend = (cmd->draw.render_op == EVAS_RENDER_BLEND);
+   blend = (cmd->draw.rop == EFL_GFX_RENDER_OP_BLEND);
 
    // Stretch if necessary.
    if ((map_w != w || map_h != h) && (cmd->draw.fillmode & 
EVAS_FILTER_FILL_MODE_STRETCH_XY))
@@ -278,7 +278,7 @@ _filter_displace_cpu_rgba(Evas_Filter_Command *cmd)
    map_w = cmd->mask->w;
    map_h = cmd->mask->h;
    intensity = cmd->displacement.intensity;
-   blend = (cmd->draw.render_op == EVAS_RENDER_BLEND);
+   blend = (cmd->draw.rop == EFL_GFX_RENDER_OP_BLEND);
 
    // Stretch if necessary.
    if ((map_w != w || map_h != h) && (cmd->draw.fillmode & 
EVAS_FILTER_FILL_MODE_STRETCH_XY))
diff --git a/src/lib/evas/filters/evas_filter_mask.c 
b/src/lib/evas/filters/evas_filter_mask.c
index 6befcf2..2ae84b7 100644
--- a/src/lib/evas/filters/evas_filter_mask.c
+++ b/src/lib/evas/filters/evas_filter_mask.c
@@ -56,7 +56,7 @@ _mask_cpu_alpha_alpha_alpha(Evas_Filter_Command *cmd)
    Alpha_Gfx_Func func;
    RGBA_Image *in, *out, *mask;
    DATA8 *src, *dst, *msk;
-   int render_op = cmd->draw.render_op;
+   Efl_Gfx_Render_Op render_op = cmd->draw.rop;
    int w, h, mw, mh, x, y, my;
    int stepsize, stepcount, step;
 
@@ -165,7 +165,7 @@ _mask_cpu_alpha_rgba_rgba(Evas_Filter_Command *cmd)
    RGBA_Image *in, *out, *mask;
    DATA8 *src;
    DATA32 *dst, *msk, *span;
-   int op = cmd->draw.render_op;
+   Efl_Gfx_Render_Op op = cmd->draw.rop;
    int w, h, mw, mh, y, my, r;
    int stepsize, stepcount, step;
    DATA32 color2;
@@ -221,7 +221,7 @@ _mask_cpu_alpha_rgba_rgba(Evas_Filter_Command *cmd)
    span = malloc(stepsize * sizeof(DATA32));
 
    func1 = 
evas_common_gfx_func_composite_pixel_mask_span_get(mask->cache_entry.flags.alpha,
 mask->cache_entry.flags.alpha_sparse, out->cache_entry.flags.alpha, 1, 
EVAS_RENDER_COPY);
-   func2 = 
evas_common_gfx_func_composite_pixel_color_span_get(mask->cache_entry.flags.alpha,
 mask->cache_entry.flags.alpha_sparse, color2, out->cache_entry.flags.alpha, 1, 
op);
+   func2 = 
evas_common_gfx_func_composite_pixel_color_span_get(mask->cache_entry.flags.alpha,
 mask->cache_entry.flags.alpha_sparse, color2, out->cache_entry.flags.alpha, 1, 
_gfx_to_evas_render_op(op));
 
    // Apply mask using Gfx functions
    for (y = 0, my = 0; y < h; y++, my++, msk += mw)
@@ -263,7 +263,7 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
    DATA8 *src, *msk, *span;
    DATA32 *dst;
    DATA32 color;
-   int op = cmd->draw.render_op;
+   Efl_Gfx_Render_Op op = cmd->draw.rop;
    int w, h, mw, mh, y, my, r;
    int stepsize, stepcount, step;
 
@@ -313,8 +313,8 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
    stepcount = w / stepsize;
    span = malloc(stepsize * sizeof(DATA8));
 
-   func = evas_common_gfx_func_composite_mask_color_span_get(color, 
out->cache_entry.flags.alpha, 1, op);
-   span_func = efl_draw_alpha_func_get(cmd->draw.render_op, EINA_TRUE);
+   func = evas_common_gfx_func_composite_mask_color_span_get(color, 
out->cache_entry.flags.alpha, 1, _gfx_to_evas_render_op(op));
+   span_func = efl_draw_alpha_func_get(cmd->draw.rop, EINA_TRUE);
 
    for (y = 0, my = 0; y < h; y++, my++, msk += mw)
      {
@@ -349,17 +349,18 @@ _mask_cpu_alpha_alpha_rgba(Evas_Filter_Command *cmd)
 static Eina_Bool
 _mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
 {
-   Evas_Filter_Command fake_cmd;
+   //Evas_Filter_Command fake_cmd;
    Evas_Filter_Fill_Mode fillmode;
-   Evas_Filter_Apply_Func blend;
+   //Evas_Filter_Apply_Func blend;
    Evas_Filter_Buffer *fb;
-   Eina_Bool ret;
+   Eina_Bool ret = EINA_FALSE;
    int w, h;
 
    fake_cmd = *cmd;
    w = cmd->input->w;
    h = cmd->input->h;
 
+   // FIXME: do a single pass
    /* Blend 2 rgba images into rgba destination.
     * Mechanism:
     * 1. Copy input to temp (COPY)
@@ -387,11 +388,15 @@ _mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
         fillmode |= EVAS_FILTER_FILL_MODE_REPEAT_Y;
      }
 
+#warning FIXME: filter full RGBA masking is now broken
+   goto finish;
+
+#if 0
    // Mask --> Temp
    fake_cmd.input = cmd->mask;
    fake_cmd.mask = NULL;
    fake_cmd.output = fb;
-   fake_cmd.draw.render_op = EVAS_RENDER_MUL;
+   fake_cmd.draw.rop = EVAS_RENDER_MUL; // FIXME
    fake_cmd.draw.fillmode = fillmode;
    blend = evas_filter_blend_cpu_func_get(&fake_cmd);
    EINA_SAFETY_ON_NULL_RETURN_VAL(blend, EINA_FALSE);
@@ -399,13 +404,14 @@ _mask_cpu_rgba_rgba_rgba(Evas_Filter_Command *cmd)
    if (!ret) goto finish;
 
    // Temp --> Output
-   fake_cmd.draw.render_op = EVAS_RENDER_BLEND;
+   fake_cmd.draw.rop = EFL_GFX_RENDER_OP_BLEND;
    fake_cmd.input = fb;
    fake_cmd.output = cmd->output;
    fake_cmd.draw.fillmode = EVAS_FILTER_FILL_MODE_NONE;
    blend = evas_filter_blend_cpu_func_get(&fake_cmd);
    EINA_SAFETY_ON_NULL_RETURN_VAL(blend, EINA_FALSE);
    ret = blend(&fake_cmd);
+#endif
 
 finish:
    fb->locked = EINA_FALSE;
diff --git a/src/lib/evas/filters/evas_filter_private.h 
b/src/lib/evas/filters/evas_filter_private.h
index 5770972..d48a177 100644
--- a/src/lib/evas/filters/evas_filter_private.h
+++ b/src/lib/evas/filters/evas_filter_private.h
@@ -203,7 +203,7 @@ struct _Evas_Filter_Command
    };
 
    struct {
-      int render_op;
+      Efl_Gfx_Render_Op rop;
       int R, G, B, A;
       int ox, oy;
       union {
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 56407d9..4bb7c75 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -1987,6 +1987,22 @@ struct _Evas_Mempool
 #define EVAS_API_RESET(func, api) \
      (api)->func = NULL
 
+static inline Efl_Gfx_Render_Op
+_evas_to_gfx_render_op(Evas_Render_Op rop)
+{
+   if (rop == EVAS_RENDER_COPY)
+     return EFL_GFX_RENDER_OP_COPY;
+   return EFL_GFX_RENDER_OP_BLEND;
+}
+
+static inline Evas_Render_Op
+_gfx_to_evas_render_op(Efl_Gfx_Render_Op rop)
+{
+   if (rop == EFL_GFX_RENDER_OP_COPY)
+     return EVAS_RENDER_COPY;
+   return EVAS_RENDER_BLEND;
+}
+
 #include "evas_inline.x"
 
 #ifdef __cplusplus
diff --git a/src/static_libs/draw/draw.h b/src/static_libs/draw/draw.h
index 1c15a0d..2a3d635 100644
--- a/src/static_libs/draw/draw.h
+++ b/src/static_libs/draw/draw.h
@@ -7,6 +7,7 @@
 
 #include <Efl.h>
 
+/* FIXME: naming convention */
 typedef void (*RGBA_Comp_Func)       (uint32_t *dest, const uint32_t *src, int 
length, uint32_t mul_col, uint32_t const_alpha);
 typedef void (*RGBA_Comp_Func_Solid) (uint32_t *dest, int length, uint32_t 
color, uint32_t const_alpha);
 typedef void (*RGBA_Comp_Func_Mask)  (uint32_t *dest, uint8_t *mask, int 
length, uint32_t color);

-- 


Reply via email to