1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
From: Cyprien Nicolas <cyprien@octopuce.fr>
Date: Thu, 27 Oct 2022 14:36:33 +0200
Subject: Fix #847: enable back GD_BICUBIC* interpolation methods
---
src/gd_interpolation.c | 5 +++++
tests/gdimagesetinterpolationmethod/CMakeLists.txt | 1 +
tests/gdimagesetinterpolationmethod/Makemodule.am | 3 ++-
tests/gdimagesetinterpolationmethod/github_bug_00847.c | 12 ++++++++++++
4 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 tests/gdimagesetinterpolationmethod/github_bug_00847.c
diff --git a/src/gd_interpolation.c b/src/gd_interpolation.c
index 6a4d6c9..b9a4f09 100644
--- a/src/gd_interpolation.c
+++ b/src/gd_interpolation.c
@@ -2264,6 +2264,11 @@ BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMet
case GD_BESSEL:
im->interpolation = filter_bessel;
break;
+ case GD_BICUBIC_FIXED:
+ case GD_BICUBIC:
+ /* no interpolation as gdImageScale calls a dedicated function */
+ im->interpolation = NULL;
+ break;
case GD_BLACKMAN:
im->interpolation = filter_blackman;
break;
diff --git a/tests/gdimagesetinterpolationmethod/CMakeLists.txt b/tests/gdimagesetinterpolationmethod/CMakeLists.txt
index 6551062..bbed558 100644
--- a/tests/gdimagesetinterpolationmethod/CMakeLists.txt
+++ b/tests/gdimagesetinterpolationmethod/CMakeLists.txt
@@ -1,5 +1,6 @@
LIST(APPEND TESTS_FILES
github_bug_00584
+ github_bug_00847
)
ADD_GD_TESTS()
diff --git a/tests/gdimagesetinterpolationmethod/Makemodule.am b/tests/gdimagesetinterpolationmethod/Makemodule.am
index 1b83336..77d928d 100644
--- a/tests/gdimagesetinterpolationmethod/Makemodule.am
+++ b/tests/gdimagesetinterpolationmethod/Makemodule.am
@@ -1,5 +1,6 @@
libgd_test_programs += \
- gdimagesetinterpolationmethod/github_bug_00584
+ gdimagesetinterpolationmethod/github_bug_00584 \
+ gdimagesetinterpolationmethod/github_bug_00847
EXTRA_DIST += \
gdimagesetinterpolationmethod/CMakeLists.txt
diff --git a/tests/gdimagesetinterpolationmethod/github_bug_00847.c b/tests/gdimagesetinterpolationmethod/github_bug_00847.c
new file mode 100644
index 0000000..bd85216
--- /dev/null
+++ b/tests/gdimagesetinterpolationmethod/github_bug_00847.c
@@ -0,0 +1,12 @@
+#include "gd.h"
+#include "gdtest.h"
+
+int main()
+{
+ gdImagePtr im;
+ im = gdImageCreate(1, 1);
+ gdTestAssert(gdImageSetInterpolationMethod(im, GD_BICUBIC_FIXED) != 0);
+ gdTestAssert(gdImageGetInterpolationMethod(im) == GD_BICUBIC_FIXED);
+ gdImageDestroy(im);
+ return gdNumFailures();
+}
|