Fixed #369: fix new_a init error in gdImageConvolution()
parent
b9004db6a2
commit
4b0f372402
|
@ -537,6 +537,7 @@ BGD_DECLARE(int) gdImageConvolution(gdImagePtr src, float filter[3][3], float fi
|
||||||
for ( y=0; y<src->sy; y++) {
|
for ( y=0; y<src->sy; y++) {
|
||||||
for(x=0; x<src->sx; x++) {
|
for(x=0; x<src->sx; x++) {
|
||||||
new_r = new_g = new_b = 0;
|
new_r = new_g = new_b = 0;
|
||||||
|
pxl = f(srcback, x, y);
|
||||||
new_a = gdImageAlpha(srcback, pxl);
|
new_a = gdImageAlpha(srcback, pxl);
|
||||||
|
|
||||||
for (j=0; j<3; j++) {
|
for (j=0; j<3; j++) {
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
/basic
|
/basic
|
||||||
|
/bug00369
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
LIST(APPEND TESTS_FILES bug00369)
|
||||||
|
|
||||||
IF(PNG_FOUND)
|
IF(PNG_FOUND)
|
||||||
LIST(APPEND TESTS_FILES
|
LIST(APPEND TESTS_FILES
|
||||||
basic
|
basic
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
libgd_test_programs += \
|
||||||
|
gdimageconvolution/bug00369
|
||||||
|
|
||||||
if HAVE_LIBPNG
|
if HAVE_LIBPNG
|
||||||
libgd_test_programs += \
|
libgd_test_programs += \
|
||||||
gdimageconvolution/basic
|
gdimageconvolution/basic
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/**
|
||||||
|
* Test Issue #369 for gdImageConvolution()
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gd.h"
|
||||||
|
#include "gdtest.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
gdImagePtr im;
|
||||||
|
float matrix[3][3] = {
|
||||||
|
{1, 0, 1},
|
||||||
|
{0, 5, 0},
|
||||||
|
{1, 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
im = gdImageCreateTrueColor(40, 40);
|
||||||
|
gdImageAlphaBlending(im, gdEffectReplace);
|
||||||
|
gdImageFilledRectangle(im, 0, 0, 39, 39, 0x7FFFFFFF);
|
||||||
|
gdImageFilledEllipse(im, 19, 19, 20, 20, 0x00FF00);
|
||||||
|
|
||||||
|
gdImageConvolution(im, matrix, 9, 1);
|
||||||
|
gdTestAssert(0x7F010101 == gdImageGetPixel(im, 0, 0));
|
||||||
|
|
||||||
|
gdImageDestroy(im);
|
||||||
|
|
||||||
|
return gdNumFailures();
|
||||||
|
}
|
Loading…
Reference in New Issue