From cff0097954657a459707e2af30c0bc49643cd289 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 7 Dec 2011 11:56:38 +0000 Subject: [PATCH] gl: Prevent leak of the white source used with glyph masks Signed-off-by: Chris Wilson --- src/cairo-gl-glyphs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c index ca33e6470..63678ff6a 100644 --- a/src/cairo-gl-glyphs.c +++ b/src/cairo-gl-glyphs.c @@ -229,9 +229,13 @@ render_glyphs (cairo_gl_surface_t *dst, if (unlikely (status)) goto FINISH; - _cairo_gl_composite_set_source_operand (&setup, - source_to_operand (source)); + if (source == NULL) { + _cairo_gl_composite_set_solid_source (&setup, CAIRO_COLOR_WHITE); + } else { + _cairo_gl_composite_set_source_operand (&setup, + source_to_operand (source)); + } for (i = 0; i < info->num_glyphs; i++) { cairo_scaled_glyph_t *scaled_glyph; cairo_gl_glyph_t *glyph; @@ -344,8 +348,7 @@ render_glyphs_via_mask (cairo_gl_surface_t *dst, } status = render_glyphs ((cairo_gl_surface_t *) mask, 0, 0, - CAIRO_OPERATOR_ADD, - _cairo_gl_white_source (), + CAIRO_OPERATOR_ADD, NULL, info, &has_component_alpha); if (likely (status == CAIRO_STATUS_SUCCESS)) { cairo_surface_pattern_t mask_pattern;