summaryrefslogtreecommitdiff
path: root/src/lib/evas/common/evas_line_main.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-11-04 11:51:42 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-11-04 11:51:42 +0000
commitc15e9c6575c3b5f39ded167dda5259de3de96151 (patch)
tree5115d7ae3620af24c2bc094cd062575af7adeda9 /src/lib/evas/common/evas_line_main.c
parenta5ac6a987caec5a7f7596a25d0a065b9cc94c50c (diff)
merge: and now Evas
I've tested make -j 3 install and it works nicely I've tested expedite with software and opengl xlib, and it works. Not tested other engines, so please report any problems (engines or other) on the ML. TODO: examples and tests, I'll add them later ISSUE: Eina_Unicode size check. It indirectly depends on eina_config.h, which is created at the end of the configure script. So its size is always 0. I don't know how that size is used, so I can't do a lot, for now. SVN revision: 78895
Diffstat (limited to 'src/lib/evas/common/evas_line_main.c')
-rw-r--r--src/lib/evas/common/evas_line_main.c1003
1 files changed, 1003 insertions, 0 deletions
diff --git a/src/lib/evas/common/evas_line_main.c b/src/lib/evas/common/evas_line_main.c
new file mode 100644
index 0000000000..76417f5ac7
--- /dev/null
+++ b/src/lib/evas/common/evas_line_main.c
@@ -0,0 +1,1003 @@
1#include "evas_common.h"
2#include "evas_blend_private.h"
3
4
5static void
6_evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y);
7
8static void
9_evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
10
11static void
12_evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
13
14static void
15_evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1);
16
17
18#define IN_RANGE(x, y, w, h) \
19 ( x > 0 && y > 0 &&((unsigned)(x) < (unsigned)(w)) && ((unsigned)(y) < (unsigned)(h)) )
20
21#define IN_RECT(x, y, rx, ry, rw, rh) \
22 ( ((unsigned)((x) - (rx)) < (unsigned)(rw)) && \
23 ((unsigned)((y) - (ry)) < (unsigned)(rh)) )
24
25#define EXCHANGE_POINTS(x0, y0, x1, y1) \
26 { \
27 int _tmp = y0; \
28 \
29 y0 = y1; \
30 y1 = _tmp; \
31 \
32 _tmp = x0; \
33 x0 = x1; \
34 x1 = _tmp; \
35 }
36
37
38EAPI void
39evas_common_line_init(void)
40{
41}
42
43EAPI void
44evas_common_line_draw(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1)
45{
46 int x, y, w, h;
47 int clx, cly, clw, clh;
48 int cuse, cx, cy, cw, ch;
49
50 /* No cutout ? FIXME ? */
51
52 if ((x0 == x1) && (y0 == y1))
53 {
54 _evas_draw_point(dst, dc, x0, y0);
55 return;
56 }
57
58 clx = cly = 0;
59 clw = dst->cache_entry.w;
60 clh = dst->cache_entry.h;
61
62 /* save out clip info */
63 cuse = dc->clip.use;
64 cx = dc->clip.x;
65 cy = dc->clip.y;
66 cw = dc->clip.w;
67 ch = dc->clip.h;
68
69 if (cuse)
70 {
71 RECTS_CLIP_TO_RECT(clx, cly, clw, clh, cx, cy, cw, ch);
72 if ((clw < 1) || (clh < 1))
73 return;
74 }
75
76 x = MIN(x0, x1);
77 y = MIN(y0, y1);
78 w = MAX(x0, x1) - x + 1;
79 h = MAX(y0, y1) - y + 1;
80
81 RECTS_CLIP_TO_RECT(clx, cly, clw, clh, x, y, w, h);
82 if ((clw < 1) || (clh < 1))
83 return;
84
85 dc->clip.use = 1;
86 dc->clip.x = clx;
87 dc->clip.y = cly;
88 dc->clip.w = clw;
89 dc->clip.h = clh;
90
91 if (dc->anti_alias)
92 _evas_draw_line_aa(dst, dc, x0, y0, x1, y1);
93 else
94 _evas_draw_line(dst, dc, x0, y0, x1, y1);
95
96 /* restore clip info */
97 dc->clip.use = cuse;
98 dc->clip.x = cx;
99 dc->clip.y = cy;
100 dc->clip.w = cw;
101 dc->clip.h = ch;
102}
103
104
105static void
106_evas_draw_point(RGBA_Image *dst, RGBA_Draw_Context *dc, int x, int y)
107{
108 RGBA_Gfx_Pt_Func pfunc;
109
110 if (!IN_RANGE(x, y, dst->cache_entry.w, dst->cache_entry.h))
111 return;
112 if ((dc->clip.use) && (!IN_RECT(x, y, dc->clip.x, dc->clip.y, dc->clip.w, dc->clip.h)))
113 return;
114#ifdef HAVE_PIXMAN
115# ifdef PIXMAN_LINE
116 pixman_op_t op = PIXMAN_OP_SRC;
117
118 if (dc->render_op == _EVAS_RENDER_BLEND)
119 op = PIXMAN_OP_OVER;
120
121 if ((dst->pixman.im) && (dc->col.pixman_color_image))
122 pixman_image_composite(op, dc->col.pixman_color_image, NULL,
123 dst->pixman.im, x, y, 0, 0, x, y, 1, 1);
124 else
125# endif
126#endif
127 {
128 pfunc = evas_common_gfx_func_composite_color_pt_get(dc->col.col, dst, dc->render_op);
129 if (pfunc)
130 pfunc(0, 255, dc->col.col, dst->image.data + (dst->cache_entry.w * y) + x);
131 }
132}
133
134/*
135 these functions use the dc->clip data as bounding
136 data. they assume that such data has already been cut
137 back to lie in the dst image rect and the object's
138 (line) bounding rect.
139*/
140static void
141_evas_draw_simple_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1)
142{
143 int dx, dy, len, lx, ty, rx, by;
144 int clx, cly, clw, clh;
145 int dstw;
146 DATA32 *p, color;
147 RGBA_Gfx_Pt_Func pfunc;
148 RGBA_Gfx_Func sfunc;
149
150#ifdef HAVE_PIXMAN
151# ifdef PIXMAN_LINE
152 pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
153 if (dc->render_op == _EVAS_RENDER_BLEND)
154 op = PIXMAN_OP_OVER;
155# endif
156#endif
157
158 dstw = dst->cache_entry.w;
159 color = dc->col.col;
160
161 if (y0 > y1)
162 EXCHANGE_POINTS(x0, y0, x1, y1)
163 if (x0 > x1)
164 EXCHANGE_POINTS(x0, y0, x1, y1)
165
166 dx = x1 - x0;
167 dy = y1 - y0;
168
169 clx = dc->clip.x;
170 cly = dc->clip.y;
171 clw = dc->clip.w;
172 clh = dc->clip.h;
173
174 lx = clx;
175 rx = clx + clw - 1;
176 ty = cly;
177 by = cly + clh - 1;
178
179 if (dy == 0)
180 {
181 if ((y0 >= ty) && (y0 <= by))
182 {
183 if (dx < 0)
184 {
185 int tmp = x1;
186
187 x1 = x0;
188 x0 = tmp;
189 }
190
191 if (x0 < lx) x0 = lx;
192 if (x1 > rx) x1 = rx;
193
194 len = x1 - x0 + 1;
195 p = dst->image.data + (dstw * y0) + x0;
196#ifdef HAVE_PIXMAN
197# ifdef PIXMAN_LINE
198 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
199 (!dc->mask.mask))
200 pixman_image_composite(op, dc->col.pixman_color_image,
201 NULL, dst->pixman.im,
202 x0, y0, 0, 0, x0, y0, len, 1);
203 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
204 (dc->mask.mask))
205 pixman_image_composite(op, dc->col.pixman_color_image,
206 dc->mask.mask->pixman.im,
207 dst->pixman.im,
208 x0, y0, 0, 0, x0, y0, len, 1);
209 else
210# endif
211#endif
212 {
213 sfunc = evas_common_gfx_func_composite_color_span_get(color, dst, len, dc->render_op);
214 if (sfunc)
215 sfunc(NULL, NULL, color, p, len);
216 }
217 }
218 return;
219 }
220
221 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst, dc->render_op);
222 if (!pfunc) return;
223
224 if (dx == 0)
225 {
226 if ((x0 >= lx) && (x0 <= rx))
227 {
228 if (y0 < ty) y0 = ty;
229 if (y1 > by) y1 = by;
230
231 len = y1 - y0 + 1;
232 p = dst->image.data + (dstw * y0) + x0;
233#ifdef HAVE_PIXMAN
234# ifdef PIXMAN_LINE
235 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
236 (!dc->mask.mask))
237 pixman_image_composite(op, dc->col.pixman_color_image,
238 NULL, dst->pixman.im,
239 x0, y0, 0, 0, x0, y0, 1, len);
240 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
241 (dc->mask.mask))
242 pixman_image_composite(op, dc->col.pixman_color_image,
243 dc->mask.mask->pixman.im, dst->pixman.im,
244 x0, y0, 0, 0, x0, y0, 1, len);
245 else
246# endif
247#endif
248 {
249 while (len--)
250 {
251 pfunc(0, 255, color, p);
252 p += dstw;
253 }
254 }
255 }
256 return;
257 }
258
259 if ((dy == dx) || (dy == -dx))
260 {
261 int p0_in, p1_in;
262
263 p0_in = (IN_RECT(x0, y0, clx, cly, clw, clh) ? 1 : 0);
264 p1_in = (IN_RECT(x1, y1, clx, cly, clw, clh) ? 1 : 0);
265
266 if (dy > 0)
267 {
268 if (!p0_in)
269 {
270 x0 = x0 + (ty - y0);
271 y0 = ty;
272 if (x0 > rx) return;
273 if (x0 < lx)
274 {
275 y0 = y0 + (lx - x0);
276 x0 = lx;
277 if ((y0 < ty) || (y0 > by)) return;
278 }
279 }
280 if (!p1_in)
281 {
282 x1 = x0 + (by - y0);
283 y1 = by;
284 if (x1 < lx) return;
285 if (x1 > rx)
286 {
287 y1 = y0 + (rx - x0);
288 x1 = rx;
289 if ((y1 < ty) || (y1 > by)) return;
290 }
291 }
292 }
293 else
294 {
295 if (!p0_in)
296 {
297 x0 = x0 - (by - y0);
298 y0 = by;
299 if (x0 > rx) return;
300 if (x0 < lx)
301 {
302 y0 = y0 - (lx - x0);
303 x0 = lx;
304 if ((y0 < ty) || (y0 > by)) return;
305 }
306 }
307 if (!p1_in)
308 {
309 x1 = x0 - (ty - y0);
310 y1 = ty;
311 if (x1 < lx) return;
312 if (x1 > rx)
313 {
314 y1 = y0 - (rx - x0);
315 x1 = rx;
316 if ((y1 < ty) || (y1 > by)) return;
317 }
318 }
319 }
320 if (y1 > y0)
321 {
322 p = dst->image.data + (dstw * y0) + x0;
323 len = y1 - y0 + 1;
324 if (dx > 0) dstw++;
325 else dstw--;
326 }
327 else
328 {
329 len = y0 - y1 + 1;
330 p = dst->image.data + (dstw * y1) + x1;
331 if (dx > 0) dstw--;
332 else dstw++;
333 }
334#ifdef HAVE_PIXMAN
335# ifdef PIXMAN_LINE
336 int pixman_x_position = x0;
337 int pixman_y_position = y0;
338 int x_unit = dstw - dst->cache_entry.w;
339# endif
340#endif
341 while (len--)
342 {
343#ifdef HAVE_PIXMAN
344# ifdef PIXMAN_LINE
345 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
346 (!dc->mask.mask))
347 pixman_image_composite(op, dc->col.pixman_color_image,
348 NULL, dst->pixman.im,
349 pixman_x_position,
350 pixman_y_position,
351 0, 0, pixman_x_position,
352 pixman_y_position, 1, 1);
353 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
354 (dc->mask.mask))
355 pixman_image_composite(op, dc->col.pixman_color_image,
356 dc->mask.mask->pixman.im,
357 dst->pixman.im,
358 pixman_x_position,
359 pixman_y_position, 0, 0,
360 pixman_x_position,
361 pixman_y_position, 1, 1);
362 else
363# endif
364#endif
365 pfunc(0, 255, color, p);
366#ifdef HAVE_PIXMAN
367# ifdef PIXMAN_LINE
368 pixman_x_position += x_unit;
369 pixman_y_position += 1;
370# endif
371#endif
372 p += dstw;
373 }
374 }
375}
376
377#define SETUP_LINE_SHALLOW \
378 if (x0 > x1) \
379 { \
380 EXCHANGE_POINTS(x0, y0, x1, y1); \
381 dx = -dx; \
382 dy = -dy; \
383 } \
384 \
385 px = x0; \
386 py = y0; \
387 \
388 p0_in = (IN_RANGE(x0 , y0 , clw, clh) ? 1 : 0); \
389 p1_in = (IN_RANGE(x1 , y1 , clw, clh) ? 1 : 0); \
390 \
391 dely = 1; \
392 dh = dstw; \
393 if (dy < 0) \
394 { \
395 dely = -1; \
396 dh = -dstw; \
397 } \
398 \
399 dyy = ((dy) << 16) / (dx); \
400 \
401 if (!p0_in) \
402 { \
403 dxx = ((dx) << 16) / (dy); \
404 if (px < 0) \
405 { \
406 x = -px; px = 0; \
407 yy = x * dyy; \
408 y = yy >> 16; \
409 if (!a_a) \
410 y += (yy - (y << 16)) >> 15; \
411 py += y; \
412 if ((dely > 0) && (py >= clh)) \
413 return; \
414 else if ((dely < 0) && (py < -1)) \
415 return; \
416 } \
417 \
418 y = 0; \
419 if ((dely > 0) && (py < 0)) \
420 y = (-1 - py); \
421 else if ((dely < 0) && (py >= clh)) \
422 y = (clh - 1 - py); \
423 \
424 xx = y * dxx; \
425 x = xx >> 16; \
426 if (!a_a) \
427 x += (xx - (x << 16)) >> 15; \
428 px += x; \
429 if (px >= clw) return; \
430 \
431 yy = x * dyy; \
432 y = yy >> 16; \
433 if (!a_a) \
434 y += (yy - (y << 16)) >> 15; \
435 py += y; \
436 if ((dely > 0) && (py >= clh)) \
437 return; \
438 else if ((dely < 0) && (py < -1)) \
439 return; \
440 } \
441 \
442 p = data + (dstw * py) + px; \
443 \
444 x = px - x0; \
445 yy = x * dyy; \
446 prev_y = (yy >> 16); \
447 \
448 rx = MIN(x1 + 1, clw); \
449 by = clh - 1;
450
451
452#define SETUP_LINE_STEEP \
453 if (y0 > y1) \
454 { \
455 EXCHANGE_POINTS(x0, y0, x1, y1); \
456 dx = -dx; \
457 dy = -dy; \
458 } \
459 \
460 px = x0; \
461 py = y0; \
462 \
463 p0_in = (IN_RANGE(x0 , y0 , clw, clh) ? 1 : 0); \
464 p1_in = (IN_RANGE(x1 , y1 , clw, clh) ? 1 : 0); \
465 \
466 delx = 1; \
467 if (dx < 0) \
468 delx = -1; \
469 \
470 dxx = ((dx) << 16) / (dy); \
471 \
472 if (!p0_in) \
473 { \
474 dyy = ((dy) << 16) / (dx); \
475 \
476 if (py < 0) \
477 { \
478 y = -py; py = 0; \
479 xx = y * dxx; \
480 x = xx >> 16; \
481 if (!a_a) \
482 x += (xx - (x << 16)) >> 15; \
483 px += x; \
484 if ((delx > 0) && (px >= clw)) \
485 return; \
486 else if ((delx < 0) && (px < -1)) \
487 return; \
488 } \
489 \
490 x = 0; \
491 if ((delx > 0) && (px < -1)) \
492 x = (-1 - px); \
493 else if ((delx < 0) && (px >= clw)) \
494 x = (clw - 1 - px); \
495 \
496 yy = x * dyy; \
497 y = yy >> 16; \
498 if (!a_a) \
499 y += (yy - (y << 16)) >> 15; \
500 py += y; \
501 if (py >= clh) return; \
502 \
503 xx = y * dxx; \
504 x = xx >> 16; \
505 if (!a_a) \
506 x += (xx - (x << 16)) >> 15; \
507 px += x; \
508 if ((delx > 0) && (px >= clw)) \
509 return; \
510 else if ((delx < 0) && (px < -1)) \
511 return; \
512 } \
513 \
514 p = data + (dstw * py) + px; \
515 \
516 y = py - y0; \
517 xx = y * dxx; \
518 prev_x = (xx >> 16); \
519 \
520 by = MIN(y1 + 1, clh); \
521 rx = clw - 1;
522
523static void
524_evas_draw_line(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1)
525{
526 int px, py, x, y, prev_x, prev_y;
527 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 0;
528 int delx, dely, xx, yy, dxx, dyy;
529 int clx, cly, clw, clh;
530 int dstw;
531 DATA32 *p, *data, color;
532 RGBA_Gfx_Pt_Func pfunc;
533
534 dx = x1 - x0;
535 dy = y1 - y0;
536
537#ifdef HAVE_PIXMAN
538# ifdef PIXMAN_LINE
539 int pix_x;
540 int pix_y;
541 int pix_x_unit;
542 int pix_y_unit;
543
544 pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
545 if (dc->render_op == _EVAS_RENDER_BLEND)
546 op = PIXMAN_OP_OVER;
547 pix_x = x0;
548 pix_y = y0;
549
550 if (dx < 0)
551 pix_x_unit = -1;
552 else
553 pix_x_unit = 1;
554
555 if (dy < 0)
556 pix_y_unit = -1;
557 else
558 pix_y_unit = 1;
559# endif
560#endif
561
562 if ( (dx == 0) || (dy == 0) || (dx == dy) || (dx == -dy) )
563 {
564 _evas_draw_simple_line(dst, dc, x0, y0, x1, y1);
565 return;
566 }
567
568 color = dc->col.col;
569 pfunc = evas_common_gfx_func_composite_color_pt_get(color, dst, dc->render_op);
570 if (!pfunc) return;
571
572 clx = dc->clip.x;
573 cly = dc->clip.y;
574 clw = dc->clip.w;
575 clh = dc->clip.h;
576
577 data = dst->image.data;
578 dstw = dst->cache_entry.w;
579
580 data += (dstw * cly) + clx;
581 x0 -= clx;
582 y0 -= cly;
583 x1 -= clx;
584 y1 -= cly;
585
586 /* shallow: x-parametric */
587 if ((dy < dx) || (dy < -dx))
588 {
589 SETUP_LINE_SHALLOW;
590
591 while (px < rx)
592 {
593 y = (yy >> 16);
594 y += ((yy - (y << 16)) >> 15);
595 if (prev_y != y)
596 {
597 prev_y = y;
598 p += dh;
599 py += dely;
600#ifdef HAVE_PIXMAN
601# ifdef PIXMAN_LINE
602 pix_y += pix_y_unit;
603# endif
604#endif
605 }
606 if (!p1_in)
607 {
608 if ((py < 0) && (dely < 0)) return;
609 if ((py > by) && (dely > 0)) return;
610 }
611 if (!p0_in)
612 {
613 if (py < 0) goto next_x;
614 }
615 if (IN_RANGE(px, py, clw, clh))
616 {
617#ifdef HAVE_PIXMAN
618# ifdef PIXMAN_LINE
619 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
620 (!dc->mask.mask))
621 pixman_image_composite(op, dc->col.pixman_color_image,
622 NULL, dst->pixman.im,
623 pix_x, pix_y, 0, 0,
624 pix_x, pix_y, 1, 1);
625 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
626 (dc->mask.mask))
627 pixman_image_composite(op, dc->col.pixman_color_image,
628 dc->mask.mask->pixman.im,
629 dst->pixman.im,
630 pix_x, pix_y, 0, 0,
631 pix_x, pix_y, 1, 1);
632 else
633# endif
634#endif
635 pfunc(0, 255, color, p);
636 }
637
638next_x:
639 yy += dyy;
640 px++;
641 p++;
642#ifdef HAVE_PIXMAN
643# ifdef PIXMAN_LINE
644 pix_x += pix_x_unit;
645# endif
646#endif
647 }
648 return;
649 }
650
651 /* steep: y-parametric */
652
653 SETUP_LINE_STEEP;
654
655 while (py < by)
656 {
657 x = (xx >> 16);
658 x += ((xx - (x << 16)) >> 15);
659 if (prev_x != x)
660 {
661 prev_x = x;
662 px += delx;
663 p += delx;
664#ifdef HAVE_PIXMAN
665# ifdef PIXMAN_LINE
666 pix_x += pix_x_unit;
667# endif
668#endif
669 }
670 if (!p1_in)
671 {
672 if ((px < 0) && (delx < 0)) return;
673 if ((px > rx) && (delx > 0)) return;
674 }
675 if (!p0_in)
676 {
677 if (px < 0) goto next_y;
678 }
679 if (IN_RANGE(px, py, clw, clh))
680 {
681#ifdef HAVE_PIXMAN
682# ifdef PIXMAN_LINE
683 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
684 (!dc->mask.mask))
685 pixman_image_composite(op, dc->col.pixman_color_image,
686 NULL, dst->pixman.im,
687 pix_x, pix_y, 0, 0,
688 pix_x, pix_y, 1, 1);
689 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
690 (dc->mask.mask))
691 pixman_image_composite(op, dc->col.pixman_color_image,
692 dc->mask.mask->pixman.im,
693 dst->pixman.im,
694 pix_x, pix_y, 0, 0,
695 pix_x, pix_y, 1, 1);
696 else
697# endif
698#endif
699 pfunc(0, 255, color, p);
700 }
701next_y:
702 xx += dxx;
703 py++;
704 p += dstw;
705#ifdef HAVE_PIXMAN
706# ifdef PIXMAN_LINE
707 pix_y += pix_y_unit;
708# endif
709#endif
710 }
711}
712
713
714static void
715_evas_draw_line_aa(RGBA_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x1, int y1)
716{
717 int px, py, x, y, prev_x, prev_y;
718 int dx, dy, rx, by, p0_in, p1_in, dh, a_a = 1;
719 int delx, dely, xx, yy, dxx, dyy;
720 int clx, cly, clw, clh;
721 int dstw;
722 DATA32 *p, *data, color;
723 RGBA_Gfx_Pt_Func pfunc;
724
725 dx = x1 - x0;
726 dy = y1 - y0;
727
728#ifdef HAVE_PIXMAN
729# ifdef PIXMAN_LINE
730 int pix_x;
731 int pix_y;
732 int pix_x_unit;
733 int pix_y_unit;
734
735 pixman_image_t *aa_mask_image;
736 int alpha_data_buffer;
737
738 pixman_op_t op = PIXMAN_OP_SRC; // _EVAS_RENDER_COPY
739 if (dc->render_op == _EVAS_RENDER_BLEND)
740 op = PIXMAN_OP_OVER;
741 pix_x = x0;
742 pix_y = y0;
743
744 if (dx < 0)
745 pix_x_unit = -1;
746 else
747 pix_x_unit = 1;
748
749 if (dy < 0)
750 pix_y_unit = -1;
751 else
752 pix_y_unit = 1;
753# endif
754#endif
755 if (y0 > y1)
756 EXCHANGE_POINTS(x0, y0, x1, y1);
757
758 dx = x1 - x0;
759 dy = y1 - y0;
760
761 if ((dx == 0) || (dy == 0) || (dx == dy) || (dx == -dy))
762 {
763 _evas_draw_simple_line(dst, dc, x0, y0, x1, y1);
764 return;
765 }
766
767 color = dc->col.col;
768 pfunc = evas_common_gfx_func_composite_mask_color_pt_get(color, dst, dc->render_op);
769 if (!pfunc) return;
770
771 clx = dc->clip.x;
772 cly = dc->clip.y;
773 clw = dc->clip.w;
774 clh = dc->clip.h;
775
776 data = evas_cache_image_pixels(&dst->cache_entry);
777 dstw = dst->cache_entry.w;
778
779 data += (dstw * cly) + clx;
780 x0 -= clx;
781 y0 -= cly;
782 x1 -= clx;
783 y1 -= cly;
784
785 /* shallow: x-parametric */
786 if ((dy < dx) || (dy < -dx))
787 {
788 SETUP_LINE_SHALLOW;
789
790 while (px < rx)
791 {
792 DATA8 aa;
793
794 y = (yy >> 16);
795 if (prev_y != y)
796 {
797 prev_y = y;
798 p += dh;
799 py += dely;
800#ifdef HAVE_PIXMAN
801# ifdef PIXMAN_LINE
802 pix_y += pix_y_unit;
803# endif
804#endif
805 }
806 if (!p1_in)
807 {
808 if ((py < 0) && (dely < 0)) return;
809 if ((py > by) && (dely > 0)) return;
810 }
811 if (!p0_in)
812 {
813 if (py < 0) goto next_x;
814 }
815 if (px < clw)
816 {
817 aa = ((yy - (y << 16)) >> 8);
818 if ((py) < clh)
819 {
820#ifdef HAVE_PIXMAN
821# ifdef PIXMAN_LINE
822 alpha_data_buffer = 255 - aa;
823 aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1,
824 (uint32_t *)&alpha_data_buffer, 4);
825
826 if ((dst->pixman.im) && (dc->col.pixman_color_image ) &&
827 (!dc->mask.mask))
828 pixman_image_composite(PIXMAN_OP_OVER,
829 dc->col.pixman_color_image,
830 aa_mask_image, dst->pixman.im,
831 pix_x, pix_y, 0, 0,
832 pix_x, pix_y, 1, 1);
833 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
834 (dc->mask.mask) )
835 pixman_image_composite(op, dc->col.pixman_color_image,
836 dc->mask.mask->pixman.im,
837 dst->pixman.im,
838 pix_x, pix_y, 0, 0,
839 pix_x, pix_y, 1, 1);
840 else
841# endif
842#endif
843 pfunc(0, 255 - aa, color, p);
844#ifdef HAVE_PIXMAN
845# ifdef PIXMAN_LINE
846 pixman_image_unref(aa_mask_image);
847# endif
848#endif
849 }
850 if ((py + 1) < clh)
851 {
852#ifdef HAVE_PIXMAN
853# ifdef PIXMAN_LINE
854 alpha_data_buffer = aa;
855 aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1,
856 (uint32_t *)&alpha_data_buffer, 4);
857
858 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
859 (!dc->mask.mask))
860 pixman_image_composite(PIXMAN_OP_OVER,
861 dc->col.pixman_color_image,
862 aa_mask_image, dst->pixman.im,
863 pix_x, pix_y + 1, 0, 0,
864 pix_x, pix_y + 1, 1, 1);
865 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
866 (dc->mask.mask))
867 pixman_image_composite(op, dc->col.pixman_color_image,
868 dc->mask.mask->pixman.im,
869 dst->pixman.im,
870 pix_x, pix_y + 1, 0, 0,
871 pix_x, pix_y + 1, 1, 1);
872 else
873# endif
874#endif
875 pfunc(0, aa, color, p + dstw);
876#ifdef HAVE_PIXMAN
877# ifdef PIXMAN_LINE
878 pixman_image_unref(aa_mask_image);
879# endif
880#endif
881 }
882 }
883
884next_x:
885 yy += dyy;
886 px++;
887 p++;
888#ifdef HAVE_PIXMAN
889# ifdef PIXMAN_LINE
890 pix_x += pix_x_unit;
891# endif
892#endif
893 }
894 return;
895 }
896
897 /* steep: y-parametric */
898 SETUP_LINE_STEEP;
899
900 while (py < by)
901 {
902 DATA8 aa;
903
904 x = (xx >> 16);
905 if (prev_x != x)
906 {
907 prev_x = x;
908 px += delx;
909 p += delx;
910#ifdef HAVE_PIXMAN
911# ifdef PIXMAN_LINE
912 pix_x += pix_x_unit;
913# endif
914#endif
915 }
916 if (!p1_in)
917 {
918 if ((px < 0) && (delx < 0)) return;
919 if ((px > rx) && (delx > 0)) return;
920 }
921 if (!p0_in)
922 {
923 if (px < 0) goto next_y;
924 }
925 if (py < clh)
926 {
927 aa = ((xx - (x << 16)) >> 8);
928 if ((px) < clw)
929 {
930#ifdef HAVE_PIXMAN
931# ifdef PIXMAN_LINE
932 alpha_data_buffer = 255 - aa;
933 aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1, (uint32_t *)&alpha_data_buffer, 4);
934
935 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
936 (!dc->mask.mask))
937 pixman_image_composite(PIXMAN_OP_OVER,
938 dc->col.pixman_color_image,
939 aa_mask_image, dst->pixman.im,
940 pix_x, pix_y, 0, 0,
941 pix_x, pix_y, 1, 1);
942 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
943 (dc->mask.mask))
944 pixman_image_composite(op, dc->col.pixman_color_image,
945 dc->mask.mask->pixman.im,
946 dst->pixman.im,
947 pix_x, pix_y, 0, 0,
948 pix_x, pix_y, 1, 1);
949 else
950# endif
951#endif
952 pfunc(0, 255 - aa, color, p);
953#ifdef HAVE_PIXMAN
954# ifdef PIXMAN_LINE
955 pixman_image_unref(aa_mask_image);
956# endif
957#endif
958
959 }
960 if ((px + 1) < clw)
961 {
962#ifdef HAVE_PIXMAN
963# ifdef PIXMAN_LINE
964 alpha_data_buffer = aa;
965 aa_mask_image = pixman_image_create_bits(PIXMAN_a8, 1, 1,
966 (uint32_t *)&alpha_data_buffer, 4);
967
968 if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
969 (!dc->mask.mask))
970 pixman_image_composite(PIXMAN_OP_OVER,
971 dc->col.pixman_color_image,
972 aa_mask_image, dst->pixman.im,
973 pix_x + 1, pix_y, 0, 0,
974 pix_x + 1, pix_y, 1, 1);
975 else if ((dst->pixman.im) && (dc->col.pixman_color_image) &&
976 (dc->mask.mask))
977 pixman_image_composite(op, dc->col.pixman_color_image,
978 dc->mask.mask->pixman.im,
979 dst->pixman.im,
980 pix_x + 1, pix_y, 0, 0,
981 pix_x + 1, pix_y, 1, 1);
982 else
983# endif
984#endif
985 pfunc(0, aa, color, p + 1);
986#ifdef HAVE_PIXMAN
987# ifdef PIXMAN_LINE
988 pixman_image_unref(aa_mask_image);
989# endif
990#endif
991 }
992 }
993 next_y:
994 xx += dxx;
995 py++;
996 p += dstw;
997#ifdef HAVE_PIXMAN
998# ifdef PIXMAN_LINE
999 pix_y += pix_y_unit;
1000# endif
1001#endif
1002 }
1003}