Cherry-pick php-libgd fixes for imagefill() doesn't work correctly for small images

master
Ondřej Surý 2013-05-03 15:00:37 +02:00
parent ba8f21afb5
commit bc70152cd8
1 changed files with 9 additions and 15 deletions

View File

@ -1991,21 +1991,15 @@ BGD_DECLARE(void) gdImageFill(gdImagePtr im, int x, int y, int nc)
if (im->sx < 4) {
int ix = x, iy = y, c;
do {
c = gdImageGetPixel(im, ix, iy);
if (c != oc) {
goto done;
}
gdImageSetPixel(im, ix, iy, nc);
} while(ix++ < (im->sx -1));
ix = x;
iy = y + 1;
do {
c = gdImageGetPixel(im, ix, iy);
if (c != oc) {
goto done;
}
gdImageSetPixel(im, ix, iy, nc);
} while(ix++ < (im->sx -1));
do {
c = gdImageGetPixel(im, ix, iy);
if (c != oc) {
goto done;
}
gdImageSetPixel(im, ix, iy, nc);
} while(ix++ < (im->sx -1));
ix = x;
} while(iy++ < (im->sy -1));
goto done;
}