]> git.pld-linux.org Git - packages/gd.git/blob - gd-2.0.35-AALineThick.patch
up to 2.1-rc1
[packages/gd.git] / gd-2.0.35-AALineThick.patch
1 diff -up gd-2.0.35/gd.c.AALineThick gd-2.0.35/gd.c
2 --- gd-2.0.35/gd.c.AALineThick  2007-06-19 22:25:51.000000000 +0200
3 +++ gd-2.0.35/gd.c      2012-02-28 11:02:09.708015922 +0100
4 @@ -3474,6 +3474,8 @@ static void gdImageAALine (gdImagePtr im
5         /* keep them as 32bits */
6         long x, y, inc;
7         long dx, dy,tmp;
8 +       int w, wid, wstart; 
9 +       int thick = im->thick; 
10  
11         if (!im->trueColor) {
12                 /* TBB: don't crash when the image is of the wrong type */
13 @@ -3502,6 +3504,25 @@ static void gdImageAALine (gdImagePtr im
14                 gdImageSetAAPixelColor(im, x1, y1, col, 0xFF);
15                 return;
16         }
17 +       else { 
18 +           double ag; 
19 +           if (abs(dy) < abs(dx))  
20 +               ag  = cos (atan2 (dy, dx)); 
21 +           else  
22 +               ag = sin (atan2 (dy, dx)); 
23 +           if (ag != 0)
24 +           {
25 +               wid = abs(thick / ag); 
26 +           }
27 +           else
28 +           {
29 +               wid = 1;
30 +           } 
31 +           if (wid == 0)
32 +           {
33 +               wid = 1;
34 +           } 
35 +       } 
36         if (abs(dx) > abs(dy)) {
37                 if (dx < 0) {
38                         tmp = x1;
39 @@ -3518,8 +3539,11 @@ static void gdImageAALine (gdImagePtr im
40                 inc = (dy * 65536) / dx;
41                 /* TBB: set the last pixel for consistency (<=) */
42                 while ((x >> 16) <= x2) {
43 -                       gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF);
44 -                       gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF);
45 +                       wstart = (y >> 16) - wid / 2;
46 +                       for (w = wstart; w < wstart + wid; w++) {    
47 +                           gdImageSetAAPixelColor(im, (x >> 16) , w , col , (y >> 8) & 0xFF); 
48 +                           gdImageSetAAPixelColor(im, (x >> 16) , w + 1 , col, (~y >> 8) & 0xFF); 
49 +                       } 
50                         x += (1 << 16);
51                         y += inc;
52                 }
53 @@ -3539,8 +3563,11 @@ static void gdImageAALine (gdImagePtr im
54                 inc = (dx * 65536) / dy;
55                 /* TBB: set the last pixel for consistency (<=) */
56                 while ((y>>16) <= y2) {
57 -                       gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF);
58 -                       gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF);
59 +                       wstart = (x >> 16) - wid / 2;
60 +                       for (w = wstart; w < wstart + wid; w++) { 
61 +                           gdImageSetAAPixelColor(im, w , y >> 16  , col, (x >> 8) & 0xFF);                    
62 +                           gdImageSetAAPixelColor(im, w + 1, y >> 16, col, (~x >> 8) & 0xFF);   
63 +                       }
64                         x += inc;
65                         y += (1<<16);
66                 }
This page took 0.053288 seconds and 3 git commands to generate.