summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-11-20 14:56:36 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-12-22 22:33:11 +0900
commitdcfce03791889e71fdef283e60cb1d874b9511c9 (patch)
treee854f172670b0f3f0b2b87da4935bc2d21b2e828
parent5350cbe972e5d2b63a60b26e3a4bd400aab9a932 (diff)
Evas masking: Implement support for polygon draw (SW)
-rw-r--r--src/lib/evas/common/evas_polygon.h2
-rw-r--r--src/lib/evas/common/evas_polygon_main.c36
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c9
3 files changed, 40 insertions, 7 deletions
diff --git a/src/lib/evas/common/evas_polygon.h b/src/lib/evas/common/evas_polygon.h
index e30f76483b..dee63c1ff6 100644
--- a/src/lib/evas/common/evas_polygon.h
+++ b/src/lib/evas/common/evas_polygon.h
@@ -8,7 +8,7 @@ EAPI RGBA_Polygon_Point *evas_common_polygon_point_add (RGBA_Polygon_Point *p
8EAPI RGBA_Polygon_Point *evas_common_polygon_points_clear (RGBA_Polygon_Point *points); 8EAPI RGBA_Polygon_Point *evas_common_polygon_points_clear (RGBA_Polygon_Point *points);
9EAPI void evas_common_polygon_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y); 9EAPI void evas_common_polygon_draw (RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Point *points, int x, int y);
10 10
11EAPI void evas_common_polygon_rgba_draw (RGBA_Image *dst, int ext_x, int ext_y, int ext_w, int ext_h, DATA32 col, int render_op, RGBA_Polygon_Point *points, int x, int y); 11EAPI void evas_common_polygon_rgba_draw (RGBA_Image *dst, int ext_x, int ext_y, int ext_w, int ext_h, DATA32 col, int render_op, RGBA_Polygon_Point *points, int x, int y, RGBA_Image *mask_ie, int mask_x, int mask_y);
12 12
13#endif /* _EVAS_POLYGON_H */ 13#endif /* _EVAS_POLYGON_H */
14 14
diff --git a/src/lib/evas/common/evas_polygon_main.c b/src/lib/evas/common/evas_polygon_main.c
index db56cdb61e..3b8690427a 100644
--- a/src/lib/evas/common/evas_polygon_main.c
+++ b/src/lib/evas/common/evas_polygon_main.c
@@ -279,7 +279,10 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
279 free(point); 279 free(point);
280 free(sorted_index); 280 free(sorted_index);
281 281
282 func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, 1, dc->render_op); 282 if(dc->clip.mask)
283 func = evas_common_gfx_func_composite_mask_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, 1, dc->render_op);
284 else
285 func = evas_common_gfx_func_composite_color_span_get(dc->col.col, dst->cache_entry.flags.alpha, 1, dc->render_op);
283 if (spans) 286 if (spans)
284 { 287 {
285 RGBA_Span *span; 288 RGBA_Span *span;
@@ -287,6 +290,8 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
287 EINA_INLIST_FOREACH(spans, span) 290 EINA_INLIST_FOREACH(spans, span)
288 { 291 {
289 DATA32 *ptr; 292 DATA32 *ptr;
293 DATA8 *mask;
294 RGBA_Image *mask_ie;
290 295
291#ifdef HAVE_PIXMAN 296#ifdef HAVE_PIXMAN
292# ifdef PIXMAN_POLY 297# ifdef PIXMAN_POLY
@@ -300,7 +305,16 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
300#endif 305#endif
301 { 306 {
302 ptr = dst->image.data + (span->y * (dst->cache_entry.w)) + span->x; 307 ptr = dst->image.data + (span->y * (dst->cache_entry.w)) + span->x;
303 func(NULL, NULL, dc->col.col, ptr, span->w); 308 if (dc->clip.mask)
309 {
310 mask_ie = dc->clip.mask;
311 mask = mask_ie->image.data8
312 + ((span->y - dc->clip.mask_y) * mask_ie->cache_entry.w)
313 + (span->x - dc->clip.mask_x);
314 func(NULL, mask, dc->col.col, ptr, span->w);
315 }
316 else
317 func(NULL, NULL, dc->col.col, ptr, span->w);
304 } 318 }
305 } 319 }
306 while (spans) 320 while (spans)
@@ -313,7 +327,7 @@ evas_common_polygon_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
313} 327}
314 328
315EAPI void 329EAPI void
316evas_common_polygon_rgba_draw(RGBA_Image *dst, int ext_x, int ext_y, int ext_w, int ext_h, DATA32 col, int render_op, RGBA_Polygon_Point *points, int x, int y) 330evas_common_polygon_rgba_draw(RGBA_Image *dst, int ext_x, int ext_y, int ext_w, int ext_h, DATA32 col, int render_op, RGBA_Polygon_Point *points, int x, int y, RGBA_Image *mask_ie, int mask_x, int mask_y)
317{ 331{
318 RGBA_Gfx_Func func; 332 RGBA_Gfx_Func func;
319 RGBA_Polygon_Point *pt; 333 RGBA_Polygon_Point *pt;
@@ -435,17 +449,29 @@ evas_common_polygon_rgba_draw(RGBA_Image *dst, int ext_x, int ext_y, int ext_w,
435 free(point); 449 free(point);
436 free(sorted_index); 450 free(sorted_index);
437 451
438 func = evas_common_gfx_func_composite_color_span_get(col, dst->cache_entry.flags.alpha, 1, render_op); 452 if (mask_ie)
453 func = evas_common_gfx_func_composite_mask_color_span_get(col, dst->cache_entry.flags.alpha, 1, render_op);
454 else
455 func = evas_common_gfx_func_composite_color_span_get(col, dst->cache_entry.flags.alpha, 1, render_op);
439 if (spans) 456 if (spans)
440 { 457 {
441 RGBA_Span *span; 458 RGBA_Span *span;
459 DATA8 *mask;
442 460
443 EINA_INLIST_FOREACH(spans, span) 461 EINA_INLIST_FOREACH(spans, span)
444 { 462 {
445 DATA32 *ptr; 463 DATA32 *ptr;
446 464
447 ptr = dst->image.data + (span->y * (dst->cache_entry.w)) + span->x; 465 ptr = dst->image.data + (span->y * (dst->cache_entry.w)) + span->x;
448 func(NULL, NULL, col, ptr, span->w); 466 if (mask_ie)
467 {
468 mask = mask_ie->image.data8
469 + ((span->y - mask_y) * mask_ie->cache_entry.w)
470 + (span->x - mask_x);
471 func(NULL, mask, col, ptr, span->w);
472 }
473 else
474 func(NULL, NULL, col, ptr, span->w);
449 } 475 }
450 while (spans) 476 while (spans)
451 { 477 {
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 2484532a46..4bd1fd2b35 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -321,6 +321,8 @@ struct _Evas_Thread_Command_Polygon
321 void *surface; 321 void *surface;
322 RGBA_Polygon_Point *points; 322 RGBA_Polygon_Point *points;
323 int x, y; 323 int x, y;
324 void *mask;
325 int mask_x, mask_y;
324}; 326};
325 327
326struct _Evas_Thread_Command_Image 328struct _Evas_Thread_Command_Image
@@ -799,7 +801,8 @@ _draw_thread_polygon_draw(void *data)
799 (poly->surface, 801 (poly->surface,
800 poly->ext.x, poly->ext.y, poly->ext.w, poly->ext.h, 802 poly->ext.x, poly->ext.y, poly->ext.w, poly->ext.h,
801 poly->col, poly->render_op, 803 poly->col, poly->render_op,
802 poly->points, poly->x, poly->y); 804 poly->points, poly->x, poly->y,
805 poly->mask, poly->mask_x, poly->mask_y);
803 806
804 _draw_thread_polygon_cleanup(poly); 807 _draw_thread_polygon_cleanup(poly);
805 eina_mempool_free(_mp_command_polygon, poly); 808 eina_mempool_free(_mp_command_polygon, poly);
@@ -873,6 +876,10 @@ _polygon_draw_thread_cmd(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Polygon_Po
873 cp->x = x; 876 cp->x = x;
874 cp->y = y; 877 cp->y = y;
875 878
879 cp->mask = dc->clip.mask;
880 cp->mask_x = dc->clip.mask_x;
881 cp->mask_y = dc->clip.mask_y;
882
876 evas_thread_cmd_enqueue(_draw_thread_polygon_draw, cp); 883 evas_thread_cmd_enqueue(_draw_thread_polygon_draw, cp);
877} 884}
878 885