[cairo] [PATCH] gl: Properly prepare the source when compositing glyphs with a mask.

Martin Robinson mrobinson at igalia.com
Fri Nov 11 14:59:58 PST 2011


Date: Fri, 11 Nov 2011 14:25:56 -0800
Subject: [PATCH] gl: Properly prepare the source when compositing glyphs with
 a mask.

After the architecture rewrite, glyph compositing via a mask was
disabled. This change reinstates that.
---
 src/cairo-gl-glyphs.c |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 2324922..484f028 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -349,10 +349,10 @@ render_glyphs (cairo_gl_surface_t *dst,
 }
 
 static cairo_int_status_t
-render_glyphs_via_mask (cairo_gl_surface_t	*dst,
-			   cairo_operator_t	 op,
-			   const cairo_surface_t	*source,
-			   cairo_composite_glyphs_info_t *info)
+render_glyphs_via_mask (cairo_gl_surface_t *dst,
+			cairo_operator_t  op,
+			cairo_surface_t *source,
+			cairo_composite_glyphs_info_t *info)
 {
     cairo_surface_t *mask;
     cairo_status_t status;
@@ -377,19 +377,23 @@ render_glyphs_via_mask (cairo_gl_surface_t	*dst,
 			    &_cairo_pattern_white.base, NULL,
 			    info, &has_component_alpha);
     if (likely (status == CAIRO_STATUS_SUCCESS)) {
-	/* XXX composite */
-#if 0
 	cairo_surface_pattern_t mask_pattern;
-        mask->is_clear = FALSE;
+	cairo_surface_pattern_t source_pattern;
+
+	mask->is_clear = FALSE;
 	_cairo_pattern_init_for_surface (&mask_pattern, mask);
 	mask_pattern.base.has_component_alpha = has_component_alpha;
+
 	cairo_matrix_init_translate (&mask_pattern.base.matrix,
 		                     -info->extents.x, -info->extents.y);
+
+	_cairo_pattern_init_for_surface (&source_pattern, source);
 	status = _cairo_surface_mask (&dst->base, op,
-		                      source, &mask_pattern.base,
+		                      &source_pattern.base, &mask_pattern.base,
 				      NULL);
+
 	_cairo_pattern_fini (&mask_pattern.base);
-#endif
+	_cairo_pattern_fini (&source_pattern.base);
     } else {
 	for (i = 0; i < info->num_glyphs; i++) {
 	    info->glyphs[i].x += info->extents.x;
-- 
1.7.5.4



More information about the cairo mailing list