afb210
diff -up gd-2.0.35/gd.c.AALineThick gd-2.0.35/gd.c
afb210
--- gd-2.0.35/gd.c.AALineThick	2007-06-19 22:25:51.000000000 +0200
afb210
+++ gd-2.0.35/gd.c	2012-02-28 11:02:09.708015922 +0100
afb210
@@ -3474,6 +3474,8 @@ static void gdImageAALine (gdImagePtr im
afb210
 	/* keep them as 32bits */
afb210
 	long x, y, inc;
afb210
 	long dx, dy,tmp;
afb210
+	int w, wid, wstart; 
afb210
+	int thick = im->thick; 
afb210
 
afb210
 	if (!im->trueColor) {
afb210
 		/* TBB: don't crash when the image is of the wrong type */
afb210
@@ -3502,6 +3504,25 @@ static void gdImageAALine (gdImagePtr im
afb210
 		gdImageSetAAPixelColor(im, x1, y1, col, 0xFF);
afb210
 		return;
afb210
 	}
afb210
+	else { 
afb210
+	    double ag; 
afb210
+	    if (abs(dy) < abs(dx))  
afb210
+		ag  = cos (atan2 (dy, dx)); 
afb210
+	    else  
afb210
+		ag = sin (atan2 (dy, dx)); 
afb210
+	    if (ag != 0)
afb210
+	    {
afb210
+		wid = abs(thick / ag); 
afb210
+	    }
afb210
+	    else
afb210
+	    {
afb210
+		wid = 1;
afb210
+	    } 
afb210
+	    if (wid == 0)
afb210
+	    {
afb210
+		wid = 1;
afb210
+	    } 
afb210
+	} 
afb210
 	if (abs(dx) > abs(dy)) {
afb210
 		if (dx < 0) {
afb210
 			tmp = x1;
afb210
@@ -3518,8 +3539,11 @@ static void gdImageAALine (gdImagePtr im
afb210
 		inc = (dy * 65536) / dx;
afb210
 		/* TBB: set the last pixel for consistency (<=) */
afb210
 		while ((x >> 16) <= x2) {
afb210
-			gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
afb210
-			gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
afb210
+			wstart = (y >> 16) - wid / 2;
afb210
+			for (w = wstart; w < wstart + wid; w++) {    
afb210
+			    gdImageSetAAPixelColor(im, (x >> 16) , w , col , (y >> 8) & 0xFF); 
afb210
+			    gdImageSetAAPixelColor(im, (x >> 16) , w + 1 , col, (~y >> 8) & 0xFF); 
afb210
+			} 
afb210
 			x += (1 << 16);
afb210
 			y += inc;
afb210
 		}
afb210
@@ -3539,8 +3563,11 @@ static void gdImageAALine (gdImagePtr im
afb210
 		inc = (dx * 65536) / dy;
afb210
 		/* TBB: set the last pixel for consistency (<=) */
afb210
 		while ((y>>16) <= y2) {
afb210
-			gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
afb210
-			gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
afb210
+			wstart = (x >> 16) - wid / 2;
afb210
+			for (w = wstart; w < wstart + wid; w++) { 
afb210
+			    gdImageSetAAPixelColor(im, w , y >> 16  , col, (x >> 8) & 0xFF);                    
afb210
+			    gdImageSetAAPixelColor(im, w + 1, y >> 16, col, (~x >> 8) & 0xFF);   
afb210
+			}
afb210
 			x += inc;
afb210
 			y += (1<<16);
afb210
 		}