pajoye Fri Dec 30 09:53:05 2005 EDT
Modified files:
/php-src/ext/gd/libgd gd.c
Log:
- ensure that x1<x2 or y1<y2
http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/libgd/gd.c?r1=1.92&r2=1.93&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.92 php-src/ext/gd/libgd/gd.c:1.93
--- php-src/ext/gd/libgd/gd.c:1.92 Fri Dec 30 01:19:32 2005
+++ php-src/ext/gd/libgd/gd.c Fri Dec 30 09:53:05 2005
@@ -1019,6 +1019,7 @@
/* Bresenham as presented in Foley & Van Dam */
void gdImageLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
{
+ int t;
int dx, dy, incr1, incr2, d, x, y, xend, yend, xdirflag, ydirflag;
int wid;
int w, wstart;
@@ -1031,6 +1032,12 @@
/* Vertical */
if (x1==x2) {
+ if (y2 < y1) {
+ t = y2;
+ y2 = y1;
+ y1 = t;
+ }
+
for (;y1 <= y2; y1++) {
gdImageSetPixel(im, x1,y1, color);
}
@@ -1039,6 +1046,12 @@
/* Horizontal */
if (y1==y2) {
+ if (x2 < x1) {
+ t = x2;
+ x2 = x1;
+ x1 = t;
+ }
+
for (;x1 <= x2; x1++) {
gdImageSetPixel(im, x1,y1, color);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php