[Glamor] [PATCH 3/8] glamor_glyphs: Fixed an incorrect mask format handling.

zhigang.gong at linux.intel.com zhigang.gong at linux.intel.com
Tue Jun 26 03:01:57 PDT 2012


From: Zhigang Gong <zhigang.gong at linux.intel.com>

If there is no mask format, and we have intersect. Then
we should not use a default mask format. we need to set the
mask format to null at that case.

This commit also change the glyph edge computing restriction.
We can handle all glyphs whose width larger or equal to 2.

Signed-off-by: Zhigang Gong <zhigang.gong at linux.intel.com>
---
 src/glamor_glyphs.c |   43 ++++++++++++-------------------------------
 1 files changed, 12 insertions(+), 31 deletions(-)

diff --git a/src/glamor_glyphs.c b/src/glamor_glyphs.c
index 476b485..d857504 100644
--- a/src/glamor_glyphs.c
+++ b/src/glamor_glyphs.c
@@ -530,7 +530,7 @@ glamor_glyph_priv_get_edge_extent(GlyphPtr glyph, struct glamor_glyph *priv,
 	width = glyph->info.width;
 	pixmap_priv = glamor_get_pixmap_private(glyph_pixmap);
 
-	if (glyph_pixmap->drawable.width < 4
+	if (glyph_pixmap->drawable.width < 2
 	    || !(glyph_pixmap->drawable.depth == 8
 		|| glyph_pixmap->drawable.depth == 1
 		|| glyph_pixmap->drawable.depth == 32)) {
@@ -696,7 +696,7 @@ glamor_glyph_cache(ScreenPtr screen, GlyphPtr glyph, int *out_x,
 	glamor_glyph_cache_upload_glyph(screen, cache, glyph, priv->x,
 					priv->y);
 
-	if (priv->has_edge_y == FALSE && glyph->info.width >= 4)
+	if (priv->has_edge_y == FALSE && glyph->info.width >= 2)
 		glamor_glyph_priv_get_edge_extent(glyph, priv, glyph_picture);
 	priv->cached = TRUE;
 
@@ -1067,35 +1067,9 @@ _glamor_glyphs(CARD8 op,
 	       INT16 y_src, int nlist, GlyphListPtr list,
 	       GlyphPtr * glyphs, Bool fallback)
 {
-	Bool intersected = FALSE;
 	PictFormatShort format;
-	Bool format_checked = FALSE;
 	int check_fake_overlap = TRUE;
 
-	if (!mask_format) {
-		Bool same_format = TRUE;
-		int i;
-
-		mask_format = list[0].format;
-
-		for (i = 0; i < nlist; i++) {
-			if (mask_format->format != list[i].format->format) {
-				same_format = FALSE;
-				break;
-			}
-		}
-
-		if (!same_format)
-			mask_format = NULL;
-		format_checked = TRUE;
-	}
-
-
-	if (mask_format && !format_checked)
-		format = mask_format->depth << 24 | mask_format->format;
-	else
-		format = 0;
-
 	if (!(op == PictOpOver
 	    || op == PictOpAdd
 	    || op == PictOpXor)) {
@@ -1106,11 +1080,18 @@ _glamor_glyphs(CARD8 op,
 	 * boxes one by one. For other Ops, it's safe to composite the whole box.  */
 		check_fake_overlap = FALSE;
 	}
-	intersected = glamor_glyphs_intersect(nlist, list, glyphs,
+
+	if (mask_format)
+		format = mask_format->depth << 24 | mask_format->format;
+	else
+		format = 0;
+
+	if (!glamor_glyphs_intersect(nlist, list, glyphs,
 				format, dst->pDrawable->pScreen,
-				check_fake_overlap);
+				check_fake_overlap))
+		mask_format = NULL;
 
-	if (!intersected
+	if (mask_format == NULL
 	     || (((nlist == 1 && list->len == 1) || op == PictOpAdd)
 	       && dst->format == (mask_format->depth << 24 | mask_format->format))) {
 
-- 
1.7.4.4



More information about the Glamor mailing list