xf86-video-intel: src/sna/sna_glyphs.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Nov 5 05:38:44 PDT 2011


 src/sna/sna_glyphs.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 0cf29afda9b061455bc438a22bbbfb1d6db6528e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Nov 5 12:36:53 2011 +0000

    sna/glyphs: Fix clip detection for small masks
    
    -ENOCOFFEE.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index ad2c19d..aaa4cd2 100644
--- a/src/sna/sna_glyphs.c
+++ b/src/sna/sna_glyphs.c
@@ -731,17 +731,22 @@ glyphs_via_mask(struct sna *sna,
 		     __FUNCTION__));
 
 		pixmap = sna_pixmap_create_upload(screen,
-						   width, height,
-						   format->depth);
+						  width, height,
+						  format->depth);
 		if (!pixmap)
 			return FALSE;
 
-		memset(pixmap->devPrivate.ptr, 0, pixmap->devKind*height);
 		mask_image =
 			pixman_image_create_bits(format->depth << 24 | format->format,
 						 width, height,
 						 pixmap->devPrivate.ptr,
 						 pixmap->devKind);
+		if (mask_image == NULL) {
+			screen->DestroyPixmap(pixmap);
+			return FALSE;
+		}
+
+		memset(pixmap->devPrivate.ptr, 0, pixmap->devKind*height);
 		do {
 			int n = list->len;
 			x += list->xOff;
@@ -761,10 +766,10 @@ glyphs_via_mask(struct sna *sna,
 				 */
 				xi = x - g->info.x;
 				yi = y - g->info.y;
-				if (xi < width || yi < height)
+				if (xi >= width || yi >= height)
 					goto next_image;
-				if (xi + g->info.width >= 0 ||
-				    yi + g->info.height >= 0)
+				if (xi + g->info.width  <= 0 ||
+				    yi + g->info.height <= 0)
 					goto next_image;
 
 				picture = GlyphPicture(g)[s];


More information about the xorg-commit mailing list