summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-11-05 12:36:53 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-11-05 12:36:53 +0000
commit0cf29afda9b061455bc438a22bbbfb1d6db6528e (patch)
tree4b7be201ba6e0e13aab32deb70d24a0b885ba4fd
parentd21c30d0b8b08ec85c3b5d9a02a6969f7c8b9315 (diff)
sna/glyphs: Fix clip detection for small masks
-ENOCOFFEE. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_glyphs.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c
index ad2c19d0..aaa4cd27 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];