File: php_bug_64641.c

package info (click to toggle)
libgd2 2.3.3-13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,396 kB
  • sloc: ansic: 49,708; sh: 5,660; javascript: 1,859; cpp: 1,308; makefile: 345; perl: 197; tcl: 45
file content (47 lines) | stat: -rw-r--r-- 966 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
	Test drawing of 1-dimensional filled polygons

	We're drawing a vertical and a horizontal 1-dimensional filled polygon,
	which is supposed to result in a vertical and a horizontal line.

	See also <https://bugs.php.net/64641>.
*/

#include "gd.h"
#include "gdtest.h"

int main()
{
	gdImagePtr im;
	gdPointPtr points;

	im = gdImageCreateTrueColor(640, 480);

	points = (gdPointPtr)calloc(3, sizeof(gdPoint));
	gdTestAssert(points != NULL);

	/* vertical line */
	points[0].x = 100;
	points[0].y = 100;
	points[1].x = 100;
	points[1].y = 200;
	points[2].x = 100;
	points[2].y = 300;
	gdImageFilledPolygon(im, points, 3, 0xFFFF00);

	/* horizontal line */
	points[0].x = 300;
	points[0].y = 200;
	points[1].x = 400;
	points[1].y = 200;
	points[2].x = 500;
	points[2].y = 200;
	gdImageFilledPolygon(im, points, 3, 0xFFFF00);

	gdAssertImageEqualsToFile("gdimagefilledpolygon/php_bug_64641.png", im);

	free(points);
	gdImageDestroy(im);

	return gdNumFailures();
}