@@ -1593,7 +1593,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
1593
1593
int i , pti ;
1594
1594
int lx = 0 , ly = 0 ;
1595
1595
int fx = 0 , fy = 0 ;
1596
-
1596
+ int startx , starty , endx , endy ;
1597
1597
1598
1598
if ((s % 360 ) == (e % 360 )) {
1599
1599
s = 0 ; e = 360 ;
@@ -1620,8 +1620,8 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
1620
1620
1621
1621
for (i = s , pti = 1 ; i <= e ; i ++ , pti ++ ) {
1622
1622
int x , y ;
1623
- x = ((long ) gdCosT [i % 360 ] * (long ) w / (2 * 1024 )) + cx ;
1624
- y = ((long ) gdSinT [i % 360 ] * (long ) h / (2 * 1024 )) + cy ;
1623
+ x = endx = ((long ) gdCosT [i % 360 ] * (long ) w / (2 * 1024 )) + cx ;
1624
+ y = endy = ((long ) gdSinT [i % 360 ] * (long ) h / (2 * 1024 )) + cy ;
1625
1625
if (i != s ) {
1626
1626
if (!(style & gdChord )) {
1627
1627
if (style & gdNoFill ) {
@@ -1646,8 +1646,8 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
1646
1646
if (!(style & (gdChord | gdNoFill ))) {
1647
1647
pts [0 ].x = cx ;
1648
1648
pts [0 ].y = cy ;
1649
- pts [pti ].x = x ;
1650
- pts [pti ].y = y ;
1649
+ pts [pti ].x = startx = x ;
1650
+ pts [pti ].y = starty = y ;
1651
1651
}
1652
1652
}
1653
1653
lx = x ;
@@ -1676,6 +1676,24 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
1676
1676
gdImageLine (im , cx , cy , fx , fy , color );
1677
1677
}
1678
1678
} else {
1679
+ if (e - s < 360 ) {
1680
+ if (pts [1 ].x != startx && pts [1 ].y == starty ) {
1681
+ /* start point has been removed due to y-coord fix => insert it */
1682
+ for (i = pti ; i > 1 ; i -- ) {
1683
+ pts [i ].x = pts [i - 1 ].x ;
1684
+ pts [i ].y = pts [i - 1 ].y ;
1685
+ }
1686
+ pts [1 ].x = startx ;
1687
+ pts [1 ].y = starty ;
1688
+ pti ++ ;
1689
+ }
1690
+ if (pts [pti - 1 ].x != endx && pts [pti - 1 ].y == endy ) {
1691
+ /* end point has been removed due to y-coord fix => insert it */
1692
+ pts [pti ].x = endx ;
1693
+ pts [pti ].y = endy ;
1694
+ pti ++ ;
1695
+ }
1696
+ }
1679
1697
pts [pti ].x = cx ;
1680
1698
pts [pti ].y = cy ;
1681
1699
gdImageFilledPolygon (im , pts , pti + 1 , color );
0 commit comments