[cairo] patch: have cairo_paint_with_alpha fall back to cairo_paint when alpha == 1

Carl Worth cworth at cworth.org
Tue Jun 21 10:18:10 PDT 2005


On Tue, 10 May 2005 16:04:11 +1200, Robert O'Callahan wrote:
> I updated our code to use paint/paint_with_alpha. Rather than try to
> optimize for alpha==1 in our code I thought it might be better to push
> that down into cairo.

I just ran into the same thing with libsvg-cairo and I committed a
patch to cairo to make cairo_paint_with_alpha defer to cairo_paint
when alpha==1. (This also happens to workaround a limitation of the
PDF backend which is that cairo_mask doesn't seem to work at all---and
cairo_paint_with_alpha is implemented with cairo_mask.)

> Also, I noticed that cairo_paint applies the CTM to the pattern matrix,
> but cairo_paint_with_alpha doesn't, but I'm not sure how to fix it.

This sounds like a bug I'd like to not forget about. Could you provide
a failing test for cairo/test ? That would be quite helpful.

> [2 patch <text/x-patch; UTF-8 (7bit)>]
> Index: src/cairo-glitz-surface.c
> ===================================================================
> RCS file: /cvs/cairo/cairo/src/cairo-glitz-surface.c,v
> retrieving revision 1.36
> diff -u -t -p -1 -2 -r1.36 cairo-glitz-surface.c
> --- src/cairo-glitz-surface.c	6 May 2005 21:20:05 -0000	1.36
> +++ src/cairo-glitz-surface.c	10 May 2005 03:15:15 -0000
> @@ -1545,24 +1545,25 @@ _cairo_glitz_root_area_fini (cairo_glitz
>  
>  typedef struct _cairo_glitz_glyph_cache {
>      cairo_cache_t           base;
>      cairo_glitz_root_area_t root;
>      glitz_surface_t         *surface;
>  } cairo_glitz_glyph_cache_t;
>  
>  typedef struct {
>      cairo_glyph_cache_key_t key;
>      int                     refcount;
>      cairo_glyph_size_t      size;
>      cairo_glitz_area_t      *area;
> +    cairo_bool_t            is_empty;
>      cairo_bool_t            locked;
>      cairo_point_double_t    p1, p2;
>  } cairo_glitz_glyph_cache_entry_t;
[...]

Was this just the wrong attachment? I can't make much sense of this
patch in the context of your original message.

-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/20050621/3b92f345/attachment.pgp


More information about the cairo mailing list