From: Pierre Joye Date: Fri, 30 Dec 2005 01:19:32 +0000 (+0000) Subject: - add some basic optimisations, usefull when you draw many horizontal or X-Git-Tag: RELEASE_1_0_4~193 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3afdc2e49020a3ec46e3c101fb6fede3a7f7c189;p=php - add some basic optimisations, usefull when you draw many horizontal or vertical lines like in charts --- diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 1ac09a76fc..66214dfe70 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -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;