summaryrefslogtreecommitdiff
path: root/ext/gd
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-01-06 10:39:00 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-01-06 10:39:00 +0100
commit5c51a482c9594c6d5f4fa8779f98c24a329ead45 (patch)
treec1b0ab137deaaace029caa15bcaed253b2f8cf6a /ext/gd
parent730f4f25dbf24090f3511aa335dc50f02e8f1053 (diff)
parent74b11e3315d4204d391e4212a2be800b235af41e (diff)
downloadphp-git-5c51a482c9594c6d5f4fa8779f98c24a329ead45.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79068: gdTransformAffineCopy() changes interpolation method
Diffstat (limited to 'ext/gd')
-rw-r--r--ext/gd/libgd/gd_interpolation.c2
-rw-r--r--ext/gd/tests/bug79068.phpt21
-rw-r--r--ext/gd/tests/bug79068.pngbin0 -> 798 bytes
3 files changed, 22 insertions, 1 deletions
diff --git a/ext/gd/libgd/gd_interpolation.c b/ext/gd/libgd/gd_interpolation.c
index e6d672ec8f..698e407fbf 100644
--- a/ext/gd/libgd/gd_interpolation.c
+++ b/ext/gd/libgd/gd_interpolation.c
@@ -2306,7 +2306,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
gdPointF pt, src_pt;
gdRect bbox;
int end_x, end_y;
- gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
+ gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
/* These methods use special implementations */
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {
diff --git a/ext/gd/tests/bug79068.phpt b/ext/gd/tests/bug79068.phpt
new file mode 100644
index 0000000000..391424b119
--- /dev/null
+++ b/ext/gd/tests/bug79068.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #79068 (gdTransformAffineCopy() changes interpolation method)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . '/func.inc';
+
+$src = imagecreatetruecolor(100, 100);
+imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
+imageline($src, 10, 10, 90, 90, 0x000000);
+imagesetinterpolation($src, IMG_BSPLINE);
+imageaffine($src, [1, 1, 1, 1, 1, 1]);
+$dst = imagerotate($src, 80, 0xffffff);
+
+test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
+?>
+--EXPECT--
+The images are equal.
diff --git a/ext/gd/tests/bug79068.png b/ext/gd/tests/bug79068.png
new file mode 100644
index 0000000000..805edc1c56
--- /dev/null
+++ b/ext/gd/tests/bug79068.png
Binary files differ