[cairo] win32 surfaces, font rendering, and clip caching
Vladimir Vukicevic
vladimirv at gmail.com
Wed Jan 18 10:07:16 PST 2006
There's an interesting problem with the win32 font implementation on
win32 surfaces. cairo_win32_scaled_font_select_font suggests wrapping
it with SaveDC() and RestoreDC(), which save and restore the
underlying win32 graphics state (that's also used by the surface).
However, if cairo_show_glyphs() is called in between those two (e.g.
SaveDC, cairo_win32_scaled_font_select_font, Uniscript ScriptPlace
mumble, cairo_show_glyphs, cairo_win32_scaled_font_finish, RestoreDC)
and it happens to set the clip on the surface because it's out of
date, that win32 clip is then blown away by RestoreDC with no
knowledge to cairo. Bad missing rendering bits happen afterwards.
I'm not sure if it's possible to pull out show_glyphs() outside of the
select_font/finish path, but this can be a problem any time native
drawing calls are mixed with cairo. However, a simple fix is to have
cairo_surface_mark_dirty be defined to always force the clip to be
updated on the surface the next time cairo drawing is done. That way
this can be useful for all surfaces that have an underlying ability to
save/restore graphics state when mixed cairo and non-cairo drawing
occurs. A patch to do this is attached.
- Vlad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-surface-clip-dirty.patch
Type: application/octet-stream
Size: 2605 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060118/c7cce9b5/cairo-surface-clip-dirty.obj
More information about the cairo
mailing list