[cairo] const-ness fixes for transform_distance and transform_point

Carl Worth cworth at cworth.org
Tue May 10 14:21:19 PDT 2005


On Wed, 11 May 2005 08:37:45 +1200, Keith Bauer wrote:
> >>     cairo_scaled_font_create (face, font_matrix,
> >>                   cairo_get_matrix (cr));
> >
> > I'm not entirely comfortable with that. The problem is that  
> > although the
> > matrix is const to the API user, its contents can change over time.
> 
> I agree, this seems like a recipe for disaster.

Yup. I've been quite convinced not to pursue this much further.

> It strikes me that you can get close to the desired syntax without  
> breaking the desired semantics by behaving a bit like getcwd, and  
> returning the pointer to your output parameter:
> 
> cairo_matrix_t *cairo_get_matrix(cairo_t *cr, cairo_matrix_t *matrix);

It doesn't change the fact that you still need an object to pass
in. And it does open some possibilities for confusion; the interface
also looks like that of time(2) where the pointer parameter is
optional, (eg. can be NULL). So I'm not sure the extra opportunities
for nesting would be worth it.

-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/20050510/ac5ad0b0/attachment.pgp


More information about the cairo mailing list