pajoye          Tue Nov 14 13:45:24 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/gd/libgd       gd.c 
  Log:
  - #39508, do not use the 4 neighbors implementation for small images (w<4)
    test will follow
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.5&r2=1.90.2.1.2.6&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.90.2.1.2.5 
php-src/ext/gd/libgd/gd.c:1.90.2.1.2.6
--- php-src/ext/gd/libgd/gd.c:1.90.2.1.2.5      Sat Nov  4 14:27:07 2006
+++ php-src/ext/gd/libgd/gd.c   Tue Nov 14 13:45:24 2006
@@ -1931,6 +1931,29 @@
                return;
        }
 
+       /* Do not use the 4 neighbors implementation with
+   * small images
+   */
+       if (im->sx < 4) {
+               int ix = x, iy = y, c;
+               do {
+                       c = gdImageGetPixel(im, ix, iy);
+                       if (c != oc) {
+                               return;
+                       }
+                       gdImageSetPixel(im, ix, iy, nc);
+               } while(ix++ < (im->sx -1));
+               ix = x; iy = y + 1;
+               do {
+                       c = gdImageGetPixel(im, ix, iy);
+                       if (c != oc) {
+                               return;
+                       }
+                       gdImageSetPixel(im, ix, iy, nc);
+               } while(ix++ < (im->sx -1));
+               return;
+       }
+
        stack = (struct seg *)safe_emalloc(sizeof(struct seg), 
((int)(im->sy*im->sx)/4), 1);
        sp = stack;
 

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

Reply via email to