[cairo] cairo_gl_surface_swapbuffers()

Simon Elliott simon at ctsn.co.uk
Wed Jun 3 20:02:10 UTC 2020

Hi all

We're developing an embedded system which shows graphics using cairo, 
opengles and wayland.

Basically we have some vector graphics we've drawn into several surfaces 
that we blit onto a device surface and then display the device surface 
with cairo_gl_surface_swapbuffers().

We've run into a problem under certain circumstances.

Our blit code for copying the drawn surfaces to the device surface looks 
like this:
cairo_t* cr = cairo_create(surface_);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_surface(cr, source_surface_, x, y);
cairo_rectangle(cr, x,y, w, h);

The device surface is created like this
cairo_surface_t* surface = cairo_gl_surface_create_for_egl(cairo_device, 
egl_surface, width, height);

We display the device surface like this:

This all works flawlessly if at least one of the surfaces we've blitted 
onto the device surface is the same size as the device surface.

If we just blit a single surface that's smaller than the device surface, 
then call cairo_gl_surface_swapbuffers(), we see an older image on the 
screen with the smaller surface on top of it. The older image is the 
surface that was shown via cairo_gl_surface_swapbuffers() two iterations 

We've checked with cairo_surface_status() and there are no errors on any 
of the surfaces at any time.

Does anyone have any suggestions for resolving this?

I can't find any documentation for cairo_gl_surface_swapbuffers(). Can 
anyone point me at this?

I'd like to look at the contents of the surfaces, but e.g. 
cairo-image-surface-get-width() returns zero. How can I show the width 
and height of the surfaces?

Thanks in advance for any suggestions!

More information about the cairo mailing list