[Webkit-unassigned] [Bug 54491] [cairo][canvas] Drawing from/into float rectangles with width or height in range 0 to 1 fails
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Feb 18 11:24:20 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=54491
--- Comment #9 from Zan Dobersek <zandobersek at gmail.com> 2011-02-18 11:24:20 PST ---
(From update of attachment 82972)
View in context: https://bugs.webkit.org/attachment.cgi?id=82972&action=review
>> Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp:771
>> + height = !rheight ? (!height ? 0 : (height > 0 ? 1 : -1)) : rheight;
>
> Is it okay to simply write this as:
> if (width < 0 && width > -1)
> width = -1;
> if (width > 0 && width < 1)
> width = 1;
> if (height < 0 && height > -1)
> height = -1;
> if (height > 0 && height < 1)
> height = 1;
>
> ?
A shorter hack that should work goes like this, only shown on width:
width = frect.width();
...
rwidth = round(frect.width());
if (!rwidth && width) // width rounds to zero, but is not zero itself
rwidth = width/fabs(width) // This returns either -1 or 1, depends on the sign of the number value
...
result.setWidth(narrowPrecisionToFloat(rwidth));
It's shorter, and it works also.
So, there are a few options, what to go with?
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list