From: Ilia Alshanetsky Date: Sun, 12 Apr 2009 14:44:34 +0000 (+0000) Subject: MFB: Fixed bug #47946 (ImageConvolution overwrites background) X-Git-Tag: php-5.2.10RC1~223 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6b719df163d29c903168a4757816d69cc78d7738;p=php MFB: Fixed bug #47946 (ImageConvolution overwrites background) --- diff --git a/NEWS b/NEWS index 61b408bc2e..ddaa7f8e69 100644 --- 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) diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index a2677c11dd..5cee6ef23c 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -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) {