summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-11-13 10:04:00 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-07 15:06:02 +0900
commit9af60b1b04a877c70f78ced137a6886b403b25f6 (patch)
treed8144f050622330aa65b7b7f0e4cf597a90b20eb /src/modules
parenta86f799542b8663a5a5e2f02ebc6b77efecdb29f (diff)
Evas masking: Use alpha mask in SW engine draw functions
Work done by Jaeun Choi, rebased & squashed by jpeg. This commit introduces changes to the low-level draw functions of the SW engine considering the existence of an alpha mask image. Features: - Font masking (TEXT, TEXTBLOCK), - Rectangle masking, - Image masking (all image scaling functions should be handled). The mask image itself is not yet set in the draw context (see following commits). @feature Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index ac9e086b0d..673924c50e 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -296,6 +296,8 @@ struct _Evas_Thread_Command_Rect
296 DATA32 color; 296 DATA32 color;
297 int render_op; 297 int render_op;
298 int x, y, w, h; 298 int x, y, w, h;
299 void *mask;
300 int mask_x, mask_y;
299}; 301};
300 302
301struct _Evas_Thread_Command_Line 303struct _Evas_Thread_Command_Line
@@ -327,6 +329,8 @@ struct _Evas_Thread_Command_Image
327 DATA32 mul_col; 329 DATA32 mul_col;
328 int render_op; 330 int render_op;
329 int smooth; 331 int smooth;
332 void *mask;
333 int mask_x, mask_y;
330}; 334};
331 335
332struct _Evas_Thread_Command_Font 336struct _Evas_Thread_Command_Font
@@ -341,9 +345,11 @@ struct _Evas_Thread_Command_Font
341 void *gl_draw; 345 void *gl_draw;
342 void *font_ext_data; 346 void *font_ext_data;
343 DATA32 col; 347 DATA32 col;
344 Eina_Bool clip_use : 1;
345 Eina_Rectangle clip_rect, ext; 348 Eina_Rectangle clip_rect, ext;
346 int im_w, im_h; 349 int im_w, im_h;
350 void *mask;
351 int mask_x, mask_y;
352 Eina_Bool clip_use : 1;
347}; 353};
348 354
349struct _Evas_Thread_Command_Map 355struct _Evas_Thread_Command_Map
@@ -525,7 +531,8 @@ _draw_thread_rectangle_draw(void *data)
525 531
526 evas_common_rectangle_rgba_draw(rect->surface, 532 evas_common_rectangle_rgba_draw(rect->surface,
527 rect->color, rect->render_op, 533 rect->color, rect->render_op,
528 rect->x, rect->y, rect->w, rect->h); 534 rect->x, rect->y, rect->w, rect->h,
535 rect->mask, rect->mask_x, rect->mask_y);
529 536
530 eina_mempool_free(_mp_command_rect, rect); 537 eina_mempool_free(_mp_command_rect, rect);
531} 538}
@@ -548,6 +555,9 @@ _draw_rectangle_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y,
548 cr->y = y; 555 cr->y = y;
549 cr->w = w; 556 cr->w = w;
550 cr->h = h; 557 cr->h = h;
558 cr->mask = dc->clip.mask;
559 cr->mask_x = dc->clip.mask_x;
560 cr->mask_y = dc->clip.mask_y;
551 561
552 evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, cr); 562 evas_thread_cmd_enqueue(_draw_thread_rectangle_draw, cr);
553} 563}
@@ -1239,14 +1249,16 @@ _draw_thread_image_draw(void *data)
1239 image->clip.x, image->clip.y, image->clip.w, image->clip.h, 1249 image->clip.x, image->clip.y, image->clip.w, image->clip.h,
1240 image->mul_col, image->render_op, 1250 image->mul_col, image->render_op,
1241 image->src.x, image->src.y, image->src.w, image->src.h, 1251 image->src.x, image->src.y, image->src.w, image->src.h,
1242 image->dst.x, image->dst.y, image->dst.w, image->dst.h); 1252 image->dst.x, image->dst.y, image->dst.w, image->dst.h,
1253 image->mask, image->mask_x, image->mask_y);
1243 else 1254 else
1244 evas_common_scale_rgba_sample_draw 1255 evas_common_scale_rgba_sample_draw
1245 (image->image, image->surface, 1256 (image->image, image->surface,
1246 image->clip.x, image->clip.y, image->clip.w, image->clip.h, 1257 image->clip.x, image->clip.y, image->clip.w, image->clip.h,
1247 image->mul_col, image->render_op, 1258 image->mul_col, image->render_op,
1248 image->src.x, image->src.y, image->src.w, image->src.h, 1259 image->src.x, image->src.y, image->src.w, image->src.h,
1249 image->dst.x, image->dst.y, image->dst.w, image->dst.h); 1260 image->dst.x, image->dst.y, image->dst.w, image->dst.h,
1261 image->mask, image->mask_x, image->mask_y);
1250 1262
1251 eina_mempool_free(_mp_command_image, image); 1263 eina_mempool_free(_mp_command_image, image);
1252} 1264}
@@ -1289,6 +1301,9 @@ _image_draw_thread_cmd(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc,
1289 cr->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff; 1301 cr->mul_col = dc->mul.use ? dc->mul.col : 0xffffffff;
1290 cr->render_op = dc->render_op; 1302 cr->render_op = dc->render_op;
1291 cr->smooth = smooth; 1303 cr->smooth = smooth;
1304 cr->mask = dc->clip.mask;
1305 cr->mask_x = dc->clip.mask_x;
1306 cr->mask_y = dc->clip.mask_y;
1292 1307
1293 evas_thread_cmd_enqueue(_draw_thread_image_draw, cr); 1308 evas_thread_cmd_enqueue(_draw_thread_image_draw, cr);
1294 1309
@@ -1429,13 +1444,15 @@ _map_image_draw(RGBA_Image *src, RGBA_Image *dst, RGBA_Draw_Context *dc, int src
1429 clip_x, clip_y, clip_w, clip_h, 1444 clip_x, clip_y, clip_w, clip_h,
1430 mul_col, dc->render_op, 1445 mul_col, dc->render_op,
1431 src_x, src_y, src_w, src_h, 1446 src_x, src_y, src_w, src_h,
1432 dst_x, dst_y, dst_w, dst_h); 1447 dst_x, dst_y, dst_w, dst_h,
1448 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
1433 else 1449 else
1434 evas_common_scale_rgba_sample_draw(src, dst, 1450 evas_common_scale_rgba_sample_draw(src, dst,
1435 clip_x, clip_y, clip_w, clip_h, 1451 clip_x, clip_y, clip_w, clip_h,
1436 mul_col, dc->render_op, 1452 mul_col, dc->render_op,
1437 src_x, src_y, src_w, src_h, 1453 src_x, src_y, src_w, src_h,
1438 dst_x, dst_y, dst_w, dst_h); 1454 dst_x, dst_y, dst_w, dst_h,
1455 dc->clip.mask, dc->clip.mask_x, dc->clip.mask_y);
1439} 1456}
1440 1457
1441static Eina_Bool 1458static Eina_Bool
@@ -2152,6 +2169,9 @@ _draw_thread_font_draw(void *data)
2152 dc.clip.y = font->clip_rect.y; 2169 dc.clip.y = font->clip_rect.y;
2153 dc.clip.w = font->clip_rect.w; 2170 dc.clip.w = font->clip_rect.w;
2154 dc.clip.h = font->clip_rect.h; 2171 dc.clip.h = font->clip_rect.h;
2172 dc.clip.mask = font->mask;
2173 dc.clip.mask_x = font->mask_x;
2174 dc.clip.mask_y = font->mask_y;
2155 2175
2156 evas_common_font_rgba_draw 2176 evas_common_font_rgba_draw
2157 (font->dst, &dc, 2177 (font->dst, &dc,
@@ -2186,6 +2206,9 @@ _font_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y, Evas
2186 EINA_RECTANGLE_SET(&cf->ext, ext_x, ext_y, ext_w, ext_h); 2206 EINA_RECTANGLE_SET(&cf->ext, ext_x, ext_y, ext_w, ext_h);
2187 cf->im_w = im_w; 2207 cf->im_w = im_w;
2188 cf->im_h = im_h; 2208 cf->im_h = im_h;
2209 cf->mask = dc->clip.mask;
2210 cf->mask_x = dc->clip.mask_x;
2211 cf->mask_y = dc->clip.mask_y;
2189 2212
2190 evas_thread_cmd_enqueue(_draw_thread_font_draw, cf); 2213 evas_thread_cmd_enqueue(_draw_thread_font_draw, cf);
2191 2214