[Cairo] Semantics of cairo_copy changed in 0.1.7

James Henstridge james at daa.com.au
Tue Sep 30 19:44:36 PDT 2003


On 1/10/2003 10:21 AM, Keith Packard wrote:

>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);
>
>The old copy function wouldn't permit this usage as it wouldn't permit the 
>second cairo_copy.
>
With the old cairo_copy, couldn't you restate the above as this?
    cairo_t *temp = cairo_copy(cs);
    <muck with temp state>
    cairo_destroy(temp);

I thought that was the point of the old API.  What does the new copy 
operation give you that the old one didn't?  The only difference seems 
to be which cairo_t you are mucking around with.

James.

-- 
Email: james at daa.com.au
WWW:   http://www.daa.com.au/~james/







More information about the cairo mailing list