Fixed bug #47946 (ImageConvolution overwrites background)

# original patch by  jcolby at acsol dot net
This commit is contained in:
Ilia Alshanetsky 2009-04-12 14:43:21 +00:00
parent 90a2d19794
commit c593790b62

View File

@ -3870,7 +3870,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;
@ -3880,6 +3880,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) {