[webkit-dev] Changes to GraphicsContext
morganl.webkit at yahoo.com
Tue Jan 2 10:04:44 PST 2007
Thanks for the info! Perhaps some of this should be added as comments to GraphicsContext.h?
David Hyatt <hyatt at apple.com> wrote: I changed how the graphics context works today to avoid updating
CoreGraphics's fill and stroke colors in every drawGlyphs call.
Basically I changed GraphicsContextCG to be more like
GraphicsContextQt, which was already behaving the way I wanted CG to
behave. Now when you set a fill or stroke color on a
GraphicsContext, it is updated immediately in the underlying native
context (in both CG and Qt).
What was formerly known as the Pen has now been broken down into
stroke style, color and thickness. Thickness was changed to a float
so that arc drawing could take a float-based thickness when
stroking. drawArc was reworked and renamed to strokeArc and its
false concept of filling was removed (it was not really using filling).
Text in HTML is now being drawn using the fill color and not the pen
(stroke) color. This allows for SVG to fill and stroke separately
and for text drawing to do either.
A new textDrawingMode API has been added to reflect filling, stroking
and clipping of text. The API allows for bits and lets you set any
combination of those three bits. SVG is now using this API to
distinguish between filling and stroking of text.
For those of you working with native CG and Qt code directly (as is
sometimes the case in RenderTheme*** classes), you will need to be
especially careful now. Fill and stroke colors (for speed) are held
as Colors in GraphicsContext's cross-platform state, and so if you
set the CG fill color directly (and don't go through the cross-
platform API), you will now be out of sync. To avoid any issues you
should either use the cross-platform API everywhere you can, or
simply bracket your uses of native CG code with save and restore calls.
Anyone working on ports other than CG and Qt (I patched those two)
will need to replace your uses of Pen with the new stroke APIs. In
addition you will need to make sure your font rendering code uses the
fill color now and not the pen (stroke) color. If you plan on
supporting SVG, you will also need to support stroking of text using
the stroke color.
(hyatt at apple.com)
webkit-dev mailing list
webkit-dev at lists.webkit.org
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev