[cairo] Problem drawing pixbuf

Tobias Hoffmann lcairo-list at thax.hardliners.org
Fri Oct 15 09:53:17 PDT 2010


Krzysztof Kosiński wrote:
> W dniu 13 października 2010 02:42 użytkownik Tobias Hoffmann
> <lcairo-list at thax.hardliners.org> napisał:
>   
>> Both ways (i.e. in expose and direct redrawing) happen in my application,
>> both lead to the same result. (IIRC I've tried direct drawing w/ and w/o
>> double buffering.)
>>     
> I'm taking wild guesses, but maybe using a clipping region would help
> to get rid of the black borders?
>   
I've tried adding a clipping region, but essentially I had to clip away 
a full 1px border around the image to get rid of any artifacts (while 
completely losing this image information), so this didn't seem right to me.
> Additionally, where are you getting your Cairo context from? This
> might be important. In particular, you can't store and reuse contexts
> created during the expose event.
>   
I've uploaded some example code to http://thax.hardliners.org/test/  
(test.cpp, uses tst1.png).
Also try resizing the window. 'r' redraws without double buffering, 'q' 
quits the application.

Some further experiments revealed, that the problem is not specific to 
Gdk::pixbuf, but is reproducible when I use a 
Cairo::ImageSurface::create_from_png() to draw FROM.

But it does not happen when I draw TO a Cairo::ImageSurface, which is 
probably the explanation for the push_group() / pop_group_to_surface() 
"workaround".

When I use Cairo::Surface::create(..some xlib surface...,CONTENT_COLOR) 
to create another XLIB surface and draw to it, the black border is back 
again, e.g. observable with write_to_png(). But using 
CONTENT_COLOR_ALPHA instead yields correct results.

BTW, I'm using a recent nouveau X driver. And I haven't seen any 
problems yet with the X-backend on OS X (but with a probably more recent 
cairo version).

Regards,
  Tobias


More information about the cairo mailing list