[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] draw.line bounding box bug when width>1



I just realized that won't work - I didn't exchange the line ends properly
try this patch

Rolf Sievers schrieb:
meh...
I guess I can make a patch even if I can't compile. Some work for my little Tortoise.
Could someone with a compiler tell me if it works?
I used a temp variable here and fixed a line that was broken in my last mail.
Index: draw.c
===================================================================
--- draw.c	(revision 2664)
+++ draw.c	(working copy)
@@ -678,13 +678,20 @@
 {
 	int loop;
 	int xinc=0, yinc=0;
+	int temp;
 	int newpts[4];
 	int range[4];
 	int anydrawn = 0;
 
 	if(abs(pts[0]-pts[2]) > abs(pts[1]-pts[3]))
+		if(pts[1]>pts[3])
+			temp = pts[0]; pts[0] = pts[2]; pts[2] = temp;
+			temp = pts[1]; pts[1] = pts[3]; pts[3] = temp;
 		yinc = 1;
 	else
+		if(pts[0]>pts[2])
+			temp = pts[0]; pts[0] = pts[2]; pts[2] = temp;
+			temp = pts[1]; pts[1] = pts[3]; pts[3] = temp;
 		xinc = 1;
 
 	memcpy(newpts, pts, sizeof(int)*4);