[cairo] Avoiding a cairo_bool_t parameter for
cworth at cworth.org
Tue Apr 11 09:47:58 PDT 2006
On Mon, 10 Apr 2006 16:09:27 -0700 (PDT), Anders Carlsson committed:
> cairo_surface_t *cairo_quartz_surface_create(CGContextRef context,
> - cairo_bool_t flipped,
> - int width, int height)
> + int width,
> + int height,
> + cairo_bool_t y_grows_down)
I may have asked this before. But is there really no way to just ask
the CGContextRef for the proper value for y_grows_down here?
Or what would you think of making a separate function for the less
common variant, (whichever that is).
The issue I'm concerned with here is that currently there are no
public cairo API functions that accept Boolean parameters. And I would
prefer to avoid them if possible, since they do lead to code that is
not very readable. For example when looking at:
cairo_quartz_surface_create (ctx, width, height, TRUE);
cairo_quartz_surface_create (ctx, width, height, FALSE);
How easy is it to remember what that Boolean even controls? And then,
how easy is it to remember which value means which?
If there's an obvious "common" value, then I would prefer to give that
value preference via not requiring a parameter:
cairo_quartz_surface_create (ctx, width, height);
and then encoding the less common variant within the function name
which then provides readability:
cairo_quartz_surface_create_grows_down (ctx, width, height);
(Maybe it would be grows_up---I have no clue---and maybe there would
be a much better name here, but hopefully you get the idea.)
Otherwise, if the value could be queried directly from the
CGContextRef and we could just have one function call with no extra
parameter then that would obviously be even better.
What do you with more Quartz knowledge than me think?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060411/c76d3ff8/attachment.pgp
More information about the cairo