[cairo] [bug] painting surface on surface with device offset set results in incomplete paint

Radek Doulík rodo at novell.com
Mon Jun 13 01:52:14 PDT 2005


Hi Owen,

thanks for your reply.

On Fri, 2005-06-10 at 16:58 -0400, Owen Taylor wrote:
> On Fri, 2005-06-10 at 13:32 -0700, Radek Doulík wrote:
> > Hi all,
> > 
> > I am painting a surface which I use as a back buffer on another surface
> > (xlib surface created on X window). The window surface has the device
> > offset set to nonzero values. When I paint my back buffer surface to it,
> > it is not painted completely. Looks like a bug to me. I tried to debug
> > the problem, but got lost pretty soon.
> > 
> > Any idea what might be wrong?
> > 
> > I modified the canvas-demo.c from canvas-demo/X11/ as a simple example
> > of the problem. I am using the CVS/HEAD of cairo.
> 
> The program draws exactly what I'd expect.
> 
> You create the back buffer at 300x300 and set a device offset of 50, 50.
> You then draw a rectangle on the back buffer at 0, 0 of size 300, 300.
> So, we effectively draw a square on it at 50, 50 of size 250, 250. (the
> rest is off the surface)

What I expect is that setting device offset means shifting the whole
surface to the offset. If it works as you describe, than it just sets
transition of surface coordinates by the offset, but position and size
of the surface in device coordinates is not changed.

> Then we draw the back buffer onto the front buffer at 0, 0.
> 
> So, as expected, the final result of the drawing on the back buffer
> is a 250,250 rectangle at 50,50 on the front buffer.
> 
> I'm not sure what exactly you were expecting ... to double
> buffer a portion x,y,width,height of a drawable, you'd generally
> use a device offset of the -x,-y and then paint the back buffer onto
> the front buffer at coordinates x, y. 

Yes, I need to back buffer a rectangle x,y,width,height on X window
where x > 0 || y > 0. Using device offset -x, -y and painting on x, y
doesn't work for me.

What works for me is to make the window surface be 0,0,width+x,height+y,
set device offset of window surface to x,y and paint at 0,0. What I am
now worried about is if it doesn't use more resources that way and if
device offset is indeed designed to work that way. I didn't find
anything about set device offset function in cairo documentation :(

Cheers
Radek





More information about the cairo mailing list