[cairo] Best way to intermediate compositing, recording vs grouping
Nikita Zlobin
nick87720z at gmail.com
Fri Jul 30 17:25:44 UTC 2021
In Fri, 30 Jul 2021 16:55:52 +0200
Uli Schlachter <psychon at znc.in> wrote:
> Am 30.07.21 um 14:12 schrieb Nikita Zlobin:
> [...]
> > Even intentional "safeguard"
> > surface creation with immediate destruction (as well as
> > cairo_paint() with CLEAR operator... does rec surf ever interpret
> > this?).
>
> Well, you have a recording surface with CAIRO_CONTENT_COLOR_ALPHA.
> Clearing that makes it completely transparent. Drawing this to another
> surface then does not change anything, because, well, its transparent.
>
> I don't know which visual you are using, but I bet that it does not
> have an alpha channel. Thus, your group approach likely creates an
> immediate surface with CAIRO_CONTENT_COLOR, i.e. no alpha channel.
> Clearing that fills it completely with black.
It has alpha channel, bit depth 32.
Test app reproduces it. Note: background is filled with opaque, but if
drawing to rec surf happens on each draw, it looks as if recording surf
accumulated draws from previous draws, despite it's destroyed in the
end of its draw block. Making it to skip 1 frame gives it really pure
each time it happens (changing condition to require 'flag' being true).
>
> Cheers,
> Uli
Btw, I forgot to specify cairo version: it's 1.16.0 from gentoo
portage tree.
Also - if you try that test app, don't forget to uncomment XWindowMap
and XWindowUnmap calls, and probably comment sleep(1) - this is how I
switch it to and from benchmark mode (to measure cairo performance).
Added sleep(1) to track single refreshes.
More information about the cairo
mailing list