php-src/ext/gd/tests/bug53154.phpt
Christoph M. Becker 094decc3c0 Fix #53154: Zero-height rectangle has whiskers
To avoid drawing the corner pixels twice, gdImageRectangle() draws the vertical
lines 2 points shorter than the actual side of the rectangle. However, this
causes "whiskers" for rectangles with height 0. This patch fixes this issue and
at the same time optimizes the algorithm by drawing only a single line for zero
height and zero width rectangles.
2015-07-13 01:33:00 +02:00

22 lines
517 B
PHP

--TEST--
Bug #53154 (Zero-height rectangle has whiskers)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
?>
--FILE--
<?php
$im = imagecreatetruecolor(100, 10);
$red = imagecolorallocate($im, 255, 0, 0);
imagerectangle($im, 5, 5, 95, 5, $red);
var_dump(imagecolorat($im, 5, 4) !== $red);
var_dump(imagecolorat($im, 5, 6) !== $red);
var_dump(imagecolorat($im, 95, 4) !== $red);
var_dump(imagecolorat($im, 95, 6) !== $red);
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)