21 static void llineop(Memimage*, Rectangle, Rectangle, void*, int);
25 _memline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, Memimage *src, Point sp, Rectangle clipr, int op)
35 if(src->layer) /* can't draw line with layered source */
42 _memimageline(dst, p0, p1, end0, end1, radius, src, sp, clipr, op);
47 if(rectclip(&clipr, rectsubpt(src->clipr, d)) == 0)
49 if((src->flags&Frepl)==0 && rectclip(&clipr, rectsubpt(src->r, d))==0)
54 /* dst is known to be a layer */
59 clipr.min.x += dl->delta.x;
60 clipr.min.y += dl->delta.y;
61 clipr.max.x += dl->delta.x;
62 clipr.max.y += dl->delta.y;
64 dst = dst->layer->screen->image;
68 /* can't use sutherland-cohen clipping because lines are wide */
69 r = memlinebbox(p0, p1, end0, end1, radius);
71 * r is now a bounding box for the line;
72 * use it as a clipping rectangle for subdivision
74 if(rectclip(&r, clipr) == 0)
81 ll.dstlayer = dst->layer;
86 _memlayerop(llineop, dst, r, r, &ll);
91 llineop(Memimage *dst, Rectangle screenr, Rectangle clipr, void *etc, int insave)
98 if(insave && ll->dstlayer->save==nil)
100 if(!rectclip(&clipr, screenr))
103 p0 = subpt(ll->p0, ll->delta);
104 p1 = subpt(ll->p1, ll->delta);
105 clipr = rectsubpt(clipr, ll->delta);
110 _memline(dst, p0, p1, ll->end0, ll->end1, ll->radius, ll->src, ll->sp, clipr, ll->op);
114 memline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, Memimage *src, Point sp, int op)
116 _memline(dst, p0, p1, end0, end1, radius, src, sp, dst->clipr, op);