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

"Henry (Yu) Song - SISA" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <3955FA337689574EB32F94B12A7E6E9E246E0B87@sisaex01sj>
Hi, Chris

My apology, you are right, how about following?

From f33c54853130f7439ac73f437217e917572128ee Mon Sep 17 00:00:00 2001
From: Henry Song <[email protected]>
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 [[email protected]]
Sent: Tuesday, October 09, 2012 8:47 AM
To: Henry (Yu) Song - SISA; [email protected]
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" <[email protected]> wrote:
> From 80142bc08d1b82a2d5d7f775314a1505a328eaae Mon Sep 17 00:00:00 2001
> From: Henry Song <[email protected]>
> 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
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.