]> granicus.if.org Git - php/commitdiff
MFB: Fixed bug #47946 (ImageConvolution overwrites background)
authorIlia Alshanetsky <iliaa@php.net>
Sun, 12 Apr 2009 14:44:34 +0000 (14:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 12 Apr 2009 14:44:34 +0000 (14:44 +0000)
NEWS
ext/gd/libgd/gd.c

diff --git a/NEWS b/NEWS
index 61b408bc2e6d4116578a0af37ea23a3e268fbde6..ddaa7f8e693c0a1ac7c4ccdbcd0f054af8f41c9e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ PHP                                                                        NEWS
 - Fixed memory leak in ob_get_clean/ob_get_flush. (Christian)
 - Fixed segfault on invalid session.save_path. (Hannes)
 
+- Fixed bug #47946 (ImageConvolution overwrites background). (Ilia)
 - Fixed bug #47903 ("@" operator does not work with string offsets). (Felipe)
 - Fixed bug #47893 (CLI aborts on non blocking stdout). (Arnaud)
 - Fixed bug #47849 (Non-deep import loses the namespace). (Rob)
index a2677c11dd7bd1137b8189831234a474c12cf4e8..5cee6ef23cdc7bebca994cd8154c6240e877afc4 100644 (file)
@@ -3864,7 +3864,7 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo
        int         x, y, i, j, new_a;
        float       new_r, new_g, new_b;
        int         new_pxl, pxl=0;
-       gdImagePtr  srcback;
+       gdImagePtr  srcback, srctrans;
        typedef int (*FuncPtr)(gdImagePtr, int, int);
        FuncPtr f;
 
@@ -3874,6 +3874,10 @@ int gdImageConvolution(gdImagePtr src, float filter[3][3], float filter_div, flo
 
        /* We need the orinal image with each safe neoghb. pixel */
        srcback = gdImageCreateTrueColor (src->sx, src->sy);
+       srcback->saveAlphaFlag = 1;
+       srctrans = gdImageColorAllocateAlpha(srcback, 0, 0, 0, 127);
+       gdImageFill(srcback, 0, 0, srctrans);
+
        gdImageCopy(srcback, src,0,0,0,0,src->sx,src->sy);
 
        if (srcback==NULL) {