summaryrefslogtreecommitdiff
path: root/ext/gd/libgd/gd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/libgd/gd.c')
-rw-r--r--ext/gd/libgd/gd.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index c96e2085f0..6284d09190 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -1593,7 +1593,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
int i, pti;
int lx = 0, ly = 0;
int fx = 0, fy = 0;
-
+ int startx, starty, endx, endy;
if ((s % 360) == (e % 360)) {
s = 0; e = 360;
@@ -1620,8 +1620,8 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
for (i = s, pti = 1; i <= e; i++, pti++) {
int x, y;
- x = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
- y = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
+ x = endx = ((long) gdCosT[i % 360] * (long) w / (2 * 1024)) + cx;
+ y = endy = ((long) gdSinT[i % 360] * (long) h / (2 * 1024)) + cy;
if (i != s) {
if (!(style & gdChord)) {
if (style & gdNoFill) {
@@ -1646,8 +1646,8 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
if (!(style & (gdChord | gdNoFill))) {
pts[0].x = cx;
pts[0].y = cy;
- pts[pti].x = x;
- pts[pti].y = y;
+ pts[pti].x = startx = x;
+ pts[pti].y = starty = y;
}
}
lx = x;
@@ -1676,6 +1676,24 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
gdImageLine(im, cx, cy, fx, fy, color);
}
} else {
+ if (e - s < 360) {
+ if (pts[1].x != startx && pts[1].y == starty) {
+ /* start point has been removed due to y-coord fix => insert it */
+ for (i = pti; i > 1; i--) {
+ pts[i].x = pts[i-1].x;
+ pts[i].y = pts[i-1].y;
+ }
+ pts[1].x = startx;
+ pts[1].y = starty;
+ pti++;
+ }
+ if (pts[pti-1].x != endx && pts[pti-1].y == endy) {
+ /* end point has been removed due to y-coord fix => insert it */
+ pts[pti].x = endx;
+ pts[pti].y = endy;
+ pti++;
+ }
+ }
pts[pti].x = cx;
pts[pti].y = cy;
gdImageFilledPolygon(im, pts, pti+1, color);