From 3afdc2e49020a3ec46e3c101fb6fede3a7f7c189 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Fri, 30 Dec 2005 01:19:32 +0000 Subject: [PATCH] - add some basic optimisations, usefull when you draw many horizontal or vertical lines like in charts --- ext/gd/libgd/gd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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; -- 2.50.1