[Webkit-unassigned] [Bug 75792] Correct the bounding rect estimations for stroking text in canvas
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Feb 16 02:52:42 PST 2012
https://bugs.webkit.org/show_bug.cgi?id=75792
--- Comment #9 from Huang Dongsung <luxtella at company100.net> 2012-02-16 02:52:42 PST ---
(From update of attachment 127154)
View in context: https://bugs.webkit.org/attachment.cgi?id=127154&action=review
>> LayoutTests/fast/canvas/script-tests/canvas-strokePath-cap-join.js:2
>> +
>
> Looks like this test could use layoutTestController.dumpAsText(), see: http://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree
canvas-strokePath-cap-join.html has <script src="../js/resources/js-test-pre.js"></script>
And then js-test-pre.js has layoutTestController.dumpAsText(self.enablePixelTesting);
I used canvas-strokePath-shadow.html as template for this layout test.
>> Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:2163
>> + // Fast approximation of the stroke's bounding rect.
>
> I noticed this comment was just copied over from above. Is it still true? How much faster is it than strokeBoundingRect?
Yes, it is true.
I think more than 10 times faster than skia and qt implementation.
Skia draws it and measure it.
Qt creates stroke path and call Path::boundingRect().
>> Source/WebCore/html/canvas/CanvasRenderingContext2D.h:310
>> + void inflateStrokeRect(FloatRect&) const;
>
> Should this functionality live here? It doesn't sound all that specific to canvas to me if it's just estimating the bounding rect of a section of stroked text. Don't we have some set of "text metrics" functions elsewhere?
I thought it is better to make Path::fastStrokeBoundingRect() similar to Path::fastBoundingRect().
However, Path does not know thickness, join, and cap, and strangely GraphicsContext knows those.
On the other hands, inflateStrokeRect(FloatRect&) needs to know CanvasRenderingContext2d::state.
It is why I put inflateStrokeRect(FloatRect&) as member method.
--
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