summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-06-23 15:51:59 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-06-23 15:55:47 +0100
commit03e6aee8fd2cc7486fbd2ec55a537c712786486b (patch)
treed229c589e3d3027c97f986ff373ed3aaa8a4bcf5
parent356ded1308e8fe5f8dbec217b219228a991356d5 (diff)
sna: For an unbounded op, we need to convert the whole surface
Otherwise if we fail to check, then we create a 0x0 surface to sample with the operation -- net result is that we end up using a clear source instead of the desired mask. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_render.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c
index c89be51a..b05689d1 100644
--- a/src/sna/sna_render.c
+++ b/src/sna/sna_render.c
@@ -714,28 +714,36 @@ sna_render_picture_convert(struct sna *sna,
return -1;
#endif
- box.x1 = x;
- box.y1 = y;
- box.x2 = x + w;
- box.y2 = y + h;
+ if (w != 0 && h != 0) {
+ box.x1 = x;
+ box.y1 = y;
+ box.x2 = x + w;
+ box.y2 = y + h;
- if (channel->transform) {
- DBG(("%s: has transform, uploading whole surface\n",
+ if (channel->transform) {
+ DBG(("%s: has transform, converting whole surface\n",
+ __FUNCTION__));
+ box.x1 = box.y1 = 0;
+ box.x2 = pixmap->drawable.width;
+ box.y2 = pixmap->drawable.height;
+ }
+
+ if (box.x1 < 0)
+ box.x1 = 0;
+ if (box.y1 < 0)
+ box.y1 = 0;
+ if (box.x2 > pixmap->drawable.width)
+ box.x2 = pixmap->drawable.width;
+ if (box.y2 > pixmap->drawable.height)
+ box.y2 = pixmap->drawable.height;
+ } else {
+ DBG(("%s: op no bounds, converting whole surface\n",
__FUNCTION__));
box.x1 = box.y1 = 0;
box.x2 = pixmap->drawable.width;
box.y2 = pixmap->drawable.height;
}
- if (box.x1 < 0)
- box.x1 = 0;
- if (box.y1 < 0)
- box.y1 = 0;
- if (box.x2 > pixmap->drawable.width)
- box.x2 = pixmap->drawable.width;
- if (box.y2 > pixmap->drawable.height)
- box.y2 = pixmap->drawable.height;
-
w = box.x2 - box.x1;
h = box.y2 - box.y1;
@@ -744,6 +752,12 @@ sna_render_picture_convert(struct sna *sna,
pixmap->drawable.width,
pixmap->drawable.height));
+ if (w == 0 || h == 0) {
+ DBG(("%s: sample extents lie outside of source, using clear\n",
+ __FUNCTION__));
+ return 0;
+ }
+
sna_pixmap_move_to_cpu(pixmap, false);
src = pixman_image_create_bits(picture->format,