]> granicus.if.org Git - php/commitdiff
- add some basic optimisations, usefull when you draw many horizontal or
authorPierre Joye <pajoye@php.net>
Fri, 30 Dec 2005 01:19:32 +0000 (01:19 +0000)
committerPierre Joye <pajoye@php.net>
Fri, 30 Dec 2005 01:19:32 +0000 (01:19 +0000)
  vertical lines like in charts

ext/gd/libgd/gd.c

index 1ac09a76fce9486c2723df657cfa287479017a06..66214dfe70af4f4c3f6199a68e7a8f375d2eaa45 100644 (file)
@@ -1029,6 +1029,22 @@ void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
                return;
        }
 
+       /* Vertical */
+       if (x1==x2) {
+               for (;y1 <= y2; y1++) {
+                       gdImageSetPixel(im, x1,y1, color);
+               }
+               return;
+       }
+
+       /* Horizontal */
+       if (y1==y2) {
+               for (;x1 <= x2; x1++) {
+                       gdImageSetPixel(im, x1,y1, color);
+               }
+               return;
+       }
+
        /* gdAntiAliased passed as color: set anti-aliased line (AAL) global vars. */
        if (color == gdAntiAliased) {
                im->AAL_x1 = x1;