[cairo] [patch] gl: skip using mask surface when source pattern is solid

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Tue Oct 9 09:02:31 PDT 2012


Hi, Chris

My apology, you are right, how about following?

>From f33c54853130f7439ac73f437217e917572128ee Mon Sep 17 00:00:00 2001
From: Henry Song <henry.song at samsung.com>
Date: Tue, 9 Oct 2012 08:56:56 -0700
Subject: [PATCH] gl: skip using mask surface when source pattern is solid and
 font is not antialiased.

---
 src/cairo-traps-compositor.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
index eeee20c..447c789 100644
--- a/src/cairo-traps-compositor.c
+++ b/src/cairo-traps-compositor.c
@@ -2268,6 +2268,7 @@ _cairo_traps_compositor_glyphs (const cairo_compositor_t	*_compositor,
 				cairo_bool_t			 overlap)
 {
     const cairo_traps_compositor_t *compositor = (cairo_traps_compositor_t *)_compositor;
+    cairo_bool_t glyphs_overlap = overlap;
     cairo_int_status_t status;
 
     TRACE ((stderr, "%s\n", __FUNCTION__));
@@ -2283,11 +2284,17 @@ _cairo_traps_compositor_glyphs (const cairo_compositor_t	*_compositor,
     if (likely (status == CAIRO_INT_STATUS_SUCCESS)) {
 	cairo_composite_glyphs_info_t info;
 	unsigned flags = 0;
+	const cairo_pattern_t *pattern = extents->original_source_pattern;
+
+	if (_cairo_pattern_is_opaque_solid (pattern) &&
+	    ! (scaled_font->options.antialias == CAIRO_ANTIALIAS_SUBPIXEL ||
+	       scaled_font->options.antialias == CAIRO_ANTIALIAS_BEST))
+	    glyphs_overlap = FALSE;
 
 	info.font = scaled_font;
 	info.glyphs = glyphs;
 	info.num_glyphs = num_glyphs;
-	info.use_mask = overlap || ! extents->is_bounded;
+	info.use_mask = glyphs_overlap || ! extents->is_bounded;
 	info.extents = extents->bounded;
 
 	if (extents->mask.width > extents->bounded.width ||
-- 
1.7.9.5

________________________________________
From: Chris Wilson [chris at chris-wilson.co.uk]
Sent: Tuesday, October 09, 2012 8:47 AM
To: Henry (Yu) Song - SISA; cairo at cairographics.org
Subject: Re: [cairo] [patch] gl: skip using mask surface when source pattern is solid

On Tue, 9 Oct 2012 15:29:29 +0000, "Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> wrote:
> From 80142bc08d1b82a2d5d7f775314a1505a328eaae Mon Sep 17 00:00:00 2001
> From: Henry Song <henry.song at samsung.com>
> Date: Tue, 9 Oct 2012 08:17:17 -0700
> Subject: [PATCH] gl: We can skit using mask surface if the source pattern is
>  opaque during text rendering in gl traps compositor

Only true for non-antialiased glyphs, unfortunately.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list