[cairo] some fixes and improvements to current cvs version of cairo

David Reveman davidr at novell.com
Tue Feb 1 12:04:34 PST 2005


On Mon, 2005-01-31 at 22:33 -0500, Kristian Høgsberg wrote:
> David Reveman wrote:
> > On Mon, 2005-01-31 at 12:05 -0500, Carl Worth wrote: 
> > 
> >>On Fri, 28 Jan 2005 22:44:26 +0100, David Reveman wrote:
> >>
> >>>It includes a fix for the _cairo_gstate_init bug. This fix adds a
> >>>default_pattern to the cairo_gstate struct and cairo_set_rgb_color can
> >>>use this without allocating and destroying patterns all the time, and
> >>>cairo_gstate_init can no longer fail. What do you think?
> >>
> >>Does reducing the mallocs actually have any performance benefit here?
> > 
> > I don't know, probably not.
> > 
> >>Another approach to fixing the potential failure of cairo_gstate_init
> >>would be to make the allocation of the pattern lazy, (someone recently
> >>fixed gstate->font in a similar way). That might be slightly less
> >>complex.
> > 
> > I think you're right. I've fixed this in my current patch.
> 
> OK, I hate to keep kicking this issue around, but at this point I don't 
> see what this change is buying us.  I appreciate removing an error path, 
> but this comes at a cost of adding ensure_pattern (which can fail) in 
> quite a few places.  And _cairo_gstate_init is only used from 
> _cairo_gstate_create, which can fail anyway if it can not allocate 
> memory for the cairo_state_t, so it's not a big win.

maybe we should just allow _cairo_gstate_init to fail, then.

> 
> cheers,
> Kristian

-David




More information about the cairo mailing list