-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #73614: gdImageFilledArc() doesn't properly draw pies
The fix for PHP bug 43828[1] changed the algorithm from drawing filled pies from drawing multiple triangles to drawing a single polygon. Due to quirks of the filled polygon drawing algorithm, we had to filter out extraneous vertices. This lead, however, to a bug regarding displaced starting and ending points near 90° and 270° degrees, which we fix by reinserting these vertices if they had been removed. This fix is a port of libgd/libgd@1406b1a. [1] <https://bugs.php.net/bug.php?id=43828>
- Loading branch information
Showing
4 changed files
with
51 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Bug #73614 (gdImageFilledArc() doesn't properly draw pies) | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('gd')) die('skip gd extension not available'); | ||
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.5', '<=')) die('skip upstream bugfix not yet released'); | ||
?> | ||
--FILE-- | ||
<?php | ||
require_once __DIR__ . '/func.inc'; | ||
|
||
$image = imagecreatetruecolor(500, 500); | ||
|
||
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); | ||
$navy = imagecolorallocate($image, 0x00, 0x00, 0x80); | ||
$red = imagecolorallocate($image, 0xFF, 0x00, 0x00); | ||
|
||
imagefilledarc($image, 250, 250, 500, 250, 0, 88, $white, IMG_ARC_PIE); | ||
imagefilledarc($image, 250, 250, 500, 250, 88, 91 , $navy, IMG_ARC_PIE); | ||
imagefilledarc($image, 250, 250, 500, 250, 91, 360 , $red, IMG_ARC_PIE); | ||
|
||
test_image_equals_file(__DIR__ . '/bug73614.png', $image); | ||
?> | ||
===DONE=== | ||
--EXPECT-- | ||
The images are equal. | ||
===DONE=== |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.