fixed the p0/sp correspondence for the optimized case (horizontal/vertical). line(dst, p0, p1, end0, end1, thick, src, sp) Line draws in dst a line of width 1+2*thick pixels joining points p0 and p1. The line is drawn using pix- els from the src image aligned so sp in the source cor- responds to p0 in the destination. Notes: Thu Jul 7 08:02:17 EDT 2005 rsc please send patches that are just the change you want to make. deleting that comment meant i had to work extra hard to preserve it. thanks. Reference: /n/sources/patch/applied/linesrcalign Date: Mon Jul 4 20:40:46 CES 2005 Reviewed-by: rsc --- /sys/src/libmemdraw/line.c Mon Jul 4 20:38:19 2005 +++ /sys/src/libmemdraw/line.c Mon Jul 4 20:38:15 2005 @@ -315,12 +315,6 @@ void _memimageline(Memimage *dst, Point p0, Point p1, int end0, int end1, int radius, Memimage *src, Point sp, Rectangle clipr, int op) { - /* - * BUG: We should really really pick off purely horizontal and purely - * vertical lines and handle them separately with calls to memimagedraw - * on rectangles. - */ - int hor; int sin, cos, dx, dy, t; Rectangle oclipr, r; @@ -369,6 +363,7 @@ } oclipr = dst->clipr; dst->clipr = clipr; + sp = addpt(r.min, d); memimagedraw(dst, r, src, sp, memopaque, sp, op); dst->clipr = oclipr; return;