diff options
author | Rasmus Lerdorf <rasmus@php.net> | 2008-07-31 09:23:18 +0000 |
---|---|---|
committer | Rasmus Lerdorf <rasmus@php.net> | 2008-07-31 09:23:18 +0000 |
commit | a3383ac3d7e21e54b1d7d89f308088d0692abc9f (patch) | |
tree | 96077968d5ac92ec1a40313ef9c0b5c77b0194d5 | |
parent | f02f9b0545e080d66c32488f82fc12c4cd21d566 (diff) | |
download | php-git-a3383ac3d7e21e54b1d7d89f308088d0692abc9f.tar.gz |
Fix for bug #45030
-rw-r--r-- | ext/gd/libgd/gd.c | 1 | ||||
-rw-r--r-- | ext/gd/libgd/gd_png.c | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index cfb50d4efd..d00c697016 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -2620,6 +2620,7 @@ void gdImageCopyResampled (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, i green /= spixels; blue /= spixels; alpha /= spixels; + alpha += 0.5; } if ( alpha_sum != 0.0f) { if( contrib_sum != 0.0f) { diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index a002a95212..7591dc0c67 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -689,7 +689,12 @@ void gdImagePngCtxEx (gdImagePtr im, gdIOCtx * outfile, int level, int basefilte */ a = gdTrueColorGetAlpha(thisPixel); /* Andrew Hull: >> 6, not >> 7! (gd 2.0.5) */ - *pOutputRow++ = 255 - ((a << 1) + (a >> 6)); + if (a == 127) { + *pOutputRow++ = 0; + } else { + *pOutputRow++ = 255 - ((a << 1) + (a >> 6)); + } + } } } |