summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gd_filter.c1
-rw-r--r--tests/gdimageconvolution/.gitignore1
-rw-r--r--tests/gdimageconvolution/CMakeLists.txt2
-rw-r--r--tests/gdimageconvolution/Makemodule.am3
-rw-r--r--tests/gdimageconvolution/bug00369.c28
5 files changed, 35 insertions, 0 deletions
diff --git a/src/gd_filter.c b/src/gd_filter.c
index 1009874..7855190 100644
--- a/src/gd_filter.c
+++ b/src/gd_filter.c
@@ -537,6 +537,7 @@ BGD_DECLARE(int) gdImageConvolution(gdImagePtr src, float filter[3][3], float fi
for ( y=0; y<src->sy; y++) {
for(x=0; x<src->sx; x++) {
new_r = new_g = new_b = 0;
+ pxl = f(srcback, x, y);
new_a = gdImageAlpha(srcback, pxl);
for (j=0; j<3; j++) {
diff --git a/tests/gdimageconvolution/.gitignore b/tests/gdimageconvolution/.gitignore
index 1ffd796..6665df0 100644
--- a/tests/gdimageconvolution/.gitignore
+++ b/tests/gdimageconvolution/.gitignore
@@ -1 +1,2 @@
/basic
+/bug00369
diff --git a/tests/gdimageconvolution/CMakeLists.txt b/tests/gdimageconvolution/CMakeLists.txt
index 802c382..dc1fc51 100644
--- a/tests/gdimageconvolution/CMakeLists.txt
+++ b/tests/gdimageconvolution/CMakeLists.txt
@@ -1,3 +1,5 @@
+LIST(APPEND TESTS_FILES bug00369)
+
IF(PNG_FOUND)
LIST(APPEND TESTS_FILES
basic
diff --git a/tests/gdimageconvolution/Makemodule.am b/tests/gdimageconvolution/Makemodule.am
index 8f65b0f..df5249d 100644
--- a/tests/gdimageconvolution/Makemodule.am
+++ b/tests/gdimageconvolution/Makemodule.am
@@ -1,3 +1,6 @@
+libgd_test_programs += \
+ gdimageconvolution/bug00369
+
if HAVE_LIBPNG
libgd_test_programs += \
gdimageconvolution/basic
diff --git a/tests/gdimageconvolution/bug00369.c b/tests/gdimageconvolution/bug00369.c
new file mode 100644
index 0000000..631cb7a
--- /dev/null
+++ b/tests/gdimageconvolution/bug00369.c
@@ -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();
+}