[cairo] Proposal: cairo_save_state/cairo_restore_state

Behdad Esfahbod behdad at cs.toronto.edu
Tue Jan 24 18:08:39 PST 2006


On Tue, 24 Jan 2006, Owen Taylor wrote:

> On Tue, 2006-01-24 at 20:58 -0500, Behdad Esfahbod wrote:
> > On Tue, 24 Jan 2006, Owen Taylor wrote:
> >
> > > Maybe it would make sense to come up with a slightly-non-trivial
> > > example of where this is useful? I'm not sure I see it yet.
> >
> > In the expose handlers I guess.  You can have a few states set
> > up, just restore it and draw, then the next one.  That's still
> > trivial, I confess...
>
> But is it better than just setting up the graphics parameters
> you want when you want to use them?
>
> Using save points probably gives a misplaced illusion that
> something efficient is going on behind the scenes, when it's
> really just notational convenience for saving each parameter
> individually.

That's why I suggested that they should be made copy-on-write.
Otherwise, yes, they will be suger.

> Plus, you really want to inherit clip from the caller of
> your expose handler, and I would have guess that save-points
> save the clip.

Good point.  I've not seen any expose handler in cairo-demo to do
that.  That's something to document somewhere...

> 					Owen

--behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
	-- Dan Bern, "New American Language"


More information about the cairo mailing list