]> granicus.if.org Git - php/commitdiff
Fix for bug #45030
authorRasmus Lerdorf <rasmus@php.net>
Thu, 31 Jul 2008 09:23:59 +0000 (09:23 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Thu, 31 Jul 2008 09:23:59 +0000 (09:23 +0000)
ext/gd/libgd/gd.c
ext/gd/libgd/gd_png.c

index 156031bd0cc9edfbc832c79c7e3247a51b085612..ebfae80dcc1a10f27db888e266ef20dfafd77269 100644 (file)
@@ -2613,6 +2613,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) {
index a002a9521288f05ced38307e67e3b73b81f27293..7591dc0c673ece5e0097dfa319a73713e22e05a0 100644 (file)
@@ -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));
+                                       }
+
                                }
                        }
                }