Skip to content

Fix #51498: imagefilledellipse does not work for large circles #7329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/gd/libgd/gd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1715,7 +1715,7 @@ void gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h, int s, int e
void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
{
int x=0,mx1=0,mx2=0,my1=0,my2=0;
long aq,bq,dx,dy,r,rx,ry,a,b;
int64_t aq,bq,dx,dy,r,rx,ry,a,b;

a=w>>1;
b=h>>1;
Expand Down Expand Up @@ -1754,7 +1754,7 @@ void gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, int c)
void gdImageFilledEllipse (gdImagePtr im, int mx, int my, int w, int h, int c)
{
int x=0,mx1=0,mx2=0,my1=0,my2=0;
long aq,bq,dx,dy,r,rx,ry,a,b;
int64_t aq,bq,dx,dy,r,rx,ry,a,b;
int i;
int old_y2;

Expand Down
20 changes: 20 additions & 0 deletions ext/gd/tests/bug51498.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Bug #51498 (imagefilledellipse does not work for large circles)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available");
if (!GD_BUNDLED && version_compare(GD_VERSION, "2.3.0") < 0) {
die("skip test requires GD 2.3.0 or higher");
}
?>
--FILE--
<?php
$img = imagecreatetruecolor(2200, 2200);
$white = imagecolorallocate($img, 255, 255, 255);
imagefilledellipse($img, 1100, 1100, 2200, 2200, $white);

require_once __DIR__ . '/func.inc';
test_image_equals_file(__DIR__ . '/bug51498_exp.png', $img);
?>
--EXPECT--
The images are equal.
Binary file added ext/gd/tests/bug51498_exp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.