cworth at cworth.org
Fri Sep 11 09:43:33 PDT 2009
Excerpts from ecir hana's message of Fri Sep 11 09:29:05 -0700 2009:
> 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?
Cairo tries to discard out-of-bounds things as early as it can to try
to avoid doing wasted computation. But it's definitely not as
aggresive as it could be in this regard, so you probably shouldn't
depend on that if you're drawing vast amounts of off-screen objects.
Or said another way, even if cairo did discard everything it could, it
would still require *some* time to look at the objects and determine
that they won't be visible.
So discarding things as high up in the stack as possible prevents
anything lower in the stack from wasting any time with things. That
is, if your application can easily determine that something won't be
visible, then just don't tell cairo to draw it.
> 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...?)
It definitely does make sense, and you can do all of this inside your
application by passing whatever data structures you would like to your
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20090911/f70f008f/attachment.pgp
More information about the cairo