[cairo] Two small patches

Carl Worth cworth at cworth.org
Sat Aug 13 01:08:38 PDT 2005

On Tue, 2 Aug 2005 21:38:03 -0400 (EDT), Behdad Esfahbod wrote:
> Attached are the following patches:
> * cairo-path-noop.patch:  This basically modifies
> cairo_append_path in a number of ways:
>   - Checks are moved before the actually call.  This is a bug fix.

Good catch, thanks. Feel free to commit that part at least.

>   - Does not err if there are excess elements in the path.
> Means, if there are more points than needed for an operation.
> This way applications may store private data in a path structure.
> Would be good to know if people see any obvious problem with
> allowing that.
>   - Adds a CAIRO_PATH_NOOP operation, that cairo simply ignores.
> That's to expand the functionality from last item, to allow for
> application-specific operations.

What thoughts do people have on this addition?

It seems like something that could be useful to me, (it could prevent
some data copying on the part of the application, and this exposed
path data object is intended to provide a less-overhead way of setting
path data.

But, we're supposed to be API frozen now[*]. [What I need is a release
manager that can be the bad guy and say no to people so I don't have

> * cairo-color.patch should be self-explanatory.

This one looks quite useful as it solves a bug and removes the comment
asking for someone to fix it.

> +/* We multiply colors by (0x10000 - epsilon), such that we get a uniform
> + * range even for 0xffff.  In other words, (1.0 - epsilon) would convert
> + * to 0xffff, not 0xfffe.
> + */
> +#define COLOR_MAGIC_MULT (65536.0 - 1e-5)
> +    color->red_short   = color->red   * color->alpha * COLOR_MAGIC_MULT;
> +    color->green_short = color->green * color->alpha * COLOR_MAGIC_MULT;
> +    color->blue_short  = color->blue  * color->alpha * COLOR_MAGIC_MULT;
> +    color->alpha_short = color->alpha * COLOR_MAGIC_MULT;

I really don't like to have too much magic in cairo. How about a name
of CAIRO_COLOR_ONE_MINUS_EPSILON or something instead?


[*] Pay no attention to the recent addition of cairo_version() and
-------------- 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/20050813/9db8c108/attachment.pgp

More information about the cairo mailing list