summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_line_main.c
diff options
context:
space:
mode:
authorJaeun Choi <jaeun12.choi@samsung.com>2014-11-13 20:45:14 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-07 15:06:02 +0900
commit6747fadd9a697236c5307f8cb1cb5e9ceec6dabe (patch)
tree9d518c839a279e1689d2375e9750c68df4a9e935 /src/lib/evas/common/evas_line_main.c
parent145fe108b8fe477161136317f65145bc5102a059 (diff)
Evas masking: Implement support for line draw (SW)
Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
Diffstat (limited to 'src/lib/evas/common/evas_line_main.c')
-rw-r--r--src/lib/evas/common/evas_line_main.c356
1 files changed, 307 insertions, 49 deletions
diff --git a/src/lib/evas/common/evas_line_main.c b/src/lib/evas/common/evas_line_main.c
index 8301dccee9..109e256ac7 100644
--- a/src/lib/evas/common/evas_line_main.c
+++ b/src/lib/evas/common/evas_line_main.c
@@ -29,6 +29,7 @@ static void
29_evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y) 29_evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y)
30{ 30{
31 RGBA_Gfx_Pt_Func pfunc; 31 RGBA_Gfx_Pt_Func pfunc;
32 DATA8 *mask = NULL;
32 33
33 if (!dst->image.data) return; 34 if (!dst->image.data) return;
34 if (!IN_RANGE(x, y, dst->cache_entry.w, dst->cache_entry.h)) 35 if (!IN_RANGE(x, y, dst->cache_entry.w, dst->cache_entry.h))
@@ -49,17 +50,31 @@ _evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y)
49# endif 50# endif
50#endif 51#endif
51 { 52 {
52 pfunc = evas_common_gfx_func_composite_color_pt_get(dc->col.col, dst->cache_entry.flags.alpha, dc->render_op); 53 if (dc->clip.mask)
53 if (pfunc) 54 {
54 pfunc(0, 255, dc->col.col, dst->image.data + (dst->cache_entry.w * y) + x); 55 RGBA_Image *im = dc->clip.mask;
56 mask = im->image.data8
57 + (y - dc->clip.mask_y) * im->cache_entry.w
58 + (x - dc->clip.mask_x);
59 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(dc->col.col, dst->cache_entry.flags.alpha, dc->render_op);
60 if (pfunc)
61 pfunc(0, *mask, dc->col.col, dst->image.data + (dst->cache_entry.w * y) + x);
62 }
63 else
64 {
65 pfunc = evas_common_gfx_func_composite_color_pt_get(dc->col.col, dst->cache_entry.flags.alpha, dc->render_op);
66 if (pfunc)
67 pfunc(0, 255, dc->col.col, dst->image.data + (dst->cache_entry.w * y) + x);
68 }
55 } 69 }
56} 70}
57 71
58EAPI void 72EAPI void
59evas_common_line_point_draw(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x, int y) 73evas_common_line_point_draw(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x, int y, RGBA_Image *mask_ie, int mask_x, int mask_y)
60{ 74{
61 Eina_Bool no_cuse; 75 Eina_Bool no_cuse;
62 RGBA_Gfx_Pt_Func pfunc; 76 RGBA_Gfx_Pt_Func pfunc;
77 DATA8 *mask = NULL;
63 78
64 if (!dst->image.data) return; 79 if (!dst->image.data) return;
65 no_cuse = ((clip_x == 0) && (clip_y == 0) && 80 no_cuse = ((clip_x == 0) && (clip_y == 0) &&
@@ -70,9 +85,21 @@ evas_common_line_point_draw(RGBA_Image *dst, int clip_x, int clip_y, int clip_w,
70 if ((!no_cuse) && (!IN_RECT(x, y, clip_x, clip_y, clip_w, clip_h))) 85 if ((!no_cuse) && (!IN_RECT(x, y, clip_x, clip_y, clip_w, clip_h)))
71 return; 86 return;
72 87
73 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, render_op); 88 if (mask_ie)
74 if (pfunc) 89 {
75 pfunc(0, 255, color, dst->image.data + (dst->cache_entry.w * y) + x); 90 mask = mask_ie->image.data8
91 + (y - mask_y) * mask_ie->cache_entry.w
92 + (x - mask_x);
93 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(color, dst->cache_entry.flags.alpha, render_op);
94 if (pfunc)
95 pfunc(0, *mask, color, dst->image.data + (dst->cache_entry.w * y) + x);
96 }
97 else
98 {
99 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, render_op);
100 if (pfunc)
101 pfunc(0, 255, color, dst->image.data + (dst->cache_entry.w * y) + x);
102 }
76} 103}
77 104
78/* 105/*
@@ -86,8 +113,9 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
86{ 113{
87 int dx, dy, len, lx, ty, rx, by; 114 int dx, dy, len, lx, ty, rx, by;
88 int clx, cly, clw, clh; 115 int clx, cly, clw, clh;
89 int dstw; 116 int dstw, mask_w = 0;
90 DATA32 *p, color; 117 DATA32 *p, color;
118 DATA8 *mask = NULL;
91 RGBA_Gfx_Pt_Func pfunc; 119 RGBA_Gfx_Pt_Func pfunc;
92 RGBA_Gfx_Func sfunc; 120 RGBA_Gfx_Func sfunc;
93 121
@@ -147,15 +175,30 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
147# endif 175# endif
148#endif 176#endif
149 { 177 {
150 sfunc = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, len, dc->render_op); 178 if (dc->clip.mask)
151 if (sfunc) 179 {
152 sfunc(NULL, NULL, color, p, len); 180 RGBA_Image *im = dc->clip.mask;
181 mask = im->image.data8
182 + ((y0 - dc->clip.mask_y) * im->cache_entry.w)
183 + (x0 - dc->clip.mask_x);
184 sfunc = evas_common_gfx_func_composite_mask_color_span_get(color, dst->cache_entry.flags.alpha, len, dc->render_op);
185 if (sfunc) sfunc(NULL, mask, color, p, len);
186 }
187 else
188 {
189 sfunc = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, len, dc->render_op);
190 if (sfunc)
191 sfunc(NULL, NULL, color, p, len);
192 }
153 } 193 }
154 } 194 }
155 return; 195 return;
156 } 196 }
157 197
158 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, dc->render_op); 198 if (dc->clip.mask)
199 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(color, dst->cache_entry.flags.alpha, dc->render_op);
200 else
201 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, dc->render_op);
159 if (!pfunc) return; 202 if (!pfunc) return;
160 203
161 if (dx == 0) 204 if (dx == 0)
@@ -177,10 +220,27 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
177# endif 220# endif
178#endif 221#endif
179 { 222 {
180 while (len--) 223 if (dc->clip.mask)
181 { 224 {
182 pfunc(0, 255, color, p); 225 RGBA_Image *im = dc->clip.mask;
183 p += dstw; 226 mask_w = im->cache_entry.w;
227 mask = im->image.data8
228 + ((y0 - dc->clip.mask_y) * mask_w)
229 + (x0 - dc->clip.mask_x);
230 while (len--)
231 {
232 pfunc(0, *mask, color, p);
233 p += dstw;
234 mask += mask_w;
235 }
236 }
237 else
238 {
239 while (len--)
240 {
241 pfunc(0, 255, color, p);
242 p += dstw;
243 }
184 } 244 }
185 } 245 }
186 } 246 }
@@ -254,6 +314,16 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
254 len = y1 - y0 + 1; 314 len = y1 - y0 + 1;
255 if (dx > 0) dstw++; 315 if (dx > 0) dstw++;
256 else dstw--; 316 else dstw--;
317 if (dc->clip.mask)
318 {
319 RGBA_Image *im = dc->clip.mask;
320 mask_w = im->cache_entry.w;
321 mask = im->image.data8
322 + ((y0 - dc->clip.mask_y) * mask_w)
323 + (x0 - dc->clip.mask_x);
324 if (dx > 0) mask_w++;
325 else mask_w--;
326 }
257 } 327 }
258 else 328 else
259 { 329 {
@@ -261,6 +331,16 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
261 p = dst->image.data + (dstw * y1) + x1; 331 p = dst->image.data + (dstw * y1) + x1;
262 if (dx > 0) dstw--; 332 if (dx > 0) dstw--;
263 else dstw++; 333 else dstw++;
334 if (dc->clip.mask)
335 {
336 RGBA_Image *im = dc->clip.mask;
337 mask_w = im->cache_entry.w;
338 mask = im->image.data8
339 + ((y1 - dc->clip.mask_y) * mask_w)
340 + (x1 - dc->clip.mask_x);
341 if (dx > 0) mask_w--;
342 else mask_w++;
343 }
264 } 344 }
265#ifdef HAVE_PIXMAN 345#ifdef HAVE_PIXMAN
266# ifdef PIXMAN_LINE 346# ifdef PIXMAN_LINE
@@ -283,7 +363,15 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
283 else 363 else
284# endif 364# endif
285#endif 365#endif
286 pfunc(0, 255, color, p); 366 {
367 if (mask)
368 {
369 pfunc(0, *mask, color, p);
370 mask += mask_w;
371 }
372 else
373 pfunc(0, 255, color, p);
374 }
287#ifdef HAVE_PIXMAN 375#ifdef HAVE_PIXMAN
288# ifdef PIXMAN_LINE 376# ifdef PIXMAN_LINE
289 pixman_x_position += x_unit; 377 pixman_x_position += x_unit;
@@ -442,12 +530,13 @@ _evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, i
442 rx = clw - 1; 530 rx = clw - 1;
443 531
444static void 532static void
445_draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x0, int y0, int x1, int y1) 533_draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x0, int y0, int x1, int y1, RGBA_Image *mask_ie, int mask_x, int mask_y)
446{ 534{
447 int dx, dy, len, lx, ty, rx, by; 535 int dx, dy, len, lx, ty, rx, by;
448 int clx, cly, clw, clh; 536 int clx, cly, clw, clh;
449 int dstw; 537 int dstw, mask_w = 0;
450 DATA32 *p; 538 DATA32 *p;
539 DATA8 *mask = NULL;
451 RGBA_Gfx_Pt_Func pfunc; 540 RGBA_Gfx_Pt_Func pfunc;
452 RGBA_Gfx_Func sfunc; 541 RGBA_Gfx_Func sfunc;
453 542
@@ -488,13 +577,27 @@ _draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int cli
488 577
489 len = x1 - x0 + 1; 578 len = x1 - x0 + 1;
490 p = dst->image.data + (dstw * y0) + x0; 579 p = dst->image.data + (dstw * y0) + x0;
491 sfunc = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, len, render_op); 580 if (mask_ie)
492 if (sfunc) sfunc(NULL, NULL, color, p, len); 581 {
582 mask = mask_ie->image.data8
583 + ((y0 - mask_y) * mask_ie->cache_entry.w)
584 + (x0 - mask_x);
585 sfunc = evas_common_gfx_func_composite_mask_color_span_get(color, dst->cache_entry.flags.alpha, len, render_op);
586 if (sfunc) sfunc(NULL, mask, color, p, len);
587 }
588 else
589 {
590 sfunc = evas_common_gfx_func_composite_color_span_get(color, dst->cache_entry.flags.alpha, len, render_op);
591 if (sfunc) sfunc(NULL, NULL, color, p, len);
592 }
493 } 593 }
494 return; 594 return;
495 } 595 }
496 596
497 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, render_op); 597 if (mask_ie)
598 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(color, dst->cache_entry.flags.alpha, render_op);
599 else
600 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, render_op);
498 if (!pfunc) return; 601 if (!pfunc) return;
499 602
500 if (dx == 0) 603 if (dx == 0)
@@ -506,10 +609,26 @@ _draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int cli
506 609
507 len = y1 - y0 + 1; 610 len = y1 - y0 + 1;
508 p = dst->image.data + (dstw * y0) + x0; 611 p = dst->image.data + (dstw * y0) + x0;
509 while (len--) 612 if (mask_ie)
510 { 613 {
511 pfunc(0, 255, color, p); 614 mask_w = mask_ie->cache_entry.w;
512 p += dstw; 615 mask = mask_ie->image.data8
616 + ((y0 - mask_y) * mask_w)
617 + (x0 - mask_x);
618 while (len--)
619 {
620 pfunc(0, *mask, color, p);
621 p += dstw;
622 mask += mask_w;
623 }
624 }
625 else
626 {
627 while (len--)
628 {
629 pfunc(0, 255, color, p);
630 p += dstw;
631 }
513 } 632 }
514 } 633 }
515 return; 634 return;
@@ -582,6 +701,15 @@ _draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int cli
582 len = y1 - y0 + 1; 701 len = y1 - y0 + 1;
583 if (dx > 0) dstw++; 702 if (dx > 0) dstw++;
584 else dstw--; 703 else dstw--;
704 if (mask_ie)
705 {
706 mask_w = mask_ie->cache_entry.w;
707 mask = mask_ie->image.data8
708 + ((y0 - mask_y) * mask_w)
709 + (x0 - mask_x);
710 if (dx > 0) mask_w++;
711 else mask_w--;
712 }
585 } 713 }
586 else 714 else
587 { 715 {
@@ -589,11 +717,32 @@ _draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int cli
589 p = dst->image.data + (dstw * y1) + x1; 717 p = dst->image.data + (dstw * y1) + x1;
590 if (dx > 0) dstw--; 718 if (dx > 0) dstw--;
591 else dstw++; 719 else dstw++;
720 if (mask_ie)
721 {
722 mask_w = mask_ie->cache_entry.w;
723 mask = mask_ie->image.data8
724 + ((y1 - mask_y) * mask_w)
725 + (x1 - mask_x);
726 if (dx > 0) mask_w--;
727 else mask_w++;
728 }
592 } 729 }
593 while (len--) 730 if (mask)
594 { 731 {
595 pfunc(0, 255, color, p); 732 while (len--)
596 p += dstw; 733 {
734 pfunc(0, *mask, color, p);
735 p += dstw;
736 mask += mask_w;
737 }
738 }
739 else
740 {
741 while (len--)
742 {
743 pfunc(0, 255, color, p);
744 p += dstw;
745 }
597 } 746 }
598 } 747 }
599} 748}
@@ -745,14 +894,15 @@ _draw_render_thread_simple_line(RGBA_Image *dst, int clip_x, int clip_y, int cli
745 rx = clw - 1; 894 rx = clw - 1;
746 895
747EAPI void 896EAPI void
748evas_common_line_draw_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x0, int y0, int x1, int y1) 897evas_common_line_draw_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x0, int y0, int x1, int y1, RGBA_Image *mask_ie, int mask_x, int mask_y)
749{ 898{
750 int px, py, x, y, prev_x, prev_y; 899 int px, py, x, y, prev_x, prev_y;
751 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 0; 900 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 0;
752 int delx, dely, xx, yy, dxx, dyy; 901 int delx, dely, xx, yy, dxx, dyy;
753 int clx, cly, clw, clh; 902 int clx, cly, clw, clh;
754 int dstw; 903 int dstw, mask_w = 0;
755 DATA32 *p, *data; 904 DATA32 *p, *data;
905 DATA8 *mask = NULL;
756 RGBA_Gfx_Pt_Func pfunc; 906 RGBA_Gfx_Pt_Func pfunc;
757 907
758 dx = x1 - x0; 908 dx = x1 - x0;
@@ -763,11 +913,15 @@ evas_common_line_draw_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w,
763 _draw_render_thread_simple_line 913 _draw_render_thread_simple_line
764 (dst, clip_x, clip_y, clip_w, clip_h, 914 (dst, clip_x, clip_y, clip_w, clip_h,
765 color, render_op, 915 color, render_op,
766 x0, y0, x1, y1); 916 x0, y0, x1, y1,
917 mask_ie, mask_x, mask_y);
767 return; 918 return;
768 } 919 }
769 920
770 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, render_op); 921 if (mask_ie)
922 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(color, dst->cache_entry.flags.alpha, render_op);
923 else
924 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, render_op);
771 if (!pfunc) return; 925 if (!pfunc) return;
772 926
773 clx = clip_x; 927 clx = clip_x;
@@ -784,11 +938,19 @@ evas_common_line_draw_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w,
784 x1 -= clx; 938 x1 -= clx;
785 y1 -= cly; 939 y1 -= cly;
786 940
941 if (mask_ie)
942 {
943 mask_w = mask_ie->cache_entry.w;
944 mask = mask_ie->image.data8
945 + ((cly - mask_y) * mask_w) + (clx - mask_x);
946 }
947
787 /* shallow: x-parametric */ 948 /* shallow: x-parametric */
788 if ((dy < dx) || (dy < -dx)) 949 if ((dy < dx) || (dy < -dx))
789 { 950 {
790 SETUP_LINE_SHALLOW; 951 SETUP_LINE_SHALLOW;
791 952
953 if (mask) mask += (py * mask_w) + px;
792 while (px < rx) 954 while (px < rx)
793 { 955 {
794 y = (yy >> 16); 956 y = (yy >> 16);
@@ -797,6 +959,7 @@ evas_common_line_draw_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w,
797 { 959 {
798 prev_y = y; 960 prev_y = y;
799 p += dh; 961 p += dh;
962 if (mask) mask += mask_w;
800 py += dely; 963 py += dely;
801 } 964 }
802 if (!p1_in) 965 if (!p1_in)
@@ -808,12 +971,17 @@ evas_common_line_draw_line(RGBA_Image *dst, int clip_x, int clip_y, int clip_w,
808 { 971 {
809 if (py < 0) goto next_x; 972 if (py < 0) goto next_x;
810 } 973 }
811 if (IN_RANGE(px, py, clw, clh)) pfunc(0, 255, color, p); 974 if (IN_RANGE(px, py, clw, clh))
975 {
976 if (mask) pfunc(0, *mask, color, p);
977 else pfunc(0, 255, color, p);
978 }
812 979
813next_x: 980next_x:
814 yy += dyy; 981 yy += dyy;
815 px++; 982 px++;
816 p++; 983 p++;
984 if (mask) mask++;
817 } 985 }
818 return; 986 return;
819 } 987 }
@@ -821,6 +989,7 @@ next_x:
821 /* steep: y-parametric */ 989 /* steep: y-parametric */
822 990
823 SETUP_LINE_STEEP; 991 SETUP_LINE_STEEP;
992 if (mask) mask += (py * mask_w) + px;
824 993
825 while (py < by) 994 while (py < by)
826 { 995 {
@@ -831,6 +1000,7 @@ next_x:
831 prev_x = x; 1000 prev_x = x;
832 px += delx; 1001 px += delx;
833 p += delx; 1002 p += delx;
1003 if (mask) mask += delx;
834 } 1004 }
835 if (!p1_in) 1005 if (!p1_in)
836 { 1006 {
@@ -841,12 +1011,17 @@ next_x:
841 { 1011 {
842 if (px < 0) goto next_y; 1012 if (px < 0) goto next_y;
843 } 1013 }
844 if (IN_RANGE(px, py, clw, clh)) pfunc(0, 255, color, p); 1014 if (IN_RANGE(px, py, clw, clh))
1015 {
1016 if (mask) pfunc(0, *mask, color, p);
1017 else pfunc(0, 255, color, p);
1018 }
845 1019
846next_y: 1020next_y:
847 xx += dxx; 1021 xx += dxx;
848 py++; 1022 py++;
849 p += dstw; 1023 p += dstw;
1024 if (mask) mask += mask_w;
850 } 1025 }
851} 1026}
852 1027
@@ -857,8 +1032,9 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
857 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 0; 1032 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 0;
858 int delx, dely, xx, yy, dxx, dyy; 1033 int delx, dely, xx, yy, dxx, dyy;
859 int clx, cly, clw, clh; 1034 int clx, cly, clw, clh;
860 int dstw; 1035 int dstw, mask_w = 0;
861 DATA32 *p, *data, color; 1036 DATA32 *p, *data, color;
1037 DATA8 *mask = NULL;
862 RGBA_Gfx_Pt_Func pfunc; 1038 RGBA_Gfx_Pt_Func pfunc;
863 1039
864 dx = x1 - x0; 1040 dx = x1 - x0;
@@ -896,7 +1072,10 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
896 } 1072 }
897 1073
898 color = dc->col.col; 1074 color = dc->col.col;
899 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, dc->render_op); 1075 if (dc->clip.mask)
1076 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(color, dst->cache_entry.flags.alpha, dc->render_op);
1077 else
1078 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst->cache_entry.flags.alpha, dc->render_op);
900 if (!pfunc) return; 1079 if (!pfunc) return;
901 1080
902 clx = dc->clip.x; 1081 clx = dc->clip.x;
@@ -913,11 +1092,20 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
913 x1 -= clx; 1092 x1 -= clx;
914 y1 -= cly; 1093 y1 -= cly;
915 1094
1095 if (dc->clip.mask)
1096 {
1097 RGBA_Image *im = dc->clip.mask;
1098 mask_w = im->cache_entry.w;
1099 mask = im->image.data8
1100 + ((cly - dc->clip.mask_y) * mask_w) + (clx - dc->clip.mask_x);
1101 }
1102
916 /* shallow: x-parametric */ 1103 /* shallow: x-parametric */
917 if ((dy < dx) || (dy < -dx)) 1104 if ((dy < dx) || (dy < -dx))
918 { 1105 {
919 SETUP_LINE_SHALLOW; 1106 SETUP_LINE_SHALLOW;
920 1107
1108 if (mask) mask += (py * mask_w) + px;
921 while (px < rx) 1109 while (px < rx)
922 { 1110 {
923 y = (yy >> 16); 1111 y = (yy >> 16);
@@ -926,6 +1114,7 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
926 { 1114 {
927 prev_y = y; 1115 prev_y = y;
928 p += dh; 1116 p += dh;
1117 if (mask) mask += mask_w;
929 py += dely; 1118 py += dely;
930#ifdef HAVE_PIXMAN 1119#ifdef HAVE_PIXMAN
931# ifdef PIXMAN_LINE 1120# ifdef PIXMAN_LINE
@@ -954,13 +1143,17 @@ _evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1,
954 else 1143 else
955# endif 1144# endif
956#endif 1145#endif
957 pfunc(0, 255, color, p); 1146 {
1147 if (mask) pfunc(0, *mask, color, p);
1148 else pfunc(0, 255, color, p);
1149 }
958 } 1150 }
959 1151
960next_x: 1152next_x:
961 yy += dyy; 1153 yy += dyy;
962 px++; 1154 px++;
963 p++; 1155 p++;
1156 if (mask) mask++;
964#ifdef HAVE_PIXMAN 1157#ifdef HAVE_PIXMAN
965# ifdef PIXMAN_LINE 1158# ifdef PIXMAN_LINE
966 pix_x += pix_x_unit; 1159 pix_x += pix_x_unit;
@@ -973,6 +1166,7 @@ next_x:
973 /* steep: y-parametric */ 1166 /* steep: y-parametric */
974 1167
975 SETUP_LINE_STEEP; 1168 SETUP_LINE_STEEP;
1169 if (mask) mask += (py * mask_w) + px;
976 1170
977 while (py < by) 1171 while (py < by)
978 { 1172 {
@@ -983,6 +1177,7 @@ next_x:
983 prev_x = x; 1177 prev_x = x;
984 px += delx; 1178 px += delx;
985 p += delx; 1179 p += delx;
1180 if (mask) mask += delx;
986#ifdef HAVE_PIXMAN 1181#ifdef HAVE_PIXMAN
987# ifdef PIXMAN_LINE 1182# ifdef PIXMAN_LINE
988 pix_x += pix_x_unit; 1183 pix_x += pix_x_unit;
@@ -1010,12 +1205,16 @@ next_x:
1010 else 1205 else
1011# endif 1206# endif
1012#endif 1207#endif
1013 pfunc(0, 255, color, p); 1208 {
1209 if (mask) pfunc(0, *mask, color, p);
1210 else pfunc(0, 255, color, p);
1211 }
1014 } 1212 }
1015next_y: 1213next_y:
1016 xx += dxx; 1214 xx += dxx;
1017 py++; 1215 py++;
1018 p += dstw; 1216 p += dstw;
1217 if (mask) mask += mask_w;
1019#ifdef HAVE_PIXMAN 1218#ifdef HAVE_PIXMAN
1020# ifdef PIXMAN_LINE 1219# ifdef PIXMAN_LINE
1021 pix_y += pix_y_unit; 1220 pix_y += pix_y_unit;
@@ -1025,14 +1224,15 @@ next_y:
1025} 1224}
1026 1225
1027EAPI void 1226EAPI void
1028evas_common_line_draw_line_aa(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x0, int y0, int x1, int y1) 1227evas_common_line_draw_line_aa(RGBA_Image *dst, int clip_x, int clip_y, int clip_w, int clip_h, DATA32 color, int render_op, int x0, int y0, int x1, int y1, RGBA_Image *mask_ie, int mask_x, int mask_y)
1029{ 1228{
1030 int px, py, x, y, prev_x, prev_y; 1229 int px, py, x, y, prev_x, prev_y;
1031 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 1; 1230 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 1;
1032 int delx, dely, xx, yy, dxx, dyy; 1231 int delx, dely, xx, yy, dxx, dyy;
1033 int clx, cly, clw, clh; 1232 int clx, cly, clw, clh;
1034 int dstw; 1233 int dstw, mask_w = 0;
1035 DATA32 *p, *data; 1234 DATA32 *p, *data;
1235 DATA8 *mask = NULL;
1036 RGBA_Gfx_Pt_Func pfunc; 1236 RGBA_Gfx_Pt_Func pfunc;
1037 1237
1038 dx = x1 - x0; 1238 dx = x1 - x0;
@@ -1049,7 +1249,8 @@ evas_common_line_draw_line_aa(RGBA_Image *dst, int clip_x, int clip_y, int clip_
1049 _draw_render_thread_simple_line 1249 _draw_render_thread_simple_line
1050 (dst, clip_x, clip_y, clip_w, clip_h, 1250 (dst, clip_x, clip_y, clip_w, clip_h,
1051 color, render_op, 1251 color, render_op,
1052 x0, y0, x1, y1); 1252 x0, y0, x1, y1,
1253 mask_ie, mask_x, mask_y);
1053 return; 1254 return;
1054 } 1255 }
1055 1256
@@ -1070,11 +1271,19 @@ evas_common_line_draw_line_aa(RGBA_Image *dst, int clip_x, int clip_y, int clip_
1070 x1 -= clx; 1271 x1 -= clx;
1071 y1 -= cly; 1272 y1 -= cly;
1072 1273
1274 if (mask_ie)
1275 {
1276 mask_w = mask_ie->cache_entry.w;
1277 mask = mask_ie->image.data8
1278 + (cly - mask_y) * mask_w + (clx - mask_x);
1279 }
1280
1073 /* shallow: x-parametric */ 1281 /* shallow: x-parametric */
1074 if ((dy < dx) || (dy < -dx)) 1282 if ((dy < dx) || (dy < -dx))
1075 { 1283 {
1076 SETUP_LINE_SHALLOW; 1284 SETUP_LINE_SHALLOW;
1077 1285
1286 if (mask) mask += (py * mask_w) + px;
1078 while (px < rx) 1287 while (px < rx)
1079 { 1288 {
1080 DATA8 aa; 1289 DATA8 aa;
@@ -1084,6 +1293,7 @@ evas_common_line_draw_line_aa(RGBA_Image *dst, int clip_x, int clip_y, int clip_
1084 { 1293 {
1085 prev_y = y; 1294 prev_y = y;
1086 p += dh; 1295 p += dh;
1296 if (mask) mask += mask_w;
1087 py += dely; 1297 py += dely;
1088 } 1298 }
1089 if (!p1_in) 1299 if (!p1_in)
@@ -1099,20 +1309,30 @@ evas_common_line_draw_line_aa(RGBA_Image *dst, int clip_x, int clip_y, int clip_
1099 { 1309 {
1100 aa = ((yy - (y << 16)) >> 8); 1310 aa = ((yy - (y << 16)) >> 8);
1101 1311
1102 if ((py) < clh) pfunc(0, 255 - aa, color, p); 1312 if (mask)
1103 if ((py + 1) < clh) pfunc(0, aa, color, p + dstw); 1313 {
1314 if ((py) < clh) pfunc(0, (255 - aa) * (*mask) / 255, color, p);
1315 if ((py + 1) < clh) pfunc(0, aa * (*(mask + mask_w)) / 255, color, p + dstw);
1316 }
1317 else
1318 {
1319 if ((py) < clh) pfunc(0, 255 - aa, color, p);
1320 if ((py + 1) < clh) pfunc(0, aa, color, p + dstw);
1321 }
1104 } 1322 }
1105 1323
1106next_x: 1324next_x:
1107 yy += dyy; 1325 yy += dyy;
1108 px++; 1326 px++;
1109 p++; 1327 p++;
1328 if (mask) mask++;
1110 } 1329 }
1111 return; 1330 return;
1112 } 1331 }
1113 1332
1114 /* steep: y-parametric */ 1333 /* steep: y-parametric */
1115 SETUP_LINE_STEEP; 1334 SETUP_LINE_STEEP;
1335 if (mask) mask += (py * mask_w) + px;
1116 1336
1117 while (py < by) 1337 while (py < by)
1118 { 1338 {
@@ -1124,6 +1344,7 @@ next_x:
1124 prev_x = x; 1344 prev_x = x;
1125 px += delx; 1345 px += delx;
1126 p += delx; 1346 p += delx;
1347 if (mask) mask += delx;
1127 } 1348 }
1128 if (!p1_in) 1349 if (!p1_in)
1129 { 1350 {
@@ -1137,14 +1358,24 @@ next_x:
1137 if (py < clh) 1358 if (py < clh)
1138 { 1359 {
1139 aa = ((xx - (x << 16)) >> 8); 1360 aa = ((xx - (x << 16)) >> 8);
1140 if ((px) < clw) pfunc(0, 255 - aa, color, p); 1361
1141 if ((px + 1) < clw) pfunc(0, aa, color, p + 1); 1362 if (mask)
1363 {
1364 if ((px) < clw) pfunc(0, (255 - aa) * (*mask) / 255, color, p);
1365 if ((px + 1) < clw) pfunc(0, aa * (*(mask + 1)) / 255, color, p + 1);
1366 }
1367 else
1368 {
1369 if ((px) < clw) pfunc(0, 255 - aa, color, p);
1370 if ((px + 1) < clw) pfunc(0, aa, color, p + 1);
1371 }
1142 } 1372 }
1143 1373
1144 next_y: 1374 next_y:
1145 xx += dxx; 1375 xx += dxx;
1146 py++; 1376 py++;
1147 p += dstw; 1377 p += dstw;
1378 if (mask) mask += mask_w;
1148 } 1379 }
1149} 1380}
1150 1381
@@ -1155,8 +1386,9 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
1155 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 1; 1386 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 1;
1156 int delx, dely, xx, yy, dxx, dyy; 1387 int delx, dely, xx, yy, dxx, dyy;
1157 int clx, cly, clw, clh; 1388 int clx, cly, clw, clh;
1158 int dstw; 1389 int dstw, mask_w = 0;
1159 DATA32 *p, *data, color; 1390 DATA32 *p, *data, color;
1391 DATA8 *mask = NULL;
1160 RGBA_Gfx_Pt_Func pfunc; 1392 RGBA_Gfx_Pt_Func pfunc;
1161 1393
1162 dx = x1 - x0; 1394 dx = x1 - x0;
@@ -1219,11 +1451,20 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
1219 x1 -= clx; 1451 x1 -= clx;
1220 y1 -= cly; 1452 y1 -= cly;
1221 1453
1454 if (dc->clip.mask)
1455 {
1456 RGBA_Image *im = dc->clip.mask;
1457 mask_w = im->cache_entry.w;
1458 mask = im->image.data8
1459 + ((cly - dc->clip.mask_y) * mask_w) + (clx - dc->clip.mask_x);
1460 }
1461
1222 /* shallow: x-parametric */ 1462 /* shallow: x-parametric */
1223 if ((dy < dx) || (dy < -dx)) 1463 if ((dy < dx) || (dy < -dx))
1224 { 1464 {
1225 SETUP_LINE_SHALLOW; 1465 SETUP_LINE_SHALLOW;
1226 1466
1467 if (mask) mask += (py * mask_w) + px;
1227 while (px < rx) 1468 while (px < rx)
1228 { 1469 {
1229 DATA8 aa; 1470 DATA8 aa;
@@ -1233,6 +1474,7 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
1233 { 1474 {
1234 prev_y = y; 1475 prev_y = y;
1235 p += dh; 1476 p += dh;
1477 if (mask) mask += mask_w;
1236 py += dely; 1478 py += dely;
1237#ifdef HAVE_PIXMAN 1479#ifdef HAVE_PIXMAN
1238# ifdef PIXMAN_LINE 1480# ifdef PIXMAN_LINE
@@ -1268,7 +1510,10 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
1268 else 1510 else
1269# endif 1511# endif
1270#endif 1512#endif
1271 pfunc(0, 255 - aa, color, p); 1513 {
1514 if (mask) pfunc(0, (255 - aa) * (*mask) / 255, color, p);
1515 else pfunc(0, 255 - aa, color, p);
1516 }
1272#ifdef HAVE_PIXMAN 1517#ifdef HAVE_PIXMAN
1273# ifdef PIXMAN_LINE 1518# ifdef PIXMAN_LINE
1274 pixman_image_unref(aa_mask_image); 1519 pixman_image_unref(aa_mask_image);
@@ -1291,7 +1536,10 @@ _evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
1291 else 1536 else
1292# endif 1537# endif
1293#endif 1538#endif
1294 pfunc(0, aa, color, p + dstw); 1539 {
1540 if (mask) pfunc(0, aa * (*(mask + mask_w)) / 255, color, p + dstw);
1541 else pfunc(0, aa, color, p + dstw);
1542 }
1295#ifdef HAVE_PIXMAN 1543#ifdef HAVE_PIXMAN
1296# ifdef PIXMAN_LINE 1544# ifdef PIXMAN_LINE
1297 pixman_image_unref(aa_mask_image); 1545 pixman_image_unref(aa_mask_image);
@@ -1304,6 +1552,7 @@ next_x:
1304 yy += dyy; 1552 yy += dyy;
1305 px++; 1553 px++;
1306 p++; 1554 p++;
1555 if (mask) mask++;
1307#ifdef HAVE_PIXMAN 1556#ifdef HAVE_PIXMAN
1308# ifdef PIXMAN_LINE 1557# ifdef PIXMAN_LINE
1309 pix_x += pix_x_unit; 1558 pix_x += pix_x_unit;
@@ -1315,6 +1564,7 @@ next_x:
1315 1564
1316 /* steep: y-parametric */ 1565 /* steep: y-parametric */
1317 SETUP_LINE_STEEP; 1566 SETUP_LINE_STEEP;
1567 if (mask) mask += (py * mask_w) + px;
1318 1568
1319 while (py < by) 1569 while (py < by)
1320 { 1570 {
@@ -1326,6 +1576,7 @@ next_x:
1326 prev_x = x; 1576 prev_x = x;
1327 px += delx; 1577 px += delx;
1328 p += delx; 1578 p += delx;
1579 if (mask) mask += delx;
1329#ifdef HAVE_PIXMAN 1580#ifdef HAVE_PIXMAN
1330# ifdef PIXMAN_LINE 1581# ifdef PIXMAN_LINE
1331 pix_x += pix_x_unit; 1582 pix_x += pix_x_unit;
@@ -1359,7 +1610,10 @@ next_x:
1359 else 1610 else
1360# endif 1611# endif
1361#endif 1612#endif
1362 pfunc(0, 255 - aa, color, p); 1613 {
1614 if (mask) pfunc(0, (255 - aa) * (*mask) / 255, color, p);
1615 else pfunc(0, 255 - aa, color, p);
1616 }
1363#ifdef HAVE_PIXMAN 1617#ifdef HAVE_PIXMAN
1364# ifdef PIXMAN_LINE 1618# ifdef PIXMAN_LINE
1365 pixman_image_unref(aa_mask_image); 1619 pixman_image_unref(aa_mask_image);
@@ -1383,7 +1637,10 @@ next_x:
1383 else 1637 else
1384# endif 1638# endif
1385#endif 1639#endif
1386 pfunc(0, aa, color, p + 1); 1640 {
1641 if (mask) pfunc(0, aa * (*(mask + 1)) / 255, color, p + 1);
1642 else pfunc(0, aa, color, p + 1);
1643 }
1387#ifdef HAVE_PIXMAN 1644#ifdef HAVE_PIXMAN
1388# ifdef PIXMAN_LINE 1645# ifdef PIXMAN_LINE
1389 pixman_image_unref(aa_mask_image); 1646 pixman_image_unref(aa_mask_image);
@@ -1395,6 +1652,7 @@ next_x:
1395 xx += dxx; 1652 xx += dxx;
1396 py++; 1653 py++;
1397 p += dstw; 1654 p += dstw;
1655 if (mask) mask += mask_w;
1398#ifdef HAVE_PIXMAN 1656#ifdef HAVE_PIXMAN
1399# ifdef PIXMAN_LINE 1657# ifdef PIXMAN_LINE
1400 pix_y += pix_y_unit; 1658 pix_y += pix_y_unit;