cvs: php-src(PHP_5_2) / NEWS /ext/gd/libgd gd.c
| From: | Pierre-Alain Joye | Date: | Sat, 04 Nov 2006 14:27:07 +0000 |
| Subject: | cvs: php-src(PHP_5_2) / NEWS /ext/gd/libgd gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-41349@lists.php.net to get a copy of this message | ||
pajoye Sat Nov 4 14:27:07 2006 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/php-src/ext/gd/libgd gd.c
Log:
- MFH: optimize horizontal and vertical lines
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.329&r2=1.2027.2.547.2.330&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.329 php-src/NEWS:1.2027.2.547.2.330
--- php-src/NEWS:1.2027.2.547.2.329 Sat Nov 4 03:15:31 2006
+++ php-src/NEWS Sat Nov 4 14:27:06 2006
@@ -11,6 +11,7 @@
. Make sure PHP_SELF is filtered in Apache 1 sapi.
. Fixed bug #39358 (INSTALL_HEADERS contains incorrect reference to
php_filter.h).
+- Added optimization for imageline with horizontal and vertial lines (Pierre)
- Fixed bug #39366 (imagerotate does not use alpha with angle > 45°) (Pierre)
- Fixed bug #39273 (imagecopyresized may ignore alpha channel) (Pierre)
- Fixed bug #39364 (Removed warning on empty haystack inside mb_strstr()).
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.90.2.1.2.4&r2=1.90.2.1.2.5&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.4 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.4 Sat Nov 4 03:15:31 2006
+++ php-src/ext/gd/libgd/gd.c Sat Nov 4 14:27:07 2006
@@ -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;
@@ -1029,6 +1030,31 @@
return;
}
+ /* Vertical */
+ if (x1==x2) {
+ if (y2 < y1) {
+ t = y2;
+ y2 = y1;
+ y1 = t;
+ }
+
+ for (;y1 <= y2; y1++) {
+ gdImageSetPixel(im, x1,y1, color);
+ }
+ return;
+ } else if (y1==y2) { /* Horizontal */
+ if (x2 < x1) {
+ t = x2;
+ x2 = x1;
+ x1 = t;
+ }
+
+ 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;