mirror of
https://github.com/php/php-src.git
synced 2025-01-23 20:23:31 +08:00
Merge branch 'PHP-7.0' into PHP-7.1
This commit is contained in:
commit
a16f0c5e01
4
NEWS
4
NEWS
@ -20,7 +20,9 @@ PHP NEWS
|
||||
|
||||
- GD:
|
||||
. Fixed bug #73213 (Integer overflow in imageline() with antialiasing). (cmb)
|
||||
|
||||
. Fixed bug #73272 (imagescale() is not affected by, but affects
|
||||
imagesetinterpolation()). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #73203 (passing additional_parameters causes mail to fail). (cmb)
|
||||
|
||||
|
@ -4695,7 +4695,7 @@ PHP_FUNCTION(imagescale)
|
||||
gdImagePtr im_scaled = NULL;
|
||||
int new_width, new_height;
|
||||
zend_long tmp_w, tmp_h=-1, tmp_m = GD_BILINEAR_FIXED;
|
||||
gdInterpolationMethod method;
|
||||
gdInterpolationMethod method, old_method;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|ll", &IM, &tmp_w, &tmp_h, &tmp_m) == FAILURE) {
|
||||
return;
|
||||
@ -4724,9 +4724,12 @@ PHP_FUNCTION(imagescale)
|
||||
new_width = tmp_w;
|
||||
new_height = tmp_h;
|
||||
|
||||
/* gdImageGetInterpolationMethod() is only available as of GD 2.1.1 */
|
||||
old_method = im->interpolation_id;
|
||||
if (gdImageSetInterpolationMethod(im, method)) {
|
||||
im_scaled = gdImageScale(im, new_width, new_height);
|
||||
}
|
||||
gdImageSetInterpolationMethod(im, old_method);
|
||||
|
||||
if (im_scaled == NULL) {
|
||||
RETURN_FALSE;
|
||||
|
24
ext/gd/tests/bug73272.phpt
Normal file
24
ext/gd/tests/bug73272.phpt
Normal file
@ -0,0 +1,24 @@
|
||||
--TEST--
|
||||
Bug #73272 (imagescale() is not affected by, but affects imagesetinterpolation())
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
|
||||
|
||||
$src = imagecreatetruecolor(100, 100);
|
||||
imagefilledrectangle($src, 0,0, 99,99, 0xFFFFFF);
|
||||
imageellipse($src, 49,49, 40,40, 0x000000);
|
||||
|
||||
imagesetinterpolation($src, IMG_NEAREST_NEIGHBOUR);
|
||||
imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
|
||||
$dst = imagerotate($src, 60, 0xFFFFFF);
|
||||
|
||||
test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug73272.png', $dst);
|
||||
?>
|
||||
===DONE===
|
||||
--EXPECT--
|
||||
The images are equal.
|
||||
===DONE===
|
BIN
ext/gd/tests/bug73272.png
Normal file
BIN
ext/gd/tests/bug73272.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 739 B |
Loading…
Reference in New Issue
Block a user