summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-05-14 11:36:15 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-05-14 11:39:55 +0100
commitb654b8794db7b00666ce5c59535a9302932c483b (patch)
treea2ac1f32df06989be5a5d620f3a1fb05492abb4f /src
parent80567f61afe77a003e663b17c1fc6b6c3ed04042 (diff)
sna/trapezoids: Fix picture creation for fallback trapezoids
Being a little lax in not updating the format after upconversion to PICT_a8, meant we were trying to composite with a depth 1, 8 bpp a8 image and thoroughly confusing everybody when creating the upload trapezoid mask. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/sna/sna_trapezoids.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c
index 3bc32849..8d5594d7 100644
--- a/src/sna/sna_trapezoids.c
+++ b/src/sna/sna_trapezoids.c
@@ -2473,7 +2473,13 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
bounds.x1 -= dst->pDrawable->x;
bounds.y1 -= dst->pDrawable->y;
depth = maskFormat->depth;
- format = maskFormat->format | (BitsPerPixel(depth) << 24);
+ if (depth == 1) {
+ format = PIXMAN_a1;
+ } else if (depth < 8) {
+ format = PIXMAN_a4;
+ depth = 4;
+ } else
+ format = PIXMAN_a8;
DBG(("%s: mask (%dx%d) depth=%d, format=%08x\n",
__FUNCTION__, width, height, depth, format));
@@ -2511,15 +2517,22 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
0, 0,
0, 0,
width, height);
+ format = PIXMAN_a8;
+ depth = 8;
pixman_image_unref (a8);
}
}
pixman_image_unref(image);
}
+ if (format != PIXMAN_a8) {
+ screen->DestroyPixmap(scratch);
+ return;
+ }
} else {
scratch = sna_pixmap_create_unattached(screen,
- width, height, depth);
+ width, height,
+ depth);
if (!scratch)
return;
@@ -2532,6 +2545,7 @@ trapezoids_fallback(CARD8 op, PicturePtr src, PicturePtr dst,
pixman_rasterize_trapezoid(image,
(pixman_trapezoid_t *)traps,
-bounds.x1, -bounds.y1);
+ pixman_image_unref(image);
}
}