Bug #53154 [Csd]: Zero-height rectangle has whiskers
| From: | cmb@php.net | Date: | Sun, 12 Jul 2015 23:53:11 +0000 |
| Subject: | Bug #53154 [Csd]: Zero-height rectangle has whiskers | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-194366@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53154&edit=1
ID: 53154
Updated by: cmb@php.net
Reported by: lbayuk at users dot sourceforge dot net
Summary: Zero-height rectangle has whiskers
Status: Closed
Type: Bug
Package: GD related
Operating System: *
PHP Version: 5.6.10
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thanks for the verification, lbayuk. :)
Previous Comments:
------------------------------------------------------------------------
[2015-07-12 23:51:37] cmb@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=php-src.git;a=commit;h=094decc3c0b62a72bacebaf85c6269049bf12885
Log: Fix #53154: Zero-height rectangle has whiskers
------------------------------------------------------------------------
[2015-06-29 20:15:03] lbayuk at users dot sourceforge dot net
I rebuilt the PHP GD extension with your patch, for PHP-5.6.10. I can confirm it fixed the bug and I
saw no regressions.
------------------------------------------------------------------------
[2015-06-29 11:35:44] cmb@php.net
No need to apologize. IMHO it is fine to remind that a bug is
still there in recent versions after nearly 5 years.
Anyhow, thanks for your analysis; the behavior to draw the corner
pixels only once makes sense, and should be kept. In the same
manner, there probably should be separate cases for rectangles
with zero widht or height (drawing a single line in this case
would be sufficient), as done in the "zero-rectangle" patch.
------------------------------------------------------------------------
[2015-06-29 11:34:56] cmb@php.net
The following patch has been added/updated:
Patch Name: zero-rectangle
Revision: 1435577696
URL: https://bugs.php.net/patch-display.php?bug=53154&patch=zero-rectangle&revision=1435577696
------------------------------------------------------------------------
[2015-06-28 22:28:23] lbayuk at users dot sourceforge dot net
(Sorry for the 'still there' comment... I needed to change my email on the report, and it
doesn't seem to work unless a new comment is added. (Should I open a bug report on the bug
system?))
By "two assignments", do you mean y1v=y1h+1 and y2v=y2h-1 ? Or in the libgd code in your
second link, the in-line equivalents in the 3rd and 4th calls to gdImageLine() ?
These seem to be there to prevent the corner pixels from being drawn twice. That is, the vertical
line segments that make up the rectangle are 2 pixels shorter than the sides of the rectangle. When
the rectangle height is > 0 this prevents the corner pixels from being drawn twice, once as part
of the horizontal segments and once as part of the vertical segments.
But in the edge case of rectangle height = 0, this code causes the "whiskers" on the left
and right ends.
Why would you want to prevent the corner pixels from being drawn twice? The only reason I can think
of where it matters is when alpha blending is on (as it is by default with truecolor images). In
this case, drawing over the same pixel with the same color more than once will darken it each time.
This will be true when the color is partially transparent (alpha > 0).
The effect is subtle, but can be seen with a screen magnifier.
That's my guess, anyway.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53154
--
Edit this bug report at https://bugs.php.net/bug.php?id=53154&edit=1