pajoye          Tue Jul  7 10:50:10 2009 UTC

  Modified files:              
    /php-src/ext/gd/libgd       gd.c 
  Log:
  - MF53: #45905, imagefilledrectangle() clipping error
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.126&r2=1.127&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.126 php-src/ext/gd/libgd/gd.c:1.127
--- php-src/ext/gd/libgd/gd.c:1.126     Wed May 27 07:16:55 2009
+++ php-src/ext/gd/libgd/gd.c   Tue Jul  7 10:50:06 2009
@@ -2111,21 +2111,10 @@
 {
        int x, y;
 
-       /* Nick Atty: limit the points at the edge.  Note that this also
-        * nicely kills any plotting for rectangles completely outside the
-        * window as it makes the tests in the for loops fail
-        */
-       if (x1 < 0) {
-               x1 = 0;
-       }
-       if (x1 > gdImageSX(im)) {
-               x1 = gdImageSX(im);
-       }
-       if(y1 < 0) {
-               y1 = 0;
-       }
-       if (y1 > gdImageSY(im)) {
-               y1 = gdImageSY(im);
+
+       if (x1 == x2 && y1 == y2) {
+               gdImageSetPixel(im, x1, y1, color);
+               return;
        }
        if (x1 > x2) {
                x = x1;
@@ -2138,6 +2127,22 @@
                y2 = y;
        }
 
+       if (x1 < 0) {
+               x1 = 0;
+       }
+
+       if (x2 >= gdImageSX(im)) {
+               x2 = gdImageSX(im) - 1;
+       }
+
+       if (y1 < 0) {
+               y1 = 0;
+       }
+
+       if (y2 >= gdImageSY(im)) {
+               y2 = gdImageSY(im) - 1;
+       }
+
        for (y = y1; (y <= y2); y++) {
                for (x = x1; (x <= x2); x++) {
                        gdImageSetPixel (im, x, y, color);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to