cvs: gd /libgd/src gd.c /libgd/tests/gdimagecopy bug00081.c bug00081_exp.png
[email protected] ("Pierre-Alain Joye") Tue, 20 Nov 2007 13:43:35 -0000
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvspajoye1195566215@cvsserver> |
pajoye Tue Nov 20 13:43:35 2007 UTC
Added files:
/gd/libgd/tests/gdimagecopy bug00081.c bug00081_exp.png
Modified files:
/gd/libgd/src gd.c
Log:
- #81, MFB, gdImageCopy ignores the transparent color
http://cvs.php.net/viewvc.cgi/gd/libgd/src/gd.c?r1=1.72&r2=1.73&diff_format=u
Index: gd/libgd/src/gd.c
diff -u gd/libgd/src/gd.c:1.72 gd/libgd/src/gd.c:1.73
--- gd/libgd/src/gd.c:1.72 Sun Sep 9 13:14:25 2007
+++ gd/libgd/src/gd.c Tue Nov 20 13:43:35 2007
@@ -1,4 +1,4 @@
-/* $Id: gd.c,v 1.72 2007/09/09 13:14:25 mattias Exp $ */
+/* $Id: gd.c,v 1.73 2007/11/20 13:43:35 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -2229,7 +2229,9 @@
for (y = 0; (y < h); y++) {
for (x = 0; (x < w); x++) {
int c = gdImageGetTrueColorPixel (src, srcX + x, srcY + y);
- gdImageSetPixel (dst, dstX + x, dstY + y, c);
+ if (c != src->transparent) {
+ gdImageSetPixel (dst, dstX + x, dstY + y, c);
+ }
}
}
} else {
http://cvs.php.net/viewvc.cgi/gd/libgd/tests/gdimagecopy/bug00081.c?view=markup&rev=1.1
Index: gd/libgd/tests/gdimagecopy/bug00081.c
+++ gd/libgd/tests/gdimagecopy/bug00081.c
/* $Id: bug00081.c,v 1.1 2007/11/20 13:43:35 pajoye Exp $ */
#include "gd.h"
#include <stdio.h>
#include <stdlib.h>
#include "gdtest.h"
int main()
{
gdImagePtr im, im2;
int error = 0;
FILE *fp;
char path[2048];
const char *file_exp = "bug00081_exp.png";
im = gdImageCreateTrueColor(5, 5);
gdImageFilledRectangle(im, 0, 0, 49, 49, 0x00FFFFFF);
gdImageColorTransparent(im, 0xFFFFFF);
gdImageFilledRectangle(im, 1, 1, 4, 4, 0xFF00FF);
im2 = gdImageCreateTrueColor(20, 20);
gdImageCopy(im2, im, 2, 2 , 0, 0, gdImageSX(im), gdImageSY(im));
sprintf(path, "%s/gdimagecopy/%s", GDTEST_TOP_DIR, file_exp);
if (!gdAssertImageEqualsToFile(path, im2)) {
error = 1;
printf("Reference image and destination differ\n");
}
gdImageDestroy(im);
gdImageDestroy(im2);
return error;
}