[cairo] obtaining last operation extents

Behdad Esfahbod behdad at behdad.org
Mon Mar 30 21:44:30 PDT 2009


On 03/31/2009 12:28 AM, Vladimir Vukicevic wrote:
> A thought... It's fairly common to call cairo_fill_extents() then
> cairo_fill(), or cairo_stroke_extents() then cairo_stroke().  Computing
> the extents is often cheaper than doing the full operation, but are the
> extents available "for free" during setup for the operation?  If so,
> would it be possible to provide a cairo_last_operation_extents() that
> would just return a precomputed&  cached rect?
>
> Though now that I think about it, backends that implement, say,
> fill()/stroke() aren't going to go through cairo's tessellation, so
> calculating the extents would require having the path still around...
> and fill/stroke consume the path.  Hrm.  So if this is possible, a less
> ugly solution might be some functions to both perform the operation and
> obtain the extents in one go.  (cairo_fill_with_extents() or something?)

Another issue is what would happen if user changed CTM before calling 
last_operation_matrix().  The cairo_fill_with_extents() approach doesn't have 
that problem.  But we first need to see a real profile showing that this is a 
real improvement.   For example, if there's anything to save here, why can't 
the implementation save the cairo_fill_extents() results internally and reuse 
that if in cairo_fill() if the path hasn't changed since?

behdad

>       - Vlad


More information about the cairo mailing list