[cairo-commit] src/cairo-gl-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Apr 15 01:37:31 PDT 2010


 src/cairo-gl-surface.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 4142f0836d6719dd136a5fc6ac1adaddd681a3f2
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Apr 15 09:09:31 2010 +0100

    gl: Handle component-alpha ADD
    
    A simple extension to the component-alpha OVER [as ca-ADD is just the
    second pass in ca-OVER] to support amalgamation of glyph masks. This
    speeds up firefox-36 by ~5% on g45.
    
    Before:
      firefox-36-20090611   76.185
    After:
      firefox-36-20090611   72.863

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index cf508f4..96eb1b6 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1929,7 +1929,7 @@ _cairo_gl_surface_composite_component_alpha (cairo_operator_t op,
     cairo_gl_shader_program_t *ca_source_program = NULL;
     cairo_gl_shader_program_t *ca_source_alpha_program = NULL;
 
-    if (op != CAIRO_OPERATOR_OVER)
+    if (op != CAIRO_OPERATOR_OVER && op != CAIRO_OPERATOR_ADD)
 	return UNSUPPORTED ("unsupported component alpha operator");
 
     memset (&setup, 0, sizeof (setup));
@@ -2061,12 +2061,14 @@ _cairo_gl_surface_composite_component_alpha (cairo_operator_t op,
 	glEnableClientState (GL_TEXTURE_COORD_ARRAY);
     }
 
-    setup.shader = ca_source_alpha_program;
-    _cairo_gl_use_program (setup.shader);
-    _cairo_gl_set_operator (dst, CAIRO_OPERATOR_DEST_OUT, TRUE);
-    _cairo_gl_set_src_alpha_operand (ctx, &setup);
-    _cairo_gl_set_component_alpha_mask_operand (ctx, &setup);
-    glDrawArrays (GL_QUADS, 0, num_vertices);
+    if (op == CAIRO_OPERATOR_OVER) {
+	setup.shader = ca_source_alpha_program;
+	_cairo_gl_use_program (setup.shader);
+	_cairo_gl_set_operator (dst, CAIRO_OPERATOR_DEST_OUT, TRUE);
+	_cairo_gl_set_src_alpha_operand (ctx, &setup);
+	_cairo_gl_set_component_alpha_mask_operand (ctx, &setup);
+	glDrawArrays (GL_QUADS, 0, num_vertices);
+    }
 
     setup.shader = ca_source_program;
     _cairo_gl_use_program (setup.shader);


More information about the cairo-commit mailing list