[cairo] API Shakeup: cairo_fill_preserve, cairo_stroke_preserve, cairo_clip_preserve

Owen Taylor otaylor at redhat.com
Tue Apr 19 05:07:54 PDT 2005


On Tue, 2005-04-19 at 15:28 +1000, Carl Worth wrote:

> In testing this I did discover one usage of cairo_save/restore for the
> path in libsvg-cairo that wasn't easily fixed by just using one of the
> new _preserve functions. It showed up when filling a path with a
> pattern and looked roughly like this:
> 
> 	create_the_path (cr);
> 
> 	set_paint_for_fill (cr);
> 
> 	if (stroking)
> 	    cairo_fill_preserve (cr);
> 	else
> 	    cairo_fill (cr);
> 
> 	if (stroking) {
> 	    set_paint_for_stroke (cr);
> 	    cairo_stroke (cr);
> 	}

Or you could do:

	create_the_path (cr);

	set_paint_for_fill (cr);
        cairo_fill_preserve (cr);

	if (stroking) {
	    set_paint_for_stroke (cr);
	    cairo_stroke_preserve (cr);
	}

        cairo_new_path ();

right?
				Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050419/48c75d70/attachment.pgp


More information about the cairo mailing list