[cairo] [patch] gl: when using a surface as source/mask in drawing operation on GL surface target, we can avoid map_to_image()

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Fri Mar 30 07:55:17 PDT 2012

commit 99d01460c93ae83c1eea5a221b34d7a990e60528
Author: Henry (Yu) Song <hsong at sisa.samsung.com>
Date:   Fri Mar 30 07:49:54 2012 -0700

    gl: when using a surface as a source or mask, there is no need to download
    newly created gl surface to an image.  glReadPixels() can be slow.  We
    can avoid that.

diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c
index ddff5e7..8ce534f 100644
--- a/src/cairo-gl-operand.c
+++ b/src/cairo-gl-operand.c
@@ -261,7 +261,8 @@ _cairo_gl_pattern_texture_setup (cairo_gl_operand_t *operand,
 	_cairo_gl_surface_create_scratch (ctx,
 					  extents->width, extents->height);
-    image = cairo_surface_map_to_image (&surface->base, NULL);
+    image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
+					extents->width, extents->height);
     /* If the pattern is a GL surface, it belongs to some other GL context,
        so we need to release this device while we paint it to the image. */

More information about the cairo mailing list