[cairo] [patch] gl: use font's antialias option to check whether it needs mask

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Tue Mar 27 14:25:37 PDT 2012


It seems that we don't need to check each glyphs surface for ARGB32 format.  We can use font's antialias option.


Author: Henry (Yu) Song <hsong at sisa.samsung.com>
Date:   Tue Mar 27 14:19:45 2012 -0700

    gl: There is need to loop over number of glyphs to check wether the glyph
    image is a ARGB32.  The font's antialias option can be used for checking.
    if antialias is SUBPIXEL or BEST, the glyph surface will be ARGB32,
    otherwise, it will be A8 format.

diff --git a/src/cairo-gl-glyphs.c b/src/cairo-gl-glyphs.c
index 832956f..ede44ce 100644
--- a/src/cairo-gl-glyphs.c
+++ b/src/cairo-gl-glyphs.c
@@ -432,18 +432,9 @@ _cairo_gl_composite_glyphs (void			*_dst,
      * alpha.
      */
     if (!dst->base.is_clear && ! info->use_mask && op != CAIRO_OPERATOR_OVER) {
-	for (i = 0; i < info->num_glyphs; i++) {
-	    cairo_scaled_glyph_t *scaled_glyph;
-
-	    if (_cairo_scaled_glyph_lookup (info->font, info->glyphs[i].index,
-					    CAIRO_SCALED_GLYPH_INFO_SURFACE,
-					    &scaled_glyph) == CAIRO_INT_STATUS_SUCCESS &&
-		scaled_glyph->surface->format == CAIRO_FORMAT_ARGB32)
-	    {
+	if (info->font->options.antialias == CAIRO_ANTIALIAS_SUBPIXEL ||
+	    info->font->options.antialias == CAIRO_ANTIALIAS_BEST)
 		info->use_mask = TRUE;
-		break;
-	    }
-	}
     }
 
     if (info->use_mask) {


More information about the cairo mailing list