[cairo] Cairo/PNG shaked up.

Owen Taylor otaylor at redhat.com
Sun Apr 17 12:50:15 PDT 2005


On Sun, 2005-04-17 at 21:09 +0200, Hans Breuer wrote:

> Looking to make it even smaller I tried a little change. If in the  
> initilaization
> sequence
> 
>    renderer->cr = cairo_create ();
>    cairo_scale (renderer->cr, renderer->scale, renderer->scale);
>    cairo_translate (renderer->cr, -renderer->dia->extents.left,  
> -renderer->dia->extents.top);
> 
>    cairo_set_target_surface (renderer->cr, renderer->surface);
> 
>     /* clear background */
> 
> the set_target_surface() call is moved before the scale() call the  
> scaling
> is right again - for the PNG export case. I haven't tested with the  
> other
> backends, but think the order of calls should not be decisive here.
> 
> Bug or feature?

Really neither. We really never nailed down whether set_target_surface()
resets the transform or not, and I think the code is somewhat 
inconsistent now, but the plan going forward is to make cairo_create()
take a cairo_surface_t as a parameter and to remove 
set_target_surface() making the question moot.

So, for now, you should always set the target surface immediately
after creating the cairo_t.

Regards,
						Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050417/e16d5eb2/attachment.pgp


More information about the cairo mailing list