Skip to content

Commit 5c51a48

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fix #79068: gdTransformAffineCopy() changes interpolation method
2 parents 730f4f2 + 74b11e3 commit 5c51a48

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ext/gd/libgd/gd_interpolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2306,7 +2306,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
23062306
gdPointF pt, src_pt;
23072307
gdRect bbox;
23082308
int end_x, end_y;
2309-
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
2309+
gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
23102310

23112311
/* These methods use special implementations */
23122312
if (src->interpolation_id == GD_BILINEAR_FIXED || src->interpolation_id == GD_BICUBIC_FIXED || src->interpolation_id == GD_NEAREST_NEIGHBOUR) {

ext/gd/tests/bug79068.phpt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
Bug #79068 (gdTransformAffineCopy() changes interpolation method)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
require_once __DIR__ . '/func.inc';
10+
11+
$src = imagecreatetruecolor(100, 100);
12+
imagefilledrectangle($src, 0, 0, 99, 99, 0xffffff);
13+
imageline($src, 10, 10, 90, 90, 0x000000);
14+
imagesetinterpolation($src, IMG_BSPLINE);
15+
imageaffine($src, [1, 1, 1, 1, 1, 1]);
16+
$dst = imagerotate($src, 80, 0xffffff);
17+
18+
test_image_equals_file(__DIR__ . '/bug79068.png', $dst);
19+
?>
20+
--EXPECT--
21+
The images are equal.

ext/gd/tests/bug79068.png

798 Bytes
Loading

0 commit comments

Comments
 (0)