Skip to content

Commit 4bec59f

Browse files
committed
Fix #79068: gdTransformAffineCopy() changes interpolation method
We port <libgd/libgd@9088591>.
1 parent 2c58605 commit 4bec59f

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ PHP NEWS
2525
. Fixed bug #78923 (Artifacts when convoluting image with transparency).
2626
(wilson chen)
2727
. Fixed bug #79067 (gdTransformAffineCopy() may use unitialized values). (cmb)
28+
. Fixed bug #79068 (gdTransformAffineCopy() changes interpolation method).
29+
(cmb)
2830

2931
- Libxml:
3032
. Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). (Laruence)

ext/gd/libgd/gd_interpolation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,7 @@ int gdTransformAffineCopy(gdImagePtr dst,
23512351
gdPointF pt, src_pt;
23522352
gdRect bbox;
23532353
int end_x, end_y;
2354-
gdInterpolationMethod interpolation_id_bak = GD_DEFAULT;
2354+
gdInterpolationMethod interpolation_id_bak = src->interpolation_id;
23552355
interpolation_method interpolation_bak;
23562356

23572357
/* These methods use special implementations */

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)