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;
69 /* this is not the correct set of tests */
70 // if(log2[dst->depth] != log2[src->depth] || log2[dst->depth]!=3)
73 /* can't use sutherland-cohen clipping because lines are wide */
74 r = memlinebbox(p0, p1, end0, end1, radius);
76 * r is now a bounding box for the line;
77 * use it as a clipping rectangle for subdivision
79 if(rectclip(&r, clipr) == 0)
86 ll.dstlayer = dst->layer;
91 _memlayerop(llineop, dst, r, r, &ll);
96 llineop(Memimage *dst, Rectangle screenr, Rectangle clipr, void *etc, int insave)
103 if(insave && ll->dstlayer->save==nil)
105 if(!rectclip(&clipr, screenr))
108 p0 = subpt(ll->p0, ll->delta);
109 p1 = subpt(ll->p1, ll->delta);
110 clipr = rectsubpt(clipr, ll->delta);
115 _memline(dst, p0, p1, ll->end0, ll->end1, ll->radius, ll->src, ll->sp, clipr, ll->op);
119 memline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, Memimage *src, Point sp, int op)
121 _memline(dst, p0, p1, end0, end1, radius, src, sp, dst->clipr, op);