[cairo] Does cairo use backend-specific support for groups?

Nikita Zlobin nick87720z at gmail.com
Thu Mar 10 03:48:58 UTC 2022


В Wed, 9 Mar 2022 16:37:40 +0100
Uli Schlachter <psychon at znc.in> пишет:

> Hi,
> 
> Am 08.03.22 um 22:23 schrieb Nikita Zlobin:
> [...]
> > Q: Do cairo groups use backend-specific type of surface, such as
> > xpixmap with X11 as main backend?
> 
> Yes. A group basically uses cairo_surface_create_similar() and then
> temporarily redirects drawing to that surface (until the
> corresponding pop).
> 

Thanks. It's still too obscure, what exactly happens under the hood.
Documentation says nothing, besides that similar (not image) even uses
same backend unless that's impossible. Pop to source operation assumes,
that surface should be possible to be source. I tried to use xpixmap
surface as source against x11 window surface, but got only black fill.

> > For now I'm not finally sure if manual xrender'ing two pixmaps is
> > better than using cairo groups, I only know - it's certainly better
> > than using image surfaces as source.
> 
> Well, if you use an image surface as a source, that image surface has
> to be uploaded to the X11 server. This likely involves several copies
> if the image is not allocated with shared memory. If your image is
> large, it might be beneficial to at least use
> cairo_surface_create_similar_image() to get a shared-memory-backed
> image.

Good to know as well :)
No note about shared mem in doc - this similarity is somewhat vague
thing.

> 
> Cheers,
> Uli



More information about the cairo mailing list