[cairo] Speed
Chris Wilson
chris at chris-wilson.co.uk
Fri Sep 11 09:50:50 PDT 2009
Excerpts from ecir hana's message of Fri Sep 11 17:29:05 +0100 2009:
> Hello,
> one thing I never understood is how does the drawing works while
> zoomed in. I mean, you have a window which redraws on some expose or
> paint event. In the callback you can get Cairo surface to draw to, you
> crop the surface to the dirty area and draw. Now I zoom-in so only a
> tiny portion of the whole window content is visible - does it mean
> Cairo has to check all the drawing operation in my callback only to
> see that it should draw only small subset of the operations? Wouldn't
> it make sense then to use some kind of partitioning data-structure
> which supplies the callback with operations for drawing just a portion
> of the screen? In other words, to manually track what's visible and
> what not so Cairo doesn't have to linearly check all the ops? I don't
> know, maybe this is very basic and usual optimization? Is this thing
> called "tiling"? Or, is it even worth it? (I guess yes, think about
> drawing detail of a page with lots of text...?)
Yes. The technique is usually called something like viewspace culling and
tends to operates on scenegraphs. This is handled by a higher level than
cairo, usually by a canvas, which leaves cairo to focus on being an
efficient immediate-mode renderer. Recent developments to cairo have been
to include a geometric clipper which reduces the volume of geometry it has
to tessellate, but as you point out, this should only be used as a matter
of last-result since the higher levels should be able to cull such
geometry much more cheaply. And we haven't even begun to discuss level of
detail! ;-)
-ickle
--
chris.wilson at intel.com
More information about the cairo
mailing list