From: Rasmus Lerdorf Date: Thu, 31 Jul 2008 09:22:17 +0000 (+0000) Subject: Fix for bug #45030 X-Git-Tag: php-5.2.7RC1~159 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7305654b69110d51469c3037ddb9c7ef9fba04fa;p=php Fix for bug #45030 --- 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)); + } + } } }