[cairo] Pattern (pop) and clip

Andrea Canciani ranma42 at gmail.com
Thu Nov 28 08:35:45 PST 2013

On Tue, Nov 26, 2013 at 10:02 AM, Donn <donn.ingle at gmail.com> wrote:

> Hi,
> Given:
> (In a valid context with a surface 500px by 500px)
> rectangle (50px by 50px)
> save
> clip
> push_group
> draw other stuff
> pop_group(pat)
> restore
> Would the pattern, pat, be the size of the clip 50x50px, or of the size of
> the surface 500x500px?
> i.e. Should I bother clipping before I pop a pattern, or should I clip
> before using that pat in a set_source(pat) then paint() ?

If you clip before pushing, the group size will be smaller, which is
usually going to result in decreased memory usage and better performance.
This is especially true on backends which store a rasterization of the
surface you're working on, like in the image backend. On other backends
(example: the recording backend) keep an implicit representation of the
operations performed on the surface, so this might have little to no impact.


> What's the more efficient/fast approach?
> \d
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20131128/816bf469/attachment.html>

More information about the cairo mailing list