[Cairo] Semantics of cairo_copy changed in 0.1.7

Gustavo J. A. M. Carneiro gjc at inescporto.pt
Wed Oct 1 03:21:13 PDT 2003


A Qua, 2003-10-01 às 03:21, Keith Packard escreveu:
> Around 21 o'clock on Sep 30, Owen Taylor wrote:
> 
> > But I'm really not sure how to interpret that. If you mass replace the
> > contents of a cairo_t how is that different from creating a new cairo_t?
> > malloc() / free() are not expensive, and I don't think it's worth giving
> > up API simplicity to save a few.
> 
> the new copy function replaces only the top of the destination gstate 
> stack, leaving underlying elements in place.  This allows you to save/
> restore the gstate with:
> 
> 	cairo_t	*temp = cairo_create ();
> 	cairo_copy (temp, cs);
> 	<muck with cs state>
> 	cairo_copy (cs, temp);
> 	cairo_destroy (temp);

  What's wrong with:

	cairo_save (cs);
	<muck with cs state>
	cairo_restore (cs);

  Or am I missing something that was already discussed?

-- 
Gustavo João Alves Marques Carneiro
<gjc at inescporto.pt> <gustavo at users.sourceforge.net>






More information about the cairo mailing list