[cairo] cairo pattern/glitz patches

Carl Worth cworth at cworth.org
Fri Feb 25 12:32:43 PST 2005


On Fri, 25 Feb 2005 14:09:27 +0100, David Reveman wrote:
> Possibly, I'm not completely happy with the current public gradient
> interface. I don't like the way color stops are specified. We should
> probably give this interface a second thought.

As you recall, the R, G, B, and A interface of
cairo_pattern_add_color_stop was something we considered when coming
up with the replacement for cairo_set_rgb_color.

There we decided on three different ways to set the source to a single
color:

	cairo_set_source_rgb
	cairo_set_source_rgba
	cairo_set_source_rgba_premultiplied

We might want the same three variations for creating color stops.

> > If that's the 
> > case, shouldn't we use a construction more like cairo_surface_t?

I do agree that we should decide on one "best" way to do sub-typing
and apply it consistently throughout cairo. So, I'm glad the current
debate is happening.

And I wouldn't be too opposed to having two different implementations
in CVS if the understood goal was to change one of them to match the
other.

One thing I don't like about the current proposed patch is that it
changes the public header file for what really should be an
implementation detail, (which is really a fault in C, not the
patch). If the outer-level-union-based sub-typing wins, would it make
sense to hide it in a struct for the sake of cairo.h?

> This means that we can't allocate a general pattern on the stack. We do
> this a lot (_cairo_pattern_copy) and I think we like to keep doing
> this. 

I don't see this a lot in the code. In CVS I see cairo_pattern_t on
the stack in four places, but in each instance, the usage of the
pattern is only with one specific sub-type.

The patch does add a call to _cairo_pattern_init_copy with a pattern
on the stack, but would calling some _cairo_pattern_clone, (and
cairo_pattern_destroy), really be that much worse?

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050225/7b868ec6/attachment.pgp


More information about the cairo mailing list