cvs: php-src(PHP_5_1) /ext/gd/libgd gd.c
| From: | Pierre-Alain Joye | Date: | Fri, 30 Sep 2005 20:48:08 +0000 |
| Subject: | cvs: php-src(PHP_5_1) /ext/gd/libgd gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-34200@lists.php.net to get a copy of this message | ||
pajoye Fri Sep 30 16:48:08 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/gd/libgd gd.c
Log:
- #33125, imagecopymergegray produces mosaic rainbow effect
at some point the alpha emulation formula has been broken
restored.
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.90&r2=1.90.2.1&ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.90 php-src/ext/gd/libgd/gd.c:1.90.2.1
--- php-src/ext/gd/libgd/gd.c:1.90 Sat Jul 23 12:41:38 2005
+++ php-src/ext/gd/libgd/gd.c Fri Sep 30 16:48:05 2005
@@ -1,4 +1,4 @@
-#include <stdio.h>
+
#include <math.h>
#include <string.h>
#include <stdlib.h>
@@ -2287,11 +2287,13 @@
for (x = srcX; (x < (srcX + w)); x++) {
int nc;
c = gdImageGetPixel (src, x, y);
+
/* Added 7/24/95: support transparent copies */
if (gdImageGetTransparent(src) == c) {
tox++;
continue;
}
+
/*
* If it's the same image, mapping is NOT trivial since we
* merge with greyscale target, but if pct is 100, the grey
@@ -2303,9 +2305,10 @@
dc = gdImageGetPixel(dst, tox, toy);
g = (0.29900f * gdImageRed(dst, dc)) + (0.58700f * gdImageGreen(dst, dc)) + (0.11400f *
gdImageBlue(dst, dc));
- ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + gdImageRed(dst, dc) * g * ((100 - pct) /
100.0f));
- ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + gdImageGreen(dst, dc) * g * ((100 - pct) /
100.0f));
- ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + gdImageBlue(dst, dc) * g * ((100 - pct) /
100.0f));
+ ncR = (int)(gdImageRed (src, c) * (pct / 100.0f) + g * ((100 - pct) / 100.0));
+ ncG = (int)(gdImageGreen (src, c) * (pct / 100.0f) + g * ((100 - pct) / 100.0));
+ ncB = (int)(gdImageBlue (src, c) * (pct / 100.0f) + g * ((100 - pct) / 100.0));
+
/* First look for an exact match */
nc = gdImageColorExact(dst, ncR, ncG, ncB);