summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2007-08-26 20:33:22 +0000
committerPierre Joye <pajoye@php.net>2007-08-26 20:33:22 +0000
commit268386674a54b7f46e88e97c161907299a116b7c (patch)
tree810152ca5c035457d9e0e544d7f94f5bea0afda3
parent7453fe94f73cb09c03bb75c53a2fda725486d3c9 (diff)
downloadphp-git-268386674a54b7f46e88e97c161907299a116b7c.tar.gz
- gd #106, imagerectangle draws 1x1 rectangles as 1x3 rectangles
-rw-r--r--ext/gd/libgd/gd.c5
-rw-r--r--ext/gd/tests/libgd00106.phpt22
2 files changed, 27 insertions, 0 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index 168c08bb2a..0a26b89370 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -2120,6 +2120,11 @@ void gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color)
int half1 = 1;
int t;
+ if (x1 == x2 && y1 == y2 && thick == 1) {
+ gdImageSetPixel(im, x1, y1, color);
+ return;
+ }
+
if (y2 < y1) {
t=y1;
y1 = y2;
diff --git a/ext/gd/tests/libgd00106.phpt b/ext/gd/tests/libgd00106.phpt
new file mode 100644
index 0000000000..65e4692ea3
--- /dev/null
+++ b/ext/gd/tests/libgd00106.phpt
@@ -0,0 +1,22 @@
+--TEST--
+libgd #106 (imagerectangle 1x1 draws 1x3)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(10,10);
+imagerectangle($im, 1,1, 1,1, 0xFFFFFF);
+$c1 = imagecolorat($im, 1,1);
+$c2 = imagecolorat($im, 1,2);
+$c3 = imagecolorat($im, 2,1);
+$c4 = imagecolorat($im, 2,2);
+if ($c1 == 0xFFFFFF && $c2 == 0 && $c3 == 0 && $c4 == 0) {
+ echo "Ok";
+} else {
+ echo "failed";
+}
+?>
+--EXPECT--
+Ok