Commits

Anonymous committed 0a6f095

- port another test for gdImageFill

Comments (0)

Files changed (2)

 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 #1, Initialize values this also provides a 5x speedup in the imagefttext.phpt 
     test, because without this patch it never got cache hits (Nuno Lopes)
-#2, gdImageFill, multiple segfaults with complex patterns, transparent colors
-  or invalid color index
+#2, #8, gdImageFill, multiple segfaults with complex patterns, transparent 
+    colors or invalid color index
 #3, gdImageRectangle draws corners twice (affects rectangles with alpha 
     channel)
 #4, TrueColor transparent color not used  with GIF output (palette)

src/tests/bug00008.c

+#include "gd.h"
+
+int main()
+{
+ 	gdImagePtr im;
+	FILE *fp;
+	int c0,c1,c3;
+	int red, blue, white, black;
+
+	im = gdImageCreate(50,100);
+	red = gdImageColorAllocate(im, 255, 0, 0);
+	blue = gdImageColorAllocate(im, 0,0,255);
+	white  = gdImageColorAllocate(im, 255,255,255);
+	black = gdImageColorAllocate(im, 0,0,0);
+	gdImageFill(im, 0,0, black);
+
+	gdImageLine(im, 20,20,180,20, white);
+	gdImageLine(im, 20,20,20,70, blue);
+	gdImageLine(im, 20,70,180,70, red);
+	gdImageLine(im, 180,20,180,45, white);
+	gdImageLine(im, 180,70,180,45, red);
+	gdImageLine(im, 20,20,100,45, blue);
+	gdImageLine(im, 20,70,100,45, blue);
+	gdImageLine(im, 100,45,180,45, red);
+
+	gdImageFill(im, 21,45, blue);
+	gdImageFill(im, 100,69, red);
+	gdImageFill(im, 100,21, white);
+
+	fp = fopen("a.png", "wb");
+ 	gdImagePng(im, fp);
+	fclose(fp);
+
+ 	/* Destroy it */
+ 	gdImageDestroy(im);
+
+ 	return 0;
+}