[cairo] Extending Cairo API to support reusable paths

Benjamin Otte otte at redhat.com
Wed Mar 31 00:28:29 PDT 2010


Hey, cool to see someone working on this again.
I've wanted to have something like this since I started hacking on
Swfdec a few years ago - it always seemed so wasteful to retesselate on
every draw operation.
It just turned out to be really hard to get this machinery right and a
lot of people had different ideas, so it never moved anywhere.

Also, my idea has always been to call this cairo_shape_t instead of your
cairo_retained_path_t. Does that make sense?


Some questions: What's the scope of this retained path object? Is it
supposed to be bound to a cairo_t or even a specific matrix or can I use
the same object in multiple different places?

Which leads to the question if there should be constructors like
cairo_shape_t *cairo_shape_create (cairo_path_t *path);

Also, what use cases do you guys have in mind for this API? I suspect
you want to use it as an object to represent SVG paths? Do you intend to
use it for custom font handling, too? Anything else?

I'm really excited to see this moving again.

Benjamin


On Wed, 2010-03-31 at 09:50 +1300, Matt Woodrow wrote:
> Hi All
> 
> As part of my internship at Mozilla, I'm working on extending the Cairo 
> API to allow caching of reusable path objects.
> 
> On the default backend, these will directly wrap the current 
> cairo_path_t objects, and their related functions.
> However on Quartz we can include a copy of the CGPath object and on 
> direct2d a copy of the ID2D1Geometry to hopefully increase redraw 
> performance on these platform.
> 
> The API changes I am proposing are:
> 
> /* New cairo API */
> typedef struct _cairo_retained_path cairo_retained_path_t;
> 
> cairo_public cairo_retained_path_t *
> cairo_copy_retained_path(cairo_t *cr);
> 
> cairo_public void
> cairo_append_retained_path(cairo_t *cr, cairo_retained_path_t *path);
> 
> cairo_public void
> cairo_retained_path_destroy(cairo_retained_path_t *path);
> 
> 
> Does anyone have any thoughts, questions or suggestions on this?
> 
> The Mozilla bug for this is at 
> https://bugzilla.mozilla.org/show_bug.cgi?id=555877
> 
> Thanks
> 
> Matt Woodrow
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo




More information about the cairo mailing list