[cairo] copying region of a large surface to a smaller surface

Peter Groves pdgroves at gmail.com
Tue Oct 19 10:49:06 PDT 2010

> I wanted to do something similar and was confused. Seems that your
> idea with negative coordinates is correct, I found this with google:
> http://lists.freedesktop.org/archives/cairo/2007-June/010876.html
> http://lists.freedesktop.org/archives/cairo/2007-June/010877.html

Thanks for the pointer, those earlier emails gave me some confidence
that it's legitimate to use the negative coordinates approach. I've
implemented it and it's working. It's a little sluggish but it's hard
to isolate the performance of this copy operation in my program, so
I'm go to stick with this implementation for now. My concern is that it
might actually be trying to copy the whole larger surface with each
repaint and discards those out-of-bounds pixels when it discovers
there's no destination surface there. I'm hoping it's smart enough to
compute the bounding box of the larger surface that will actually be
copied and only processes those pixels. 

More information about the cairo mailing list