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