[cairo] Public API for pattern duplication
markv743 at yahoo.co.uk
Fri Mar 2 11:47:20 PST 2012
On 02/27/2012 08:46 PM, Chris Wilson wrote:
> On Mon, 27 Feb 2012 20:23:20 +0200, Mark Vender<markv743 at yahoo.co.uk> wrote:
>> Could someone indicate whether this function is still welcome to cairo?
>> If the problem is that just nobody else is interested, I could easily
>> contribute a patch adding this functionality myself.
> If you have a concrete use case and such functionality will be useful to
> you, please do submit the patch to give a public entry point to
> _cairo_pattern_create_copy(). Be prepared to justify your use case
> though. ;)
I have a fairly simple use case, in which it is almost impossible to
workaround the lack of pattern copying routine. I have several threads,
that do drawing on a separate surfaces using a separate contexts. An
equivalent pattern needs to be passed to each of the threads. The
pattern transformation matrix is modified during the drawing, therefore
I can't use a single pattern without adding much complexity to the code
and incurring a performance penalty. I don't use surface patterns, so
_cairo_pattern_create_copy would solve this issue completely for me.
I attach a patch that adds new function cairo_pattern_create_copy, which
acts as a wrapper to _cairo_pattern_create_copy. The pattern copying
code currently doesn't use the freed pattern cache, this might be a
possible addition in the future.
More information about the cairo