[cairo] new pattern interface bug

David Reveman c99drn at cs.umu.se
Tue Apr 6 03:33:23 PDT 2004


On Mon, 2004-04-05 at 23:16 -0700, Vladimir Vukicevic wrote:

> Howdy,
> 
> I have some code that creates a surface from data (image data), and then 
> renders the image like so:
> 
> 	cairo_t *ct = ...;
> 	cairo_set_pattern (ct, image_surface);
> 	cairo_move_to (ct, x, y);
> 	cairo_rectangle (ct, x, y, width, height);
> 	cairo_fill (ct);
> 
> With the pattern patch, I changed this to:
> 
> 	cairo_pattern_t *image_pattern = cairo_pattern_create_for_surface 
> (image_surface);
> 	cairo_set_pattern (ct, image_pattern);
> 	... /* as above */
> 	cairo_pattern_destroy (image_pattern);
> 
> However, in the second case, the surface is always rendered at 0,0; or 
> rather, it tries to be rendered there, but is clipped to the rect. 
> (Note: I just noticed that the move_to is redundant, but I can't easily 
> re-test this without the move_to atm :)  So, if the image is 100 pixels 
> wide, and I render at x = 50, in the first case, the image is rendered 
> from 50 to 150; in the second case, I only see the second "half" of the 
> image, at x=50 to 100.
> 
> Am I doing something wrong with the (propsed) pattern interface?

No, this is a bug, but I've now fixed it and the latest patches (dated:
040406) should work fine.

Thanks Val!

- David

-- 
David Reveman <c99drn at cs.umu.se>





More information about the cairo mailing list