mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
094decc3c0
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.
22 lines
517 B
PHP
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)
|