[cairo] [patch] gl: skip using mask surface when source pattern is solid

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Tue Oct 9 10:06:07 PDT 2012

Hi, Chris

I might not be too familiar with traps compositor.  Does cairo always use A1/A8 for CAIRO_ANTIALIAS_DEFAULT/FAST/GOOD?  I am sure antialias default generate A8 images.  For alpha-only image, can we skip using mask surface?


From: Chris Wilson [chris at chris-wilson.co.uk]
Sent: Tuesday, October 09, 2012 9:37 AM
To: Henry (Yu) Song - SISA; cairo at cairographics.org
Subject: RE: [cairo] [patch] gl: skip using mask surface when source pattern is solid

On Tue, 9 Oct 2012 16:02:31 +0000, "Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> wrote:
> Hi, Chris
> My apology, you are right, how about following?

I think we can move the optimisation up into the core
cairo-composite-rectangles.c. I actually thought I had already done so!

Something like:

diff --git a/src/cairo-composite-rectangles.c
index c792985..c26098a 100644
--- a/src/cairo-composite-rectangles.c
+++ b/src/cairo-composite-rectangles.c
@@ -444,6 +444,13 @@ _cairo_composite_rectangles_init_for_glyphs (cairo_composit
     if (unlikely (status))
        return status;

+    if (overlap && *overlap &&
+       scaled_font->options.antialias == CAIRO_ANTIALIAS_NONE &&
+       _cairo_pattern_is_opaque_solid (&extents->source_pattern.base))
+    {
+       *overlap = FALSE;
+    }
     return _cairo_composite_rectangles_intersect (extents, clip);

Chris Wilson, Intel Open Source Technology Centre

More information about the cairo mailing list