Update var type to hold bigger w&h for ellipse. And add corresponding test cases.
This commit is contained in:
parent
6271c38065
commit
ace7fd88dc
4
src/gd.c
4
src/gd.c
@ -2180,7 +2180,7 @@ BGD_DECLARE(void) gdImageFilledArc (gdImagePtr im, int cx, int cy, int w, int h,
|
||||
BGD_DECLARE(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;
|
||||
@ -2227,7 +2227,7 @@ BGD_DECLARE(void) gdImageEllipse(gdImagePtr im, int mx, int my, int w, int h, in
|
||||
BGD_DECLARE(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;
|
||||
|
||||
|
@ -53,6 +53,7 @@ if (BUILD_TEST)
|
||||
gdimagefilltoborder
|
||||
gdimagefilter
|
||||
gdimageflip
|
||||
gdimageellipse
|
||||
gdimagegrayscale
|
||||
gdimageline
|
||||
gdimagenegate
|
||||
|
@ -49,6 +49,7 @@ include gdimagefilledrectangle/Makemodule.am
|
||||
include gdimagefilltoborder/Makemodule.am
|
||||
include gdimagefilter/Makemodule.am
|
||||
include gdimageflip/Makemodule.am
|
||||
include gdimageellipse/Makemodule.am
|
||||
include gdimagegrayscale/Makemodule.am
|
||||
include gdimageline/Makemodule.am
|
||||
include gdimagenegate/Makemodule.am
|
||||
|
1
tests/gdimageellipse/.gitignore
vendored
Normal file
1
tests/gdimageellipse/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/bug00169
|
7
tests/gdimageellipse/CMakeLists.txt
Normal file
7
tests/gdimageellipse/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
IF(PNG_FOUND)
|
||||
LIST(APPEND TESTS_FILES
|
||||
bug00169
|
||||
)
|
||||
ENDIF(PNG_FOUND)
|
||||
|
||||
ADD_GD_TESTS()
|
8
tests/gdimageellipse/Makemodule.am
Normal file
8
tests/gdimageellipse/Makemodule.am
Normal file
@ -0,0 +1,8 @@
|
||||
if HAVE_LIBPNG
|
||||
libgd_test_programs += \
|
||||
gdimageellipse/bug00169
|
||||
endif
|
||||
|
||||
EXTRA_DIST += \
|
||||
gdimageellipse/CMakeLists.txt \
|
||||
gdimageellipse/bug00169_exp.png
|
22
tests/gdimageellipse/bug00169.c
Normal file
22
tests/gdimageellipse/bug00169.c
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* add test case for gdImageEllipse
|
||||
*/
|
||||
|
||||
#include "gd.h"
|
||||
#include "gdtest.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
gdImagePtr im;
|
||||
int white = 0;
|
||||
|
||||
im = gdImageCreateTrueColor(2200, 2200);
|
||||
white = gdImageColorAllocate(im, 255, 255, 255);
|
||||
|
||||
gdImageEllipse(im, 1100, 1100, 2200, 2200, white);
|
||||
gdAssertImageEqualsToFile("gdimageellipse/bug00169_exp.png", im);
|
||||
|
||||
gdImageDestroy(im);
|
||||
|
||||
return gdNumFailures();
|
||||
}
|
BIN
tests/gdimageellipse/bug00169_exp.png
Normal file
BIN
tests/gdimageellipse/bug00169_exp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
1
tests/gdimagefilledellipse/.gitignore
vendored
1
tests/gdimagefilledellipse/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
/bug00010
|
||||
/bug00169
|
||||
/bug00191
|
||||
/github_bug_00238
|
||||
|
@ -1,6 +1,7 @@
|
||||
IF(PNG_FOUND)
|
||||
LIST(APPEND TESTS_FILES
|
||||
bug00010
|
||||
bug00169
|
||||
bug00191
|
||||
github_bug_00238
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
if HAVE_LIBPNG
|
||||
libgd_test_programs += \
|
||||
gdimagefilledellipse/bug00010 \
|
||||
gdimagefilledellipse/bug00169 \
|
||||
gdimagefilledellipse/bug00191 \
|
||||
gdimagefilledellipse/github_bug_00238
|
||||
endif
|
||||
@ -8,5 +9,6 @@ endif
|
||||
EXTRA_DIST += \
|
||||
gdimagefilledellipse/CMakeLists.txt \
|
||||
gdimagefilledellipse/bug00010_exp.png \
|
||||
gdimagefilledellipse/bug00169_exp.png \
|
||||
gdimagefilledellipse/bug00191.png \
|
||||
gdimagefilledellipse/github_bug_00238_exp.png
|
||||
|
22
tests/gdimagefilledellipse/bug00169.c
Normal file
22
tests/gdimagefilledellipse/bug00169.c
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* add test case for gdImageFilledEllipse
|
||||
*/
|
||||
|
||||
#include "gd.h"
|
||||
#include "gdtest.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
gdImagePtr im;
|
||||
int white = 0;
|
||||
|
||||
im = gdImageCreateTrueColor(2200, 2200);
|
||||
white = gdImageColorAllocate(im, 255, 255, 255);
|
||||
|
||||
gdImageFilledEllipse(im, 1100, 1100, 2200, 2200, white);
|
||||
gdAssertImageEqualsToFile("gdimagefilledellipse/bug00169_exp.png", im);
|
||||
|
||||
gdImageDestroy(im);
|
||||
|
||||
return gdNumFailures();
|
||||
}
|
BIN
tests/gdimagefilledellipse/bug00169_exp.png
Normal file
BIN
tests/gdimagefilledellipse/bug00169_exp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
Loading…
x
Reference in New Issue
Block a user