summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-14 17:22:09 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-14 18:03:49 +0900
commit88bfba1fdd35e3aadd4c3fde266cc48c2544db32 (patch)
tree160c62a43e4eec03191d207e4c59c600bf6e1a11
parent8bb03d8170219211be16974792d55f579806aa0d (diff)
evas filters: Add "alphaonly" flag for blend and blur
This is very useful to specify precisely which kind of RGBA -> Alpha conversion you want. If all you wanted was the alpha layer to use as a mask, set this flag to true. @feature
-rw-r--r--src/lib/evas/filters/evas_filter.c52
-rw-r--r--src/lib/evas/filters/evas_filter_parser.c40
-rw-r--r--src/lib/evas/filters/evas_filter_private.h1
-rw-r--r--src/lib/evas/include/evas_filter.h9
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h8
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c55
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c15
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_shader.c11
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x3
-rw-r--r--src/modules/evas/engines/gl_common/shader/fragment.glsl4
-rw-r--r--src/modules/evas/engines/gl_generic/filters/gl_filter_blend.c13
-rw-r--r--src/modules/evas/engines/gl_generic/filters/gl_filter_blur.c3
-rw-r--r--src/modules/evas/engines/gl_generic/filters/gl_filter_mask.c3
-rw-r--r--src/modules/evas/engines/software_generic/filters/evas_filter_blend.c48
14 files changed, 194 insertions, 71 deletions
diff --git a/src/lib/evas/filters/evas_filter.c b/src/lib/evas/filters/evas_filter.c
index c83b5e35b0..135d20b2bc 100644
--- a/src/lib/evas/filters/evas_filter.c
+++ b/src/lib/evas/filters/evas_filter.c
@@ -734,7 +734,7 @@ evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
734 Evas_Filter_Buffer *in, Evas_Filter_Buffer *out, 734 Evas_Filter_Buffer *in, Evas_Filter_Buffer *out,
735 Evas_Filter_Blur_Type type, 735 Evas_Filter_Blur_Type type,
736 int rx, int ry, int ox, int oy, int count, 736 int rx, int ry, int ox, int oy, int count,
737 int R, int G, int B, int A) 737 int R, int G, int B, int A, Eina_Bool alphaonly)
738{ 738{
739 Evas_Filter_Command *cmd = NULL; 739 Evas_Filter_Command *cmd = NULL;
740 Evas_Filter_Buffer *dx_in, *dx_out, *dy_in, *dy_out, *tmp = NULL; 740 Evas_Filter_Buffer *dx_in, *dx_out, *dy_in, *dy_out, *tmp = NULL;
@@ -798,6 +798,7 @@ evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
798 cmd->draw.scale.pad_y = pad_y; 798 cmd->draw.scale.pad_y = pad_y;
799 cmd->draw.scale.factor_x = down_x; 799 cmd->draw.scale.factor_x = down_x;
800 cmd->draw.scale.factor_y = down_y; 800 cmd->draw.scale.factor_y = down_y;
801 cmd->draw.alphaonly = alphaonly;
801 dx_in = tmp; 802 dx_in = tmp;
802 803
803 tmp = evas_filter_temporary_buffer_get(ctx, ww, hh, in->alpha_only, EINA_TRUE); 804 tmp = evas_filter_temporary_buffer_get(ctx, ww, hh, in->alpha_only, EINA_TRUE);
@@ -827,6 +828,7 @@ evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
827 cmd->blur.type = type; 828 cmd->blur.type = type;
828 cmd->blur.dx = dx; 829 cmd->blur.dx = dx;
829 cmd->blur.count = count; 830 cmd->blur.count = count;
831 cmd->draw.alphaonly = alphaonly;
830 } 832 }
831 833
832 if (dy) 834 if (dy)
@@ -837,6 +839,7 @@ evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
837 cmd->blur.type = type; 839 cmd->blur.type = type;
838 cmd->blur.dy = dy; 840 cmd->blur.dy = dy;
839 cmd->blur.count = count; 841 cmd->blur.count = count;
842 cmd->draw.alphaonly = alphaonly;
840 } 843 }
841 844
842 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd, NULL); 845 EINA_SAFETY_ON_NULL_RETURN_VAL(cmd, NULL);
@@ -852,6 +855,7 @@ evas_filter_command_blur_add_gl(Evas_Filter_Context *ctx,
852 cmd->draw.scale.pad_y = pad_y; 855 cmd->draw.scale.pad_y = pad_y;
853 cmd->draw.scale.factor_x = down_x; 856 cmd->draw.scale.factor_x = down_x;
854 cmd->draw.scale.factor_y = down_y; 857 cmd->draw.scale.factor_y = down_y;
858 cmd->draw.alphaonly = alphaonly;
855 } 859 }
856 860
857 cmd->draw.ox = ox; 861 cmd->draw.ox = ox;
@@ -886,7 +890,8 @@ _blur_support_gl(Evas_Filter_Context *ctx, Evas_Filter_Buffer *in, Evas_Filter_B
886Evas_Filter_Command * 890Evas_Filter_Command *
887evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx, 891evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
888 int inbuf, int outbuf, Evas_Filter_Blur_Type type, 892 int inbuf, int outbuf, Evas_Filter_Blur_Type type,
889 int dx, int dy, int ox, int oy, int count) 893 int dx, int dy, int ox, int oy, int count,
894 Eina_Bool alphaonly)
890{ 895{
891 Evas_Filter_Buffer *in = NULL, *out = NULL, *tmp = NULL, *in_dy = NULL; 896 Evas_Filter_Buffer *in = NULL, *out = NULL, *tmp = NULL, *in_dy = NULL;
892 Evas_Filter_Buffer *out_dy = NULL, *out_dx = NULL; 897 Evas_Filter_Buffer *out_dy = NULL, *out_dx = NULL;
@@ -904,7 +909,7 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
904 if (!dx && !dy) 909 if (!dx && !dy)
905 { 910 {
906 XDBG("Changing 0px blur into simple blend"); 911 XDBG("Changing 0px blur into simple blend");
907 return evas_filter_command_blend_add(ctx, drawctx, inbuf, outbuf, ox, oy, EVAS_FILTER_FILL_MODE_NONE); 912 return evas_filter_command_blend_add(ctx, drawctx, inbuf, outbuf, ox, oy, EVAS_FILTER_FILL_MODE_NONE, alphaonly);
908 } 913 }
909 914
910 in = _filter_buffer_get(ctx, inbuf); 915 in = _filter_buffer_get(ctx, inbuf);
@@ -922,7 +927,8 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
922 } 927 }
923 928
924 if (_blur_support_gl(ctx, in, out)) 929 if (_blur_support_gl(ctx, in, out))
925 return evas_filter_command_blur_add_gl(ctx, in, out, type, dx, dy, ox, oy, count, R, G, B, A); 930 return evas_filter_command_blur_add_gl(ctx, in, out, type, dx, dy, ox, oy,
931 count, R, G, B, A, alphaonly);
926 932
927 // Note (SW engine): 933 // Note (SW engine):
928 // The basic blur operation overrides the pixels in the target buffer, 934 // The basic blur operation overrides the pixels in the target buffer,
@@ -979,7 +985,8 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
979 985
980 if (dy) ENFN->context_color_set(ENC, drawctx, 255, 255, 255, 255); 986 if (dy) ENFN->context_color_set(ENC, drawctx, 255, 255, 255, 255);
981 cmd = evas_filter_command_blur_add(ctx, drawctx, inbuf, tmp_out, 987 cmd = evas_filter_command_blur_add(ctx, drawctx, inbuf, tmp_out,
982 type, dx, 0, tmp_ox, tmp_oy, 0); 988 type, dx, 0, tmp_ox, tmp_oy, 0,
989 alphaonly);
983 if (!cmd) goto fail; 990 if (!cmd) goto fail;
984 cmd->blur.auto_count = EINA_TRUE; 991 cmd->blur.auto_count = EINA_TRUE;
985 if (dy) ENFN->context_color_set(ENC, drawctx, R, G, B, A); 992 if (dy) ENFN->context_color_set(ENC, drawctx, R, G, B, A);
@@ -996,7 +1003,8 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
996 if (dx && (inbuf == outbuf)) 1003 if (dx && (inbuf == outbuf))
997 ENFN->context_render_op_set(ENC, drawctx, EVAS_RENDER_COPY); 1004 ENFN->context_render_op_set(ENC, drawctx, EVAS_RENDER_COPY);
998 cmd = evas_filter_command_blur_add(ctx, drawctx, tmp_in, outbuf, 1005 cmd = evas_filter_command_blur_add(ctx, drawctx, tmp_in, outbuf,
999 type, 0, dy, ox, oy, 0); 1006 type, 0, dy, ox, oy, 0,
1007 alphaonly);
1000 if (dx && (inbuf == outbuf)) 1008 if (dx && (inbuf == outbuf))
1001 ENFN->context_render_op_set(ENC, drawctx, render_op); 1009 ENFN->context_render_op_set(ENC, drawctx, render_op);
1002 if (!cmd) goto fail; 1010 if (!cmd) goto fail;
@@ -1145,7 +1153,8 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
1145 XDBG("Add extra blend %d -> %d", blendbuf->id, out->id); 1153 XDBG("Add extra blend %d -> %d", blendbuf->id, out->id);
1146 blendcmd = evas_filter_command_blend_add(ctx, drawctx, 1154 blendcmd = evas_filter_command_blend_add(ctx, drawctx,
1147 blendbuf->id, out->id, ox, oy, 1155 blendbuf->id, out->id, ox, oy,
1148 EVAS_FILTER_FILL_MODE_NONE); 1156 EVAS_FILTER_FILL_MODE_NONE,
1157 alphaonly);
1149 if (!blendcmd) goto fail; 1158 if (!blendcmd) goto fail;
1150 ox = oy = 0; 1159 ox = oy = 0;
1151 } 1160 }
@@ -1158,7 +1167,8 @@ evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *drawctx,
1158 ENFN->context_render_op_set(ENC, drawctx, EVAS_RENDER_COPY); 1167 ENFN->context_render_op_set(ENC, drawctx, EVAS_RENDER_COPY);
1159 copycmd = evas_filter_command_blend_add(ctx, drawctx, 1168 copycmd = evas_filter_command_blend_add(ctx, drawctx,
1160 copybuf->id, out->id, ox, oy, 1169 copybuf->id, out->id, ox, oy,
1161 EVAS_FILTER_FILL_MODE_NONE); 1170 EVAS_FILTER_FILL_MODE_NONE,
1171 alphaonly);
1162 ENFN->context_color_set(ENC, drawctx, R, G, B, A); 1172 ENFN->context_color_set(ENC, drawctx, R, G, B, A);
1163 ENFN->context_render_op_set(ENC, drawctx, render_op); 1173 ENFN->context_render_op_set(ENC, drawctx, render_op);
1164 if (!copycmd) goto fail; 1174 if (!copycmd) goto fail;
@@ -1178,7 +1188,8 @@ fail:
1178Evas_Filter_Command * 1188Evas_Filter_Command *
1179evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx, 1189evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx,
1180 int inbuf, int outbuf, int ox, int oy, 1190 int inbuf, int outbuf, int ox, int oy,
1181 Evas_Filter_Fill_Mode fillmode) 1191 Evas_Filter_Fill_Mode fillmode,
1192 Eina_Bool alphaonly)
1182{ 1193{
1183 Evas_Filter_Command *cmd; 1194 Evas_Filter_Command *cmd;
1184 Evas_Filter_Buffer *in, *out; 1195 Evas_Filter_Buffer *in, *out;
@@ -1221,10 +1232,11 @@ evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx,
1221 cmd->draw.ox = ox; 1232 cmd->draw.ox = ox;
1222 cmd->draw.oy = oy; 1233 cmd->draw.oy = oy;
1223 cmd->draw.rop = copy ? EFL_GFX_RENDER_OP_COPY : EFL_GFX_RENDER_OP_BLEND; 1234 cmd->draw.rop = copy ? EFL_GFX_RENDER_OP_COPY : EFL_GFX_RENDER_OP_BLEND;
1235 cmd->draw.alphaonly = alphaonly;
1224 cmd->draw.clip_use = 1236 cmd->draw.clip_use =
1225 ENFN->context_clip_get(ENC, drawctx, 1237 !!ENFN->context_clip_get(ENC, drawctx,
1226 &cmd->draw.clip.x, &cmd->draw.clip.y, 1238 &cmd->draw.clip.x, &cmd->draw.clip.y,
1227 &cmd->draw.clip.w, &cmd->draw.clip.h); 1239 &cmd->draw.clip.w, &cmd->draw.clip.h);
1228 1240
1229 XDBG("Add %s %d -> %d: offset %d,%d, color: %d,%d,%d,%d", 1241 XDBG("Add %s %d -> %d: offset %d,%d, color: %d,%d,%d,%d",
1230 copy ? "copy" : "blend", in->id, out->id, ox, oy, R, G, B, A); 1242 copy ? "copy" : "blend", in->id, out->id, ox, oy, R, G, B, A);
@@ -1238,7 +1250,8 @@ evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *drawctx,
1238 1250
1239Evas_Filter_Command * 1251Evas_Filter_Command *
1240evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context, 1252evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context,
1241 int inbuf, int outbuf, int radius, Eina_Bool smooth) 1253 int inbuf, int outbuf, int radius, Eina_Bool smooth,
1254 Eina_Bool alphaonly)
1242{ 1255{
1243 Evas_Filter_Command *blurcmd, *threshcmd, *blendcmd; 1256 Evas_Filter_Command *blurcmd, *threshcmd, *blendcmd;
1244 Evas_Filter_Buffer *tmp = NULL, *in, *out; 1257 Evas_Filter_Buffer *tmp = NULL, *in, *out;
@@ -1251,7 +1264,8 @@ evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context,
1251 if (!radius) 1264 if (!radius)
1252 { 1265 {
1253 XDBG("Changing 0px grow into simple blend"); 1266 XDBG("Changing 0px grow into simple blend");
1254 return evas_filter_command_blend_add(ctx, draw_context, inbuf, outbuf, 0, 0, EVAS_FILTER_FILL_MODE_NONE); 1267 return evas_filter_command_blend_add(ctx, draw_context, inbuf, outbuf, 0, 0,
1268 EVAS_FILTER_FILL_MODE_NONE, alphaonly);
1255 } 1269 }
1256 1270
1257 in = _filter_buffer_get(ctx, inbuf); 1271 in = _filter_buffer_get(ctx, inbuf);
@@ -1271,7 +1285,8 @@ evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context,
1271 1285
1272 blurcmd = evas_filter_command_blur_add(ctx, draw_context, inbuf, growbuf, 1286 blurcmd = evas_filter_command_blur_add(ctx, draw_context, inbuf, growbuf,
1273 EVAS_FILTER_BLUR_DEFAULT, 1287 EVAS_FILTER_BLUR_DEFAULT,
1274 abs(radius), abs(radius), 0, 0, 0); 1288 abs(radius), abs(radius), 0, 0, 0,
1289 alphaonly);
1275 if (!blurcmd) return NULL; 1290 if (!blurcmd) return NULL;
1276 1291
1277 if (diam > 255) diam = 255; 1292 if (diam > 255) diam = 255;
@@ -1309,7 +1324,8 @@ evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context,
1309 { 1324 {
1310 blendcmd = evas_filter_command_blend_add(ctx, draw_context, tmp->id, 1325 blendcmd = evas_filter_command_blend_add(ctx, draw_context, tmp->id,
1311 outbuf, 0, 0, 1326 outbuf, 0, 0,
1312 EVAS_FILTER_FILL_MODE_NONE); 1327 EVAS_FILTER_FILL_MODE_NONE,
1328 alphaonly);
1313 if (!blendcmd) 1329 if (!blendcmd)
1314 { 1330 {
1315 _command_del(ctx, threshcmd); 1331 _command_del(ctx, threshcmd);
@@ -1375,6 +1391,7 @@ evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
1375{ 1391{
1376 Evas_Filter_Buffer *in, *out, *map, *tmp = NULL, *disp_out; 1392 Evas_Filter_Buffer *in, *out, *map, *tmp = NULL, *disp_out;
1377 Evas_Filter_Command *cmd = NULL; 1393 Evas_Filter_Command *cmd = NULL;
1394 Eina_Bool alphaonly = EINA_FALSE;
1378 1395
1379 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL); 1396 EINA_SAFETY_ON_NULL_RETURN_VAL(ctx, NULL);
1380 EINA_SAFETY_ON_FALSE_RETURN_VAL(intensity >= 0, NULL); 1397 EINA_SAFETY_ON_FALSE_RETURN_VAL(intensity >= 0, NULL);
@@ -1417,7 +1434,8 @@ evas_filter_command_displacement_map_add(Evas_Filter_Context *ctx,
1417 1434
1418 fillcmd = evas_filter_command_blend_add(ctx, draw_context, disp_out->id, 1435 fillcmd = evas_filter_command_blend_add(ctx, draw_context, disp_out->id,
1419 out->id, 0, 0, 1436 out->id, 0, 0,
1420 EVAS_FILTER_FILL_MODE_NONE); 1437 EVAS_FILTER_FILL_MODE_NONE,
1438 alphaonly);
1421 if (!fillcmd) goto fail; 1439 if (!fillcmd) goto fail;
1422 } 1440 }
1423 1441
diff --git a/src/lib/evas/filters/evas_filter_parser.c b/src/lib/evas/filters/evas_filter_parser.c
index e916b2efc7..08b91e5255 100644
--- a/src/lib/evas/filters/evas_filter_parser.c
+++ b/src/lib/evas/filters/evas_filter_parser.c
@@ -462,6 +462,23 @@ _instruction_param_geti(Evas_Filter_Instruction *instr, const char *name,
462 return -1; 462 return -1;
463} 463}
464 464
465static Eina_Bool
466_instruction_param_getb(Evas_Filter_Instruction *instr, const char *name,
467 Eina_Bool *isset)
468{
469 Instruction_Param *param;
470
471 EINA_INLIST_FOREACH(instr->params, param)
472 if (!strcasecmp(name, param->name))
473 {
474 if (isset) *isset = param->set;
475 return param->value.b;
476 }
477
478 if (isset) *isset = EINA_FALSE;
479 return EINA_FALSE;
480}
481
465static double 482static double
466_instruction_param_getd(Evas_Filter_Instruction *instr, const char *name, 483_instruction_param_getd(Evas_Filter_Instruction *instr, const char *name,
467 Eina_Bool *isset) 484 Eina_Bool *isset)
@@ -970,7 +987,10 @@ _blend_padding_update(Evas_Filter_Program *pgm EINA_UNUSED,
970 draw the buffer in this color. If both buffers are RGBA, this will 987 draw the buffer in this color. If both buffers are RGBA, this will
971 have no effect. 988 have no effect.
972 @param fillmode Map the input onto the whole surface of the output by stretching or 989 @param fillmode Map the input onto the whole surface of the output by stretching or
973 repeating it. See @ref evasfilter_fillmode "fillmodes". 990 repeating it. See @ref evasfilter_fillmode "fillmodes".
991 @param alphaonly If true, this means all RGBA->Alpha conversions discard the
992 RGB components entirely, and only use the Alpha channel.
993 False by default, which means RGB is used as Grey color level.
974 994
975 If @a src is an alpha buffer and @a dst is an RGBA buffer, then the @a color option should be set. 995 If @a src is an alpha buffer and @a dst is an RGBA buffer, then the @a color option should be set.
976 996
@@ -998,6 +1018,7 @@ _blend_instruction_prepare(Evas_Filter_Program *pgm, Evas_Filter_Instruction *in
998 _instruction_param_seq_add(instr, "oy", VT_INT, 0); 1018 _instruction_param_seq_add(instr, "oy", VT_INT, 0);
999 _instruction_param_name_add(instr, "color", VT_COLOR, 0xFFFFFFFF); 1019 _instruction_param_name_add(instr, "color", VT_COLOR, 0xFFFFFFFF);
1000 _instruction_param_name_add(instr, "fillmode", VT_STRING, "none"); 1020 _instruction_param_name_add(instr, "fillmode", VT_STRING, "none");
1021 _instruction_param_name_add(instr, "alphaonly", VT_BOOL, EINA_FALSE);
1001 1022
1002 return EINA_TRUE; 1023 return EINA_TRUE;
1003} 1024}
@@ -1122,6 +1143,7 @@ _blur_instruction_prepare(Evas_Filter_Program *pgm, Evas_Filter_Instruction *ins
1122 _instruction_param_name_add(instr, "src", VT_BUFFER, _buffer_get(pgm, "input")); 1143 _instruction_param_name_add(instr, "src", VT_BUFFER, _buffer_get(pgm, "input"));
1123 _instruction_param_name_add(instr, "dst", VT_BUFFER, _buffer_get(pgm, "output")); 1144 _instruction_param_name_add(instr, "dst", VT_BUFFER, _buffer_get(pgm, "output"));
1124 _instruction_param_name_add(instr, "count", VT_INT, 0); 1145 _instruction_param_name_add(instr, "count", VT_INT, 0);
1146 _instruction_param_name_add(instr, "alphaonly", VT_BOOL, EINA_FALSE);
1125 1147
1126 return EINA_TRUE; 1148 return EINA_TRUE;
1127} 1149}
@@ -1618,6 +1640,7 @@ _grow_instruction_prepare(Evas_Filter_Program *pgm, Evas_Filter_Instruction *ins
1618 _instruction_param_name_add(instr, "smooth", VT_BOOL, EINA_TRUE); 1640 _instruction_param_name_add(instr, "smooth", VT_BOOL, EINA_TRUE);
1619 _instruction_param_name_add(instr, "src", VT_BUFFER, _buffer_get(pgm, "input")); 1641 _instruction_param_name_add(instr, "src", VT_BUFFER, _buffer_get(pgm, "input"));
1620 _instruction_param_name_add(instr, "dst", VT_BUFFER, _buffer_get(pgm, "output")); 1642 _instruction_param_name_add(instr, "dst", VT_BUFFER, _buffer_get(pgm, "output"));
1643 _instruction_param_name_add(instr, "alphaonly", VT_BOOL, EINA_FALSE);
1621 1644
1622 return EINA_TRUE; 1645 return EINA_TRUE;
1623} 1646}
@@ -3045,6 +3068,7 @@ _instr2cmd_blend(Evas_Filter_Context *ctx,
3045 Buffer *src, *dst; 3068 Buffer *src, *dst;
3046 Evas_Filter_Fill_Mode fillmode; 3069 Evas_Filter_Fill_Mode fillmode;
3047 int ox, oy, A, R, G, B; 3070 int ox, oy, A, R, G, B;
3071 Eina_Bool alphaonly;
3048 3072
3049 ox = _instruction_param_geti(instr, "ox", NULL); 3073 ox = _instruction_param_geti(instr, "ox", NULL);
3050 oy = _instruction_param_geti(instr, "oy", NULL); 3074 oy = _instruction_param_geti(instr, "oy", NULL);
@@ -3052,11 +3076,13 @@ _instr2cmd_blend(Evas_Filter_Context *ctx,
3052 fillmode = _fill_mode_get(instr); 3076 fillmode = _fill_mode_get(instr);
3053 src = _instruction_param_getbuf(instr, "src", NULL); 3077 src = _instruction_param_getbuf(instr, "src", NULL);
3054 dst = _instruction_param_getbuf(instr, "dst", NULL); 3078 dst = _instruction_param_getbuf(instr, "dst", NULL);
3079 alphaonly = _instruction_param_getb(instr, "alphaonly", NULL);
3055 INSTR_PARAM_CHECK(src); 3080 INSTR_PARAM_CHECK(src);
3056 INSTR_PARAM_CHECK(dst); 3081 INSTR_PARAM_CHECK(dst);
3057 3082
3058 if (isset) SETCOLOR(color); 3083 if (isset) SETCOLOR(color);
3059 cmd = evas_filter_command_blend_add(ctx, dc, src->cid, dst->cid, ox, oy, fillmode); 3084 cmd = evas_filter_command_blend_add(ctx, dc, src->cid, dst->cid,
3085 ox, oy, fillmode, alphaonly);
3060 if (isset) RESETCOLOR(); 3086 if (isset) RESETCOLOR();
3061 3087
3062 return cmd; 3088 return cmd;
@@ -3073,6 +3099,7 @@ _instr2cmd_blur(Evas_Filter_Context *ctx,
3073 DATA32 color; 3099 DATA32 color;
3074 Buffer *src, *dst; 3100 Buffer *src, *dst;
3075 int ox, oy, rx, ry, A, R, G, B, count; 3101 int ox, oy, rx, ry, A, R, G, B, count;
3102 Eina_Bool alphaonly;
3076 3103
3077 ox = _instruction_param_geti(instr, "ox", NULL); 3104 ox = _instruction_param_geti(instr, "ox", NULL);
3078 oy = _instruction_param_geti(instr, "oy", NULL); 3105 oy = _instruction_param_geti(instr, "oy", NULL);
@@ -3083,6 +3110,7 @@ _instr2cmd_blur(Evas_Filter_Context *ctx,
3083 count = _instruction_param_geti(instr, "count", &cntset); 3110 count = _instruction_param_geti(instr, "count", &cntset);
3084 src = _instruction_param_getbuf(instr, "src", NULL); 3111 src = _instruction_param_getbuf(instr, "src", NULL);
3085 dst = _instruction_param_getbuf(instr, "dst", NULL); 3112 dst = _instruction_param_getbuf(instr, "dst", NULL);
3113 alphaonly = _instruction_param_getb(instr, "alphaonly", NULL);
3086 INSTR_PARAM_CHECK(src); 3114 INSTR_PARAM_CHECK(src);
3087 INSTR_PARAM_CHECK(dst); 3115 INSTR_PARAM_CHECK(dst);
3088 3116
@@ -3116,7 +3144,7 @@ _instr2cmd_blur(Evas_Filter_Context *ctx,
3116 if (!yset) ry = rx; 3144 if (!yset) ry = rx;
3117 if (colorset) SETCOLOR(color); 3145 if (colorset) SETCOLOR(color);
3118 cmd = evas_filter_command_blur_add(ctx, dc, src->cid, dst->cid, type, 3146 cmd = evas_filter_command_blur_add(ctx, dc, src->cid, dst->cid, type,
3119 rx, ry, ox, oy, count); 3147 rx, ry, ox, oy, count, alphaonly);
3120 if (colorset) RESETCOLOR(); 3148 if (colorset) RESETCOLOR();
3121 3149
3122 return cmd; 3150 return cmd;
@@ -3235,16 +3263,18 @@ _instr2cmd_grow(Evas_Filter_Context *ctx,
3235 Evas_Filter_Command *cmd; 3263 Evas_Filter_Command *cmd;
3236 Buffer *src, *dst; 3264 Buffer *src, *dst;
3237 Eina_Bool smooth; 3265 Eina_Bool smooth;
3266 Eina_Bool alphaonly;
3238 int radius; 3267 int radius;
3239 3268
3240 src = _instruction_param_getbuf(instr, "src", NULL); 3269 src = _instruction_param_getbuf(instr, "src", NULL);
3241 dst = _instruction_param_getbuf(instr, "dst", NULL); 3270 dst = _instruction_param_getbuf(instr, "dst", NULL);
3242 radius = _instruction_param_geti(instr, "radius", NULL); 3271 radius = _instruction_param_geti(instr, "radius", NULL);
3243 smooth = _instruction_param_geti(instr, "smooth", NULL); 3272 smooth = _instruction_param_getb(instr, "smooth", NULL);
3273 alphaonly = _instruction_param_getb(instr, "alphaonly", NULL);
3244 INSTR_PARAM_CHECK(src); 3274 INSTR_PARAM_CHECK(src);
3245 INSTR_PARAM_CHECK(dst); 3275 INSTR_PARAM_CHECK(dst);
3246 3276
3247 cmd = evas_filter_command_grow_add(ctx, dc, src->cid, dst->cid, radius, smooth); 3277 cmd = evas_filter_command_grow_add(ctx, dc, src->cid, dst->cid, radius, smooth, alphaonly);
3248 if (cmd) cmd->draw.need_temp_buffer = EINA_TRUE; 3278 if (cmd) cmd->draw.need_temp_buffer = EINA_TRUE;
3249 3279
3250 return cmd; 3280 return cmd;
diff --git a/src/lib/evas/filters/evas_filter_private.h b/src/lib/evas/filters/evas_filter_private.h
index 698b034b59..4ea6e0a66a 100644
--- a/src/lib/evas/filters/evas_filter_private.h
+++ b/src/lib/evas/filters/evas_filter_private.h
@@ -242,6 +242,7 @@ struct _Evas_Filter_Command
242 Eina_Bool down; 242 Eina_Bool down;
243 } scale; 243 } scale;
244 Evas_Filter_Fill_Mode fillmode; 244 Evas_Filter_Fill_Mode fillmode;
245 Eina_Bool alphaonly : 1;
245 Eina_Bool clip_use : 1; 246 Eina_Bool clip_use : 1;
246 Eina_Bool clip_mode_lrtb : 1; 247 Eina_Bool clip_mode_lrtb : 1;
247 Eina_Bool need_temp_buffer : 1; 248 Eina_Bool need_temp_buffer : 1;
diff --git a/src/lib/evas/include/evas_filter.h b/src/lib/evas/include/evas_filter.h
index 82b3ed6ce7..c6618d35d6 100644
--- a/src/lib/evas/include/evas_filter.h
+++ b/src/lib/evas/include/evas_filter.h
@@ -180,10 +180,11 @@ void _evas_filter_source_hash_free_cb(void *data);
180 * @param ox X offset in the destination buffer 180 * @param ox X offset in the destination buffer
181 * @param oy Y offset in the destination buffer 181 * @param oy Y offset in the destination buffer
182 * @param fillmode Specifies whether to repeat or stretch the input onto its destination, and on which axes 182 * @param fillmode Specifies whether to repeat or stretch the input onto its destination, and on which axes
183 * @param alphaonly If true, discard RGB during RGBA -> Alpha conversions.
183 * @return Filter command ID or -1 in case of error 184 * @return Filter command ID or -1 in case of error
184 * @internal 185 * @internal
185 */ 186 */
186Evas_Filter_Command *evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, int ox, int oy, Evas_Filter_Fill_Mode fillmode); 187Evas_Filter_Command *evas_filter_command_blend_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, int ox, int oy, Evas_Filter_Fill_Mode fillmode, Eina_Bool alphaonly);
187 188
188/** 189/**
189 * @brief Apply a blur effect on a buffer 190 * @brief Apply a blur effect on a buffer
@@ -197,10 +198,11 @@ Evas_Filter_Command *evas_filter_command_blend_add(Evas_Filter_Context *ctx,
197 * @param ox X offset in the destination buffer 198 * @param ox X offset in the destination buffer
198 * @param oy Y offset in the destination buffer 199 * @param oy Y offset in the destination buffer
199 * @param count Number of times to repeat the operation (used for smooth fast blurs with box blur) 200 * @param count Number of times to repeat the operation (used for smooth fast blurs with box blur)
201 * @param alphaonly If true, discard RGB during RGBA -> Alpha conversions.
200 * @return Filter command ID or -1 in case of error 202 * @return Filter command ID or -1 in case of error
201 * @internal 203 * @internal
202 */ 204 */
203Evas_Filter_Command *evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, Evas_Filter_Blur_Type type, int dx, int dy, int ox, int oy, int count); 205Evas_Filter_Command *evas_filter_command_blur_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, Evas_Filter_Blur_Type type, int dx, int dy, int ox, int oy, int count, Eina_Bool alphaonly);
204 206
205/** 207/**
206 * @brief Fill a buffer with the current color 208 * @brief Fill a buffer with the current color
@@ -234,10 +236,11 @@ Evas_Filter_Command *evas_filter_command_curve_add(Evas_Filter_Context *ctx,
234 * @param outbuf Destination buffer: ALPHA or RGBA (note: must be RGBA if inbuf is RGBA) 236 * @param outbuf Destination buffer: ALPHA or RGBA (note: must be RGBA if inbuf is RGBA)
235 * @param radius Number of pixels to grow by. If negative, shrink instead of grow 237 * @param radius Number of pixels to grow by. If negative, shrink instead of grow
236 * @param smooth Use smooth blur and curve for grow (default: true) 238 * @param smooth Use smooth blur and curve for grow (default: true)
239 * @param alphaonly If true, discard RGB during RGBA -> Alpha conversions.
237 * @return Filter command ID or -1 in case of error 240 * @return Filter command ID or -1 in case of error
238 * @internal 241 * @internal
239 */ 242 */
240Evas_Filter_Command *evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, int radius, Eina_Bool smooth); 243Evas_Filter_Command *evas_filter_command_grow_add(Evas_Filter_Context *ctx, void *draw_context, int inbuf, int outbuf, int radius, Eina_Bool smooth, Eina_Bool alphaonly);
241 244
242/** 245/**
243 * @brief Apply a displacement map to a buffer. This will move pixels from the source to the destination based on pixel per pixel offset, as defined in the displacement map 246 * @brief Apply a displacement map to a buffer. This will move pixels from the source to the destination based on pixel per pixel offset, as defined in the displacement map
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 1b2625d4ae..508c757dde 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -606,7 +606,7 @@ void evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
606 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, 606 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
607 Eina_Bool mask_smooth, Eina_Bool mask_color, 607 Eina_Bool mask_smooth, Eina_Bool mask_color,
608 int r, int g, int b, int a, 608 int r, int g, int b, int a,
609 Eina_Bool smooth, Eina_Bool tex_only); 609 Eina_Bool smooth, Eina_Bool tex_only, Eina_Bool alphaonly);
610void evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc, 610void evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
611 Evas_GL_Texture *tex, 611 Evas_GL_Texture *tex,
612 double sx, double sy, double sw, double sh, 612 double sx, double sy, double sw, double sh,
@@ -667,13 +667,16 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g
667 Evas_Colorspace cspace); 667 Evas_Colorspace cspace);
668 668
669// Gfx Filters 669// Gfx Filters
670void evas_gl_common_filter_blend_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex,
671 double sx, double sy, double sw, double sh, double dx,
672 double dy, double dw, double dh, Eina_Bool alphaonly);
670void evas_gl_common_filter_displace_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, Evas_GL_Texture *map_tex, 673void evas_gl_common_filter_displace_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, Evas_GL_Texture *map_tex,
671 int x, int y, int w, int h, double dx, double dy, Eina_Bool nearest); 674 int x, int y, int w, int h, double dx, double dy, Eina_Bool nearest);
672void evas_gl_common_filter_curve_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, 675void evas_gl_common_filter_curve_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex,
673 int x, int y, int w, int h, const uint8_t *points, int channel); 676 int x, int y, int w, int h, const uint8_t *points, int channel);
674void evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, double sx, double sy, double sw, double sh, 677void evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc, Evas_GL_Texture *tex, double sx, double sy, double sw, double sh,
675 double dx, double dy, double dw, double dh, const double * const values, const double * const offsets, int count, double radius, 678 double dx, double dy, double dw, double dh, const double * const values, const double * const offsets, int count, double radius,
676 Eina_Bool horiz); 679 Eina_Bool horiz, Eina_Bool alphaonly);
677 680
678int evas_gl_common_shader_program_init(Evas_GL_Shared *shared); 681int evas_gl_common_shader_program_init(Evas_GL_Shared *shared);
679void evas_gl_common_shader_program_shutdown(Evas_GL_Shared *shared); 682void evas_gl_common_shader_program_shutdown(Evas_GL_Shared *shared);
@@ -687,6 +690,7 @@ Evas_GL_Program *evas_gl_common_shader_program_get(Evas_Engine_GL_Context *gc,
687 Evas_GL_Texture *tex, Eina_Bool tex_only, 690 Evas_GL_Texture *tex, Eina_Bool tex_only,
688 Evas_GL_Texture *mtex, Eina_Bool mask_smooth, 691 Evas_GL_Texture *mtex, Eina_Bool mask_smooth,
689 Eina_Bool mask_color, int mw, int mh, 692 Eina_Bool mask_color, int mw, int mh,
693 Eina_Bool alphaonly,
690 Shader_Sampling *psam, int *pnomul, 694 Shader_Sampling *psam, int *pnomul,
691 Shader_Sampling *pmasksam); 695 Shader_Sampling *pmasksam);
692void evas_gl_common_shader_textures_bind(Evas_GL_Program *p); 696void evas_gl_common_shader_textures_bind(Evas_GL_Program *p);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index 317363e3b8..cb1e3ad649 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1951,7 +1951,8 @@ evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
1951 1951
1952 prog = evas_gl_common_shader_program_get(gc, SHD_LINE, NULL, 0, r, g, b, a, 1952 prog = evas_gl_common_shader_program_get(gc, SHD_LINE, NULL, 0, r, g, b, a,
1953 0, 0, 0, 0, EINA_FALSE, NULL, EINA_FALSE, 1953 0, 0, 0, 0, EINA_FALSE, NULL, EINA_FALSE,
1954 mtex, mask_smooth, mask_color, mw, mh, NULL, NULL, &masksam); 1954 mtex, mask_smooth, mask_color, mw, mh,
1955 EINA_FALSE, NULL, NULL, &masksam);
1955 1956
1956 pn = _evas_gl_common_context_push(SHD_LINE, 1957 pn = _evas_gl_common_context_push(SHD_LINE,
1957 gc, NULL, mtex, 1958 gc, NULL, mtex,
@@ -2015,7 +2016,8 @@ evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
2015 2016
2016 prog = evas_gl_common_shader_program_get(gc, SHD_RECT, NULL, 0, r, g, b, a, 2017 prog = evas_gl_common_shader_program_get(gc, SHD_RECT, NULL, 0, r, g, b, a,
2017 0, 0, 0, 0, EINA_FALSE, NULL, EINA_FALSE, 2018 0, 0, 0, 0, EINA_FALSE, NULL, EINA_FALSE,
2018 mtex, mask_smooth, mask_color, mw, mh, NULL, NULL, &masksam); 2019 mtex, mask_smooth, mask_color, mw, mh,
2020 EINA_FALSE, NULL, NULL, &masksam);
2019 2021
2020 2022
2021 pn = _evas_gl_common_context_push(SHD_RECT, 2023 pn = _evas_gl_common_context_push(SHD_RECT,
@@ -2177,7 +2179,8 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
2177 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, 2179 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh,
2178 Eina_Bool mask_smooth, Eina_Bool mask_color, 2180 Eina_Bool mask_smooth, Eina_Bool mask_color,
2179 int r, int g, int b, int a, 2181 int r, int g, int b, int a,
2180 Eina_Bool smooth, Eina_Bool tex_only) 2182 Eina_Bool smooth, Eina_Bool tex_only,
2183 Eina_Bool alphaonly)
2181{ 2184{
2182 2185
2183 Evas_GL_Texture_Pool *pt; 2186 Evas_GL_Texture_Pool *pt;
@@ -2213,7 +2216,7 @@ evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
2213 prog = evas_gl_common_shader_program_get(gc, shd_in, NULL, 0, r, g, b, a, 2216 prog = evas_gl_common_shader_program_get(gc, shd_in, NULL, 0, r, g, b, a,
2214 sw, sh, w, h, smooth, tex, tex_only, 2217 sw, sh, w, h, smooth, tex, tex_only,
2215 mtex, mask_smooth, mask_color, mw, mh, 2218 mtex, mask_smooth, mask_color, mw, mh,
2216 &sam, &nomul, &masksam); 2219 alphaonly, &sam, &nomul, &masksam);
2217 2220
2218 if (tex->ptt) 2221 if (tex->ptt)
2219 { 2222 {
@@ -2435,7 +2438,7 @@ evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
2435 prog = evas_gl_common_shader_program_get(gc, SHD_FONT, NULL, 0, r, g, b, a, 2438 prog = evas_gl_common_shader_program_get(gc, SHD_FONT, NULL, 0, r, g, b, a,
2436 sw, sh, w, h, EINA_FALSE, tex, EINA_FALSE, 2439 sw, sh, w, h, EINA_FALSE, tex, EINA_FALSE,
2437 mtex, mask_smooth, mask_color, mw, mh, 2440 mtex, mask_smooth, mask_color, mw, mh,
2438 NULL, NULL, &masksam); 2441 EINA_FALSE, NULL, NULL, &masksam);
2439 2442
2440 pn = _evas_gl_common_context_push(SHD_FONT, 2443 pn = _evas_gl_common_context_push(SHD_FONT,
2441 gc, tex, mtex, 2444 gc, tex, mtex,
@@ -2515,7 +2518,7 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2515 prog = evas_gl_common_shader_program_get(gc, SHD_YUV, NULL, 0, r, g, b, a, 2518 prog = evas_gl_common_shader_program_get(gc, SHD_YUV, NULL, 0, r, g, b, a,
2516 w, h, w, h, smooth, tex, 0, 2519 w, h, w, h, smooth, tex, 0,
2517 mtex, mask_smooth, mask_color, mw, mh, 2520 mtex, mask_smooth, mask_color, mw, mh,
2518 NULL, &nomul, &masksam); 2521 EINA_FALSE, NULL, &nomul, &masksam);
2519 2522
2520 pn = _evas_gl_common_context_push(SHD_YUV, 2523 pn = _evas_gl_common_context_push(SHD_YUV,
2521 gc, tex, mtex, 2524 gc, tex, mtex,
@@ -2595,7 +2598,7 @@ evas_gl_common_context_yuv_709_push(Evas_Engine_GL_Context *gc,
2595 prog = evas_gl_common_shader_program_get(gc, SHD_YUV_709, NULL, 0, r, g, b, a, 2598 prog = evas_gl_common_shader_program_get(gc, SHD_YUV_709, NULL, 0, r, g, b, a,
2596 w, h, w, h, smooth, tex, 0, 2599 w, h, w, h, smooth, tex, 0,
2597 mtex, mask_smooth, mask_color, mw, mh, 2600 mtex, mask_smooth, mask_color, mw, mh,
2598 NULL, &nomul, &masksam); 2601 EINA_FALSE, NULL, &nomul, &masksam);
2599 2602
2600 pn = _evas_gl_common_context_push(SHD_YUV_709, 2603 pn = _evas_gl_common_context_push(SHD_YUV_709,
2601 gc, tex, mtex, 2604 gc, tex, mtex,
@@ -2675,7 +2678,7 @@ evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
2675 prog = evas_gl_common_shader_program_get(gc, SHD_YUY2, NULL, 0, r, g, b, a, 2678 prog = evas_gl_common_shader_program_get(gc, SHD_YUY2, NULL, 0, r, g, b, a,
2676 sw, sh, w, h, smooth, tex, 0, 2679 sw, sh, w, h, smooth, tex, 0,
2677 mtex, mask_smooth, mask_color, mw, mh, 2680 mtex, mask_smooth, mask_color, mw, mh,
2678 NULL, &nomul, &masksam); 2681 EINA_FALSE, NULL, &nomul, &masksam);
2679 2682
2680 pn = _evas_gl_common_context_push(SHD_YUY2, 2683 pn = _evas_gl_common_context_push(SHD_YUY2,
2681 gc, tex, mtex, 2684 gc, tex, mtex,
@@ -2753,7 +2756,7 @@ evas_gl_common_context_nv12_push(Evas_Engine_GL_Context *gc,
2753 prog = evas_gl_common_shader_program_get(gc, SHD_NV12, NULL, 0, r, g, b, a, 2756 prog = evas_gl_common_shader_program_get(gc, SHD_NV12, NULL, 0, r, g, b, a,
2754 sw, sh, w, h, smooth, tex, 0, 2757 sw, sh, w, h, smooth, tex, 0,
2755 mtex, mask_smooth, mask_color, mw, mh, 2758 mtex, mask_smooth, mask_color, mw, mh,
2756 NULL, &nomul, &masksam); 2759 EINA_FALSE, NULL, &nomul, &masksam);
2757 2760
2758 pn = _evas_gl_common_context_push(SHD_NV12, 2761 pn = _evas_gl_common_context_push(SHD_NV12,
2759 gc, tex, mtex, 2762 gc, tex, mtex,
@@ -2838,7 +2841,7 @@ evas_gl_common_context_rgb_a_pair_push(Evas_Engine_GL_Context *gc,
2838 prog = evas_gl_common_shader_program_get(gc, SHD_RGB_A_PAIR, NULL, 0, r, g, b, a, 2841 prog = evas_gl_common_shader_program_get(gc, SHD_RGB_A_PAIR, NULL, 0, r, g, b, a,
2839 sw, sh, w, h, smooth, tex, 0, 2842 sw, sh, w, h, smooth, tex, 0,
2840 mtex, mask_smooth, mask_color, mw, mh, 2843 mtex, mask_smooth, mask_color, mw, mh,
2841 NULL, &nomul, &masksam); 2844 EINA_FALSE, NULL, &nomul, &masksam);
2842 2845
2843 pn = _evas_gl_common_context_push(SHD_RGB_A_PAIR, 2846 pn = _evas_gl_common_context_push(SHD_RGB_A_PAIR,
2844 gc, tex, mtex, 2847 gc, tex, mtex,
@@ -2969,7 +2972,7 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2969 prog = evas_gl_common_shader_program_get(gc, type, p, npoints, r, g, b, a, 2972 prog = evas_gl_common_shader_program_get(gc, type, p, npoints, r, g, b, a,
2970 w, h, w, h, smooth, tex, tex_only, 2973 w, h, w, h, smooth, tex, tex_only,
2971 mtex, mask_smooth, mask_color, mw, mh, 2974 mtex, mask_smooth, mask_color, mw, mh,
2972 NULL, &nomul, &masksam); 2975 EINA_FALSE, NULL, &nomul, &masksam);
2973 2976
2974 x = w = (p[0].x >> FP); 2977 x = w = (p[0].x >> FP);
2975 y = h = (p[0].y >> FP); 2978 y = h = (p[0].y >> FP);
@@ -3230,7 +3233,7 @@ evas_gl_common_filter_displace_push(Evas_Engine_GL_Context *gc,
3230 prog = evas_gl_common_shader_program_get(gc, SHD_FILTER_DISPLACE, NULL, 0, r, g, b, a, 3233 prog = evas_gl_common_shader_program_get(gc, SHD_FILTER_DISPLACE, NULL, 0, r, g, b, a,
3231 w, h, w, h, smooth, tex, EINA_FALSE, 3234 w, h, w, h, smooth, tex, EINA_FALSE,
3232 NULL, EINA_FALSE, EINA_FALSE, 0, 0, 3235 NULL, EINA_FALSE, EINA_FALSE, 0, 0,
3233 &sam, &nomul, NULL); 3236 EINA_FALSE, &sam, &nomul, NULL);
3234 _filter_data_flush(gc, prog); 3237 _filter_data_flush(gc, prog);
3235 3238
3236 pn = _evas_gl_common_context_push(SHD_FILTER_DISPLACE, gc, tex, NULL, prog, 3239 pn = _evas_gl_common_context_push(SHD_FILTER_DISPLACE, gc, tex, NULL, prog,
@@ -3349,7 +3352,7 @@ evas_gl_common_filter_curve_push(Evas_Engine_GL_Context *gc,
3349 prog = evas_gl_common_shader_program_get(gc, SHD_FILTER_CURVE, NULL, 0, r, g, b, a, 3352 prog = evas_gl_common_shader_program_get(gc, SHD_FILTER_CURVE, NULL, 0, r, g, b, a,
3350 w, h, w, h, smooth, tex, EINA_FALSE, 3353 w, h, w, h, smooth, tex, EINA_FALSE,
3351 NULL, EINA_FALSE, EINA_FALSE, 0, 0, 3354 NULL, EINA_FALSE, EINA_FALSE, 0, 0,
3352 &sam, &nomul, NULL); 3355 EINA_FALSE, &sam, &nomul, NULL);
3353 _filter_data_flush(gc, prog); 3356 _filter_data_flush(gc, prog);
3354 3357
3355 pn = _evas_gl_common_context_push(SHD_FILTER_CURVE, gc, tex, NULL, prog, 3358 pn = _evas_gl_common_context_push(SHD_FILTER_CURVE, gc, tex, NULL, prog,
@@ -3475,13 +3478,35 @@ evas_gl_common_filter_curve_push(Evas_Engine_GL_Context *gc,
3475} 3478}
3476 3479
3477void 3480void
3481evas_gl_common_filter_blend_push(Evas_Engine_GL_Context *gc,
3482 Evas_GL_Texture *tex,
3483 double sx, double sy, double sw, double sh,
3484 double dx, double dy, double dw, double dh,
3485 Eina_Bool alphaonly)
3486{
3487 int r, g, b, a;
3488
3489 r = R_VAL(&gc->dc->mul.col);
3490 g = G_VAL(&gc->dc->mul.col);
3491 b = B_VAL(&gc->dc->mul.col);
3492 a = A_VAL(&gc->dc->mul.col);
3493 if (alphaonly)
3494 r = g = b = a;
3495
3496 evas_gl_common_context_image_push(gc, tex, sx, sy, sw, sh, dx, dy, dw, dh,
3497 NULL, 0, 0, 0, 0, EINA_FALSE, EINA_FALSE,
3498 r, g, b, a, EINA_TRUE, EINA_FALSE,
3499 alphaonly);
3500}
3501
3502void
3478evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc, 3503evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc,
3479 Evas_GL_Texture *tex, 3504 Evas_GL_Texture *tex,
3480 double sx, double sy, double sw, double sh, 3505 double sx, double sy, double sw, double sh,
3481 double dx, double dy, double dw, double dh, 3506 double dx, double dy, double dw, double dh,
3482 const double * const weights, 3507 const double * const weights,
3483 const double * const offsets, int count, 3508 const double * const offsets, int count,
3484 double radius, Eina_Bool horiz) 3509 double radius, Eina_Bool horiz, Eina_Bool alphaonly)
3485{ 3510{
3486 double ox1, oy1, ox2, oy2, ox3, oy3, ox4, oy4, pw, ph, texlen; 3511 double ox1, oy1, ox2, oy2, ox3, oy3, ox4, oy4, pw, ph, texlen;
3487 GLfloat tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4; 3512 GLfloat tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4;
@@ -3505,7 +3530,7 @@ evas_gl_common_filter_blur_push(Evas_Engine_GL_Context *gc,
3505 prog = evas_gl_common_shader_program_get(gc, type, NULL, 0, r, g, b, a, 3530 prog = evas_gl_common_shader_program_get(gc, type, NULL, 0, r, g, b, a,
3506 sw, sh, dw, dh, smooth, tex, EINA_FALSE, 3531 sw, sh, dw, dh, smooth, tex, EINA_FALSE,
3507 NULL, EINA_FALSE, EINA_FALSE, 0, 0, 3532 NULL, EINA_FALSE, EINA_FALSE, 0, 0,
3508 NULL, &nomul, NULL); 3533 alphaonly, NULL, &nomul, NULL);
3509 3534
3510 _filter_data_flush(gc, prog); 3535 _filter_data_flush(gc, prog);
3511 EINA_SAFETY_ON_NULL_RETURN(prog); 3536 EINA_SAFETY_ON_NULL_RETURN(prog);
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index 58d0f806cb..87f2a20a6b 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -1321,7 +1321,7 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1321 dx, dy, dw, dh, 1321 dx, dy, dw, dh,
1322 mtex, mx, my, mw, mh, mask_smooth, mask_color, 1322 mtex, mx, my, mw, mh, mask_smooth, mask_color,
1323 r, g, b, a, 1323 r, g, b, a,
1324 smooth, im->tex_only); 1324 smooth, im->tex_only, EINA_FALSE);
1325 return; 1325 return;
1326 } 1326 }
1327 1327
@@ -1377,11 +1377,14 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1377 nx, ny, nw, nh, 1377 nx, ny, nw, nh,
1378 mtex, mx, my, mw, mh, mask_smooth, mask_color, 1378 mtex, mx, my, mw, mh, mask_smooth, mask_color,
1379 r, g, b, a, 1379 r, g, b, a,
1380 smooth, im->tex_only); 1380 smooth, im->tex_only, EINA_FALSE);
1381} 1381}
1382 1382
1383void 1383void
1384evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, int smooth) 1384evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1385 int sx, int sy, int sw, int sh,
1386 int dx, int dy, int dw, int dh,
1387 int smooth)
1385{ 1388{
1386 RGBA_Draw_Context *dc; 1389 RGBA_Draw_Context *dc;
1387 int r, g, b, a; 1390 int r, g, b, a;
@@ -1401,9 +1404,9 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
1401 if (dc->mul.use) 1404 if (dc->mul.use)
1402 { 1405 {
1403 a = (dc->mul.col >> 24) & 0xff; 1406 a = (dc->mul.col >> 24) & 0xff;
1404 r = (dc->mul.col >> 16) & 0xff; 1407 r = (dc->mul.col >> 16) & 0xff;
1405 g = (dc->mul.col >> 8 ) & 0xff; 1408 g = (dc->mul.col >> 8 ) & 0xff;
1406 b = (dc->mul.col ) & 0xff; 1409 b = (dc->mul.col ) & 0xff;
1407 } 1410 }
1408 else 1411 else
1409 { 1412 {
diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c
index c09625fbee..5aa0803741 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_shader.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c
@@ -44,8 +44,9 @@ typedef enum {
44 SHADER_FLAG_FILTER_CURVE = (1 << 22), 44 SHADER_FLAG_FILTER_CURVE = (1 << 22),
45 SHADER_FLAG_FILTER_BLUR = (1 << 23), 45 SHADER_FLAG_FILTER_BLUR = (1 << 23),
46 SHADER_FLAG_FILTER_DIR_Y = (1 << 24), 46 SHADER_FLAG_FILTER_DIR_Y = (1 << 24),
47 SHADER_FLAG_FILTER_ALPHA_ONLY = (1 << 25),
47} Shader_Flag; 48} Shader_Flag;
48#define SHADER_FLAG_COUNT 25 49#define SHADER_FLAG_COUNT 26
49 50
50static const char *_shader_flags[SHADER_FLAG_COUNT] = { 51static const char *_shader_flags[SHADER_FLAG_COUNT] = {
51 "TEX", 52 "TEX",
@@ -73,6 +74,7 @@ static const char *_shader_flags[SHADER_FLAG_COUNT] = {
73 "FILTER_CURVE", 74 "FILTER_CURVE",
74 "FILTER_BLUR", 75 "FILTER_BLUR",
75 "FILTER_DIR_Y", 76 "FILTER_DIR_Y",
77 "ALPHA_ONLY",
76}; 78};
77 79
78static Eina_Bool compiler_released = EINA_FALSE; 80static Eina_Bool compiler_released = EINA_FALSE;
@@ -734,6 +736,7 @@ evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type,
734 Evas_GL_Texture *tex, Eina_Bool tex_only, 736 Evas_GL_Texture *tex, Eina_Bool tex_only,
735 Evas_GL_Texture *mtex, Eina_Bool mask_smooth, 737 Evas_GL_Texture *mtex, Eina_Bool mask_smooth,
736 Eina_Bool mask_color, int mw, int mh, 738 Eina_Bool mask_color, int mw, int mh,
739 Eina_Bool alphaonly,
737 Shader_Sampling *psam, int *pnomul, Shader_Sampling *pmasksam) 740 Shader_Sampling *psam, int *pnomul, Shader_Sampling *pmasksam)
738{ 741{
739 Shader_Sampling sam = SHD_SAM11, masksam = SHD_SAM11; 742 Shader_Sampling sam = SHD_SAM11, masksam = SHD_SAM11;
@@ -818,6 +821,9 @@ evas_gl_common_shader_flags_get(Evas_GL_Shared *shared, Shader_Type type,
818 return 0; 821 return 0;
819 } 822 }
820 823
824 if (alphaonly)
825 flags |= SHADER_FLAG_FILTER_ALPHA_ONLY;
826
821 // color mul 827 // color mul
822 if ((a == 255) && (r == 255) && (g == 255) && (b == 255)) 828 if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
823 { 829 {
@@ -953,6 +959,7 @@ evas_gl_common_shader_program_get(Evas_Engine_GL_Context *gc,
953 Evas_GL_Texture *tex, Eina_Bool tex_only, 959 Evas_GL_Texture *tex, Eina_Bool tex_only,
954 Evas_GL_Texture *mtex, Eina_Bool mask_smooth, 960 Evas_GL_Texture *mtex, Eina_Bool mask_smooth,
955 Eina_Bool mask_color, int mw, int mh, 961 Eina_Bool mask_color, int mw, int mh,
962 Eina_Bool alphaonly,
956 Shader_Sampling *psam, int *pnomul, 963 Shader_Sampling *psam, int *pnomul,
957 Shader_Sampling *pmasksam) 964 Shader_Sampling *pmasksam)
958{ 965{
@@ -962,7 +969,7 @@ evas_gl_common_shader_program_get(Evas_Engine_GL_Context *gc,
962 flags = evas_gl_common_shader_flags_get(gc->shared, type, map_points, npoints, r, g, b, a, 969 flags = evas_gl_common_shader_flags_get(gc->shared, type, map_points, npoints, r, g, b, a,
963 sw, sh, w, h, smooth, tex, tex_only, 970 sw, sh, w, h, smooth, tex, tex_only,
964 mtex, mask_smooth, mask_color, mw, mh, 971 mtex, mask_smooth, mask_color, mw, mh,
965 psam, pnomul, pmasksam); 972 alphaonly, psam, pnomul, pmasksam);
966 p = eina_hash_find(gc->shared->shaders_hash, &flags); 973 p = eina_hash_find(gc->shared->shaders_hash, &flags);
967 if (!p) 974 if (!p)
968 { 975 {
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
index 13e20b8e0b..2b071f2316 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
@@ -211,6 +211,9 @@ static const char fragment_glsl[] =
211 " texture2D(tex_filter, vec2(c.b / old_alpha, 0.0)).b * new_alpha,\n" 211 " texture2D(tex_filter, vec2(c.b / old_alpha, 0.0)).b * new_alpha,\n"
212 " new_alpha);\n" 212 " new_alpha);\n"
213 "#endif\n" 213 "#endif\n"
214 "#ifdef SHD_ALPHA_ONLY\n"
215 " c = vec4(c.a, c.a, c.a, c.a);\n"
216 "#endif\n"
214 "#ifndef SHD_FILTER_BLUR\n" 217 "#ifndef SHD_FILTER_BLUR\n"
215 " gl_FragColor =\n" 218 " gl_FragColor =\n"
216 " c\n" 219 " c\n"
diff --git a/src/modules/evas/engines/gl_common/shader/fragment.glsl b/src/modules/evas/engines/gl_common/shader/fragment.glsl
index 999b893560..89f306062a 100644
--- a/src/modules/evas/engines/gl_common/shader/fragment.glsl
+++ b/src/modules/evas/engines/gl_common/shader/fragment.glsl
@@ -226,6 +226,10 @@ vec4 fetch_pixel(float ox, float oy)
226 new_alpha); 226 new_alpha);
227#endif 227#endif
228 228
229#ifdef SHD_ALPHA_ONLY
230 c = vec4(c.a, c.a, c.a, c.a);
231#endif
232
229#ifndef SHD_FILTER_BLUR 233#ifndef SHD_FILTER_BLUR
230 234
231 gl_FragColor = 235 gl_FragColor =
diff --git a/src/modules/evas/engines/gl_generic/filters/gl_filter_blend.c b/src/modules/evas/engines/gl_generic/filters/gl_filter_blend.c
index 768b35005d..19591d4340 100644
--- a/src/modules/evas/engines/gl_generic/filters/gl_filter_blend.c
+++ b/src/modules/evas/engines/gl_generic/filters/gl_filter_blend.c
@@ -6,7 +6,8 @@ _mapped_blend(Evas_Engine_GL_Context *gc,
6 Evas_GL_Image *image, 6 Evas_GL_Image *image,
7 Evas_Filter_Fill_Mode fillmode, 7 Evas_Filter_Fill_Mode fillmode,
8 int sx, int sy, int sw, int sh, 8 int sx, int sy, int sw, int sh,
9 int dx, int dy, int dw, int dh) 9 int dx, int dy, int dw, int dh,
10 Eina_Bool alphaonly)
10{ 11{
11 int right = 0, bottom = 0, left = 0, top = 0; 12 int right = 0, bottom = 0, left = 0, top = 0;
12 int row, col, rows, cols; 13 int row, col, rows, cols;
@@ -15,7 +16,7 @@ _mapped_blend(Evas_Engine_GL_Context *gc,
15 if (fillmode == EVAS_FILTER_FILL_MODE_NONE) 16 if (fillmode == EVAS_FILTER_FILL_MODE_NONE)
16 { 17 {
17 DBG("blend: %d,%d,%d,%d --> %d,%d,%d,%d", sx, sy, sw, sh, dx, dy, sw, sh); 18 DBG("blend: %d,%d,%d,%d --> %d,%d,%d,%d", sx, sy, sw, sh, dx, dy, sw, sh);
18 evas_gl_common_image_draw(gc, image, sx, sy, sw, sh, dx, dy, sw, sh, EINA_TRUE); 19 evas_gl_common_filter_blend_push(gc, image->tex, sx, sy, sw, sh, dx, dy, sw, sh, alphaonly);
19 return EINA_TRUE; 20 return EINA_TRUE;
20 } 21 }
21 22
@@ -148,8 +149,8 @@ _mapped_blend(Evas_Engine_GL_Context *gc,
148 "(src %dx%d, dst %dx%d)", 149 "(src %dx%d, dst %dx%d)",
149 col, row, src_x, src_y, src_w, src_h, 150 col, row, src_x, src_y, src_w, src_h,
150 dst_x, dst_y, dst_w, dst_h, sw, sh, dw, dh); 151 dst_x, dst_y, dst_w, dst_h, sw, sh, dw, dh);
151 evas_gl_common_image_draw(gc, image, src_x, src_y, src_w, src_h, 152 evas_gl_common_filter_blend_push(gc, image->tex, src_x, src_y, src_w, src_h,
152 dst_x, dst_y, dst_w, dst_h, EINA_TRUE); 153 dst_x, dst_y, dst_w, dst_h, alphaonly);
153 } 154 }
154 } 155 }
155 return ret; 156 return ret;
@@ -169,6 +170,7 @@ _gl_filter_blend(Render_Engine_GL_Generic *re, Evas_Filter_Command *cmd)
169 170
170 image = evas_ector_buffer_drawable_image_get(cmd->input->buffer); 171 image = evas_ector_buffer_drawable_image_get(cmd->input->buffer);
171 EINA_SAFETY_ON_NULL_RETURN_VAL(image, EINA_FALSE); 172 EINA_SAFETY_ON_NULL_RETURN_VAL(image, EINA_FALSE);
173 EINA_SAFETY_ON_NULL_RETURN_VAL(image->tex, EINA_FALSE);
172 174
173 surface = evas_ector_buffer_render_image_get(cmd->output->buffer); 175 surface = evas_ector_buffer_render_image_get(cmd->output->buffer);
174 EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE); 176 EINA_SAFETY_ON_NULL_RETURN_VAL(surface, EINA_FALSE);
@@ -232,7 +234,8 @@ _gl_filter_blend(Render_Engine_GL_Generic *re, Evas_Filter_Command *cmd)
232 cmd->output->id, cmd->output->buffer); 234 cmd->output->id, cmd->output->buffer);
233 _mapped_blend(gc, image, cmd->draw.fillmode, 235 _mapped_blend(gc, image, cmd->draw.fillmode,
234 src_x, src_y, src_w, src_h, 236 src_x, src_y, src_w, src_h,
235 dst_x, dst_y, dst_w, dst_h); 237 dst_x, dst_y, dst_w, dst_h,
238 cmd->draw.alphaonly);
236 239
237 evas_common_draw_context_free(gc->dc); 240 evas_common_draw_context_free(gc->dc);
238 gc->dc = dc_save; 241 gc->dc = dc_save;
diff --git a/src/modules/evas/engines/gl_generic/filters/gl_filter_blur.c b/src/modules/evas/engines/gl_generic/filters/gl_filter_blur.c
index 82a757a8c9..21b78198e1 100644
--- a/src/modules/evas/engines/gl_generic/filters/gl_filter_blur.c
+++ b/src/modules/evas/engines/gl_generic/filters/gl_filter_blur.c
@@ -248,7 +248,8 @@ _gl_filter_blur(Render_Engine_GL_Generic *re, Evas_Filter_Command *cmd)
248 ssh = ((double)sh * (double)(nh)) / (double)(dh); 248 ssh = ((double)sh * (double)(nh)) / (double)(dh);
249 249
250 evas_gl_common_filter_blur_push(gc, image->tex, ssx, ssy, ssw, ssh, dx, dy, dw, dh, 250 evas_gl_common_filter_blur_push(gc, image->tex, ssx, ssy, ssw, ssh, dx, dy, dw, dh,
251 weights, offsets, count, radius, horiz); 251 weights, offsets, count, radius, horiz,
252 cmd->draw.alphaonly);
252 } 253 }
253 254
254 free(weights); 255 free(weights);
diff --git a/src/modules/evas/engines/gl_generic/filters/gl_filter_mask.c b/src/modules/evas/engines/gl_generic/filters/gl_filter_mask.c
index 39e0bc7696..755dedb04a 100644
--- a/src/modules/evas/engines/gl_generic/filters/gl_filter_mask.c
+++ b/src/modules/evas/engines/gl_generic/filters/gl_filter_mask.c
@@ -50,7 +50,8 @@ _gl_filter_mask(Render_Engine_GL_Generic *re, Evas_Filter_Command *cmd)
50 gc->dc->clip.mask_x = x; 50 gc->dc->clip.mask_x = x;
51 gc->dc->clip.mask_y = y; 51 gc->dc->clip.mask_y = y;
52 52
53 evas_gl_common_image_draw(gc, image, x, y, sw, sh, x, y, sw, sh, EINA_TRUE); 53 evas_gl_common_filter_blend_push(gc, image->tex, x, y, sw, sh, x, y, sw, sh,
54 cmd->draw.alphaonly);
54 } 55 }
55 56
56 evas_gl_common_image_free(use_mask); 57 evas_gl_common_image_free(use_mask);
diff --git a/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c b/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c
index 5573010b9f..12745c4037 100644
--- a/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c
+++ b/src/modules/evas/engines/software_generic/filters/evas_filter_blend.c
@@ -8,11 +8,12 @@
8typedef Eina_Bool (*draw_func) (void *context, const void *src_map, unsigned int src_stride, void *dst_map, unsigned int dst_stride, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth, Eina_Bool do_async); 8typedef Eina_Bool (*draw_func) (void *context, const void *src_map, unsigned int src_stride, void *dst_map, unsigned int dst_stride, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth, Eina_Bool do_async);
9static Eina_Bool _mapped_blend(void *drawctx, const void *src_map, unsigned int src_stride, void *dst_map, unsigned int dst_stride, Evas_Filter_Fill_Mode fillmode, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, draw_func image_draw); 9static Eina_Bool _mapped_blend(void *drawctx, const void *src_map, unsigned int src_stride, void *dst_map, unsigned int dst_stride, Evas_Filter_Fill_Mode fillmode, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh, draw_func image_draw);
10 10
11struct Filter_Blend_Draw_Context 11typedef struct _Filter_Blend_Draw_Context
12{ 12{
13 Efl_Gfx_Render_Op rop; 13 Efl_Gfx_Render_Op rop;
14 uint32_t color; 14 uint32_t color;
15}; 15 Eina_Bool alphaonly;
16} Filter_Blend_Draw_Context;
16 17
17#define LINELEN(stride, ptr) (stride / (sizeof(*ptr))) 18#define LINELEN(stride, ptr) (stride / (sizeof(*ptr)))
18 19
@@ -25,7 +26,7 @@ _image_draw_cpu_alpha_alpha(void *context,
25 int smooth EINA_UNUSED, 26 int smooth EINA_UNUSED,
26 Eina_Bool do_async EINA_UNUSED) 27 Eina_Bool do_async EINA_UNUSED)
27{ 28{
28 struct Filter_Blend_Draw_Context *dc = context; 29 Filter_Blend_Draw_Context *dc = context;
29 const uint8_t *srcdata = src_map; 30 const uint8_t *srcdata = src_map;
30 uint8_t *dstdata = dst_map; 31 uint8_t *dstdata = dst_map;
31 Draw_Func_Alpha func; 32 Draw_Func_Alpha func;
@@ -60,7 +61,7 @@ _image_draw_cpu_alpha_rgba(void *context,
60 int smooth EINA_UNUSED, 61 int smooth EINA_UNUSED,
61 Eina_Bool do_async EINA_UNUSED) 62 Eina_Bool do_async EINA_UNUSED)
62{ 63{
63 struct Filter_Blend_Draw_Context *dc = context; 64 Filter_Blend_Draw_Context *dc = context;
64 uint8_t *srcdata = (uint8_t *) src_map; 65 uint8_t *srcdata = (uint8_t *) src_map;
65 uint32_t *dstdata = dst_map; 66 uint32_t *dstdata = dst_map;
66 RGBA_Comp_Func_Mask func; 67 RGBA_Comp_Func_Mask func;
@@ -95,7 +96,7 @@ _image_draw_cpu_rgba_rgba(void *context,
95 int smooth EINA_UNUSED, 96 int smooth EINA_UNUSED,
96 Eina_Bool do_async EINA_UNUSED) 97 Eina_Bool do_async EINA_UNUSED)
97{ 98{
98 struct Filter_Blend_Draw_Context *dc = context; 99 Filter_Blend_Draw_Context *dc = context;
99 uint32_t *srcdata = (uint32_t *) src_map; 100 uint32_t *srcdata = (uint32_t *) src_map;
100 uint32_t *dstdata = dst_map; 101 uint32_t *dstdata = dst_map;
101 RGBA_Comp_Func func; 102 RGBA_Comp_Func func;
@@ -125,7 +126,7 @@ _image_draw_cpu_rgba_rgba(void *context,
125} 126}
126 127
127static Eina_Bool 128static Eina_Bool
128_image_draw_cpu_rgba_alpha(void *context EINA_UNUSED, 129_image_draw_cpu_rgba_alpha(void *context,
129 const void *src_map, unsigned int src_stride, 130 const void *src_map, unsigned int src_stride,
130 void *dst_map, unsigned int dst_stride, 131 void *dst_map, unsigned int dst_stride,
131 int src_x, int src_y, int src_w, int src_h, 132 int src_x, int src_y, int src_w, int src_h,
@@ -133,6 +134,8 @@ _image_draw_cpu_rgba_alpha(void *context EINA_UNUSED,
133 int smooth EINA_UNUSED, 134 int smooth EINA_UNUSED,
134 Eina_Bool do_async EINA_UNUSED) 135 Eina_Bool do_async EINA_UNUSED)
135{ 136{
137 Filter_Blend_Draw_Context *dc = context;
138 Eina_Bool alphaonly = dc && dc->alphaonly;
136 uint32_t *srcdata = (uint32_t *) src_map; 139 uint32_t *srcdata = (uint32_t *) src_map;
137 uint8_t *dstdata = dst_map; 140 uint8_t *dstdata = dst_map;
138 int x, y, sw, dw; 141 int x, y, sw, dw;
@@ -156,14 +159,30 @@ _image_draw_cpu_rgba_alpha(void *context EINA_UNUSED,
156 159
157 srcdata += src_y * sw; 160 srcdata += src_y * sw;
158 dstdata += dst_y * dw; 161 dstdata += dst_y * dw;
159 for (y = src_h; y; y--) 162
163 if (!alphaonly)
160 { 164 {
161 uint32_t *s = srcdata + src_x; 165 for (y = src_h; y; y--)
162 uint8_t *d = dstdata + dst_x; 166 {
163 for (x = src_w; x; x--, d++, s++) 167 uint32_t *s = srcdata + src_x;
164 *d = DIVIDE((R_VAL(s) * WR) + (G_VAL(s) * WG) + (B_VAL(s) * WB)); 168 uint8_t *d = dstdata + dst_x;
165 srcdata += sw; 169 for (x = src_w; x; x--, d++, s++)
166 dstdata += dw; 170 *d = (uint8_t) DIVIDE((R_VAL(s) * WR) + (G_VAL(s) * WG) + (B_VAL(s) * WB));
171 srcdata += sw;
172 dstdata += dw;
173 }
174 }
175 else
176 {
177 for (y = src_h; y; y--)
178 {
179 uint32_t *s = srcdata + src_x;
180 uint8_t *d = dstdata + dst_x;
181 for (x = src_w; x; x--, d++, s++)
182 *d = A_VAL(s);
183 srcdata += sw;
184 dstdata += dw;
185 }
167 } 186 }
168 187
169 return EINA_TRUE; 188 return EINA_TRUE;
@@ -174,7 +193,7 @@ _filter_blend_cpu_generic_do(Evas_Filter_Command *cmd, draw_func image_draw)
174{ 193{
175 unsigned int src_len, src_stride, dst_len, dst_stride; 194 unsigned int src_len, src_stride, dst_len, dst_stride;
176 int sw, sh, dx, dy, dw, dh, sx, sy; 195 int sw, sh, dx, dy, dw, dh, sx, sy;
177 struct Filter_Blend_Draw_Context dc; 196 Filter_Blend_Draw_Context dc;
178 Eina_Bool ret = EINA_FALSE; 197 Eina_Bool ret = EINA_FALSE;
179 Evas_Filter_Buffer *src_fb; 198 Evas_Filter_Buffer *src_fb;
180 void *src = NULL, *dst = NULL; 199 void *src = NULL, *dst = NULL;
@@ -220,6 +239,7 @@ _filter_blend_cpu_generic_do(Evas_Filter_Command *cmd, draw_func image_draw)
220 EINA_SAFETY_ON_FALSE_GOTO(src && dst, end); 239 EINA_SAFETY_ON_FALSE_GOTO(src && dst, end);
221 240
222 dc.rop = cmd->draw.rop; 241 dc.rop = cmd->draw.rop;
242 dc.alphaonly = cmd->draw.alphaonly;
223 dc.color = ARGB_JOIN(cmd->draw.A, cmd->draw.R, cmd->draw.G, cmd->draw.B); 243 dc.color = ARGB_JOIN(cmd->draw.A, cmd->draw.R, cmd->draw.G, cmd->draw.B);
224 244
225 ret = _mapped_blend(&dc, src, src_stride, dst, dst_stride, cmd->draw.fillmode, 245 ret = _mapped_blend(&dc, src, src_stride, dst, dst_stride, cmd->draw.fillmode,