[cairo] xtrace, part the second

Carl Worth cworth at cworth.org
Wed Dec 13 11:04:14 PST 2006

On Wed, 13 Dec 2006 11:31:21 +0200, "Xan Lopez" wrote:
> Assuming a) less X calls = good b) the way xft does things is just
> fine,

There's an implicit goal here of trying to get "new" GTK+ to be no
slower than "old" GTK+. So those assumptions seem quite valid for that

> just before the actual glyph rendering. So, again. What are we exactly
> doing? Can it be done the way Xft does it?

What's happening here is that given a source pattern, (the description
of the "color" for the text in this case), we're creating from that a
source surface, (a Render picture), to be used by the xlib backend.

So to eliminate that, what we would need is some caching of the
surfaces acquired from patterns. There are a lot of different
approaches that could be used here, with varying levels of difficulty
and benefits. Here are a couple of observations:

* Ideally we'd have a global pattern cache allowing its total size to
  be managed as a single value. (Note: We'd like to have the same
  thing for glyph caches, but currently we have separate per-font
  caches for glyphs. We knew this was not ideal, but we chose this
  approach for reasons of expedience. The same reasons might apply

* An easy thing to do is to simply stash any acquired surface in the
  pattern object itself. This will help for repeated use of the same
  pattern object, (for example, set_source_rgb then many show_glyph
  calls). The surface type here would end up being specific to the
  backend being used. It's probably correct to just have a single slot
  and let whichever backend gets there first to use it, (since it's
  much more likely that patterns will be reused with the same backend
  than across multiple backends). This is similar to the situation of
  the surface_private field in cairo_scaled_font_t for example.

* We could implement a small cache of pattern objects, (perhaps
  limited to solid colors), for use when cairo creates its own
  patterns, (inside things like set_source_rgb). This would allow for
  an operation like changing back and forth between two different
  source colors to benefit from a stashed surface inside the pattern
  objects, as described above.

I hope that's helpful,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20061213/8f1accdd/attachment.pgp

More information about the cairo mailing list