[cairo] [patch] cairo font performance improvements
graydon hoare
graydon at redhat.com
Fri Sep 17 15:40:42 PDT 2004
hi,
the following patch has 3 themes:
1. a small error detection patch to the xlib backend, harmless.
2. an extension of the glyph cache to hold glyph extents, and a
modification of all the required paths to make this work.
3. a new flag in the gstate to indicate that a font has been
deeply copied, and a modification of gstate functions such
that most only twiddle the refcount on the previous state's
font (copy-on-write fonts, essentially)
these improve text performance significantly (though not as much as
the render/glyphset changes I'm starting on now). I'd like to check
them in. any comments or suggestions?
-graydon
2004-09-17 Graydon Hoare <graydon at redhat.com>
* src/cairoint.h (text_extents): Add surface parameter.
(glyph_extents): Likewise.
(text_path): Likewise.
(create_glyph): Add optional return_extents parameter.
(cairo_glyph_surface_t): Add extents field to cache entry.
(cairo_gstate_t): Add font_copied flag.
* src/cairo_font.c (_cairo_font_text_extents): Add surface parameter.
(_cairo_font_glyph_extents): Likewise.
(_cairo_font_text_path): Likewise.
(_cairo_glyph_surface_init): Pass extents pointer to backend.
(_cairo_font_lookup_glyph): Accept extents pointer, fill in when
present, optimize lookup comparison slightly.
* src/cairo_ft_font.c (_utf8_to_glyphs): Add surface parameter,
lookup extents from cache.
(_cairo_ft_font_glyph_extents): Likewise.
(_cairo_ft_font_text_extents): Add surface parameter, pass through.
(_cairo_ft_font_glyph_bbox): Pass extra NULL to _cairo_font_lookup_glyph.
(_cairo_ft_font_text_bbox): Add surface parameter, pass through.
(_cairo_ft_font_show_glyphs): Pass extra NULL to _cairo_font_lookup_glyph.
(_cairo_ft_font_show_text): Pass surface to _utf8_to_glyphs.
(_cairo_ft_font_text_path): Add surface parameter, pass through.
(_cairo_ft_font_create_glyph): Add return_extents parameter, fill in.
* src/cairo_gstate.c (static_default_font): New static.
(_cairo_gstate_init): Create static, initialize new fonts to shallow copy.
(_cairo_gstate_init_copy): Make shallow copies initially.
(_ensure_font_copied): New function.
(_cairo_gstate_select_font): Set font_copied flag.
(_cairo_gstate_scale_font): Call _ensure_font_copied.
(_cairo_gstate_transform_font): Likewise.
(_cairo_gstate_select_font): Set font_copied flag.
(_cairo_gstate_text_extents): Pass in current surface.
(_cairo_gstate_glyph_extents): Likewise.
(_cairo_gstate_text_path): Likewise.
* cairo_xlib_surface.c (_cairo_xlib_surface_set_clip_region): Detect errors.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-font-optimizations.patch
Type: text/x-patch
Size: 18848 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040917/d0c61bee/cairo-font-optimizations.bin
More information about the cairo
mailing list