summaryrefslogtreecommitdiff
path: root/tests/gdimageline/gdimageline_bug5.c
blob: 44adc8eaf8606798815abbb863406badbf7b745d (plain)
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
48
49
50
51
52
53
54
#include <stdio.h>
#include "gd.h"
#include "gdtest.h"

int main() {
	/* Declare the image */
	gdImagePtr im, ref;

	/* Declare output files */
	/* FILE *pngout; */
	int black, white;

	im = gdImageCreateTrueColor(63318, 771);

	/* Allocate the color white (red, green and blue all maximum). */
	white = gdImageColorAllocate(im, 255, 255, 255);
	/* Allocate the color white (red, green and blue all maximum). */
	black = gdImageColorAllocate(im, 0, 0, 0);

	/* white background */
	gdImageFill(im, 1, 1, white);

    /* Make a reference copy. */
    ref = gdImageClone(im);

	gdImageSetAntiAliased(im, black);

	/* This line used to fail. */
	gdImageLine(im, 28562, 631, 34266, 750, gdAntiAliased);

    gdTestAssert(gdMaxPixelDiff(im, ref) > 0);

#if 0
    {
        FILE *pngout;

        /* Open a file for writing. "wb" means "write binary",
         * important under MSDOS, harmless under Unix. */
        pngout = fopen("test.png", "wb");

        /* Output the image to the disk file in PNG format. */
        gdImagePng(im, pngout);

        /* Close the files. */
        fclose(pngout);
    }
#endif

	/* Destroy the image in memory. */
	gdImageDestroy(im);
    gdImageDestroy(ref);

    return gdNumFailures();
}