mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Fix #66882: imagerotate by -90 degrees truncates image by 1px
Contrary to the external libgd, the bundled libgd doesn't use optimized rotation algorithms for negative square angles. We fix that now. There are other improvements in gdImageRotateInterpolated() in the external libgd. I'll leave them out for now, in the hope that we'll be able to rejoin the two libraries rather soon.
This commit is contained in:
parent
72c2fc44e0
commit
2e34febb73
@ -2178,10 +2178,13 @@ gdImagePtr gdImageRotateInterpolated(const gdImagePtr src, const float angle, in
|
||||
|
||||
/* no interpolation needed here */
|
||||
switch (angle_rounded) {
|
||||
case 9000:
|
||||
case -27000:
|
||||
case 9000:
|
||||
return gdImageRotate90(src, 0);
|
||||
case 18000:
|
||||
case -18000:
|
||||
case 18000:
|
||||
return gdImageRotate180(src, 0);
|
||||
case -9000:
|
||||
case 27000:
|
||||
return gdImageRotate270(src, 0);
|
||||
}
|
||||
|
14
ext/gd/tests/bug66882.phpt
Normal file
14
ext/gd/tests/bug66882.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #66882 (imagerotate by -90 degrees truncates image by 1px)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('gd')) die('skip gd extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$im = imagerotate(imagecreate(10, 10), -90, 0);
|
||||
var_dump(imagesy($im), imagesx($im));
|
||||
?>
|
||||
--EXPECT--
|
||||
int(10)
|
||||
int(10)
|
Loading…
Reference in New Issue
Block a user