File: 0005-Fix-847-enable-back-GD_BICUBIC-interpolation-methods.patch

package info (click to toggle)
libgd2 2.3.3-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,396 kB
  • sloc: ansic: 49,708; sh: 5,660; javascript: 1,859; cpp: 1,308; makefile: 345; perl: 197; tcl: 45
file content (69 lines) | stat: -rw-r--r-- 2,537 bytes parent folder | download | duplicates (2)
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();
+}