summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/gen3_render.c8
-rw-r--r--src/sna/gen5_render.c8
-rw-r--r--src/sna/gen6_render.c8
-rw-r--r--src/sna/gen7_render.c8
-rw-r--r--src/sna/sna_render_inline.h19
5 files changed, 27 insertions, 24 deletions
diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c
index 723dd5ee..4c4271e7 100644
--- a/src/sna/gen3_render.c
+++ b/src/sna/gen3_render.c
@@ -2500,12 +2500,8 @@ gen3_composite_set_target(struct sna *sna,
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
- } else {
- box.x1 = dst->pDrawable->x;
- box.y1 = dst->pDrawable->y;
- box.x2 = box.x1 + dst->pDrawable->width;
- box.y2 = box.y1 + dst->pDrawable->height;
- }
+ } else
+ sna_render_picture_extents(dst, &box);
op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
PREFER_GPU | FORCE_GPU | RENDER_GPU,
diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c
index c9a2cc04..a1417664 100644
--- a/src/sna/gen5_render.c
+++ b/src/sna/gen5_render.c
@@ -1983,12 +1983,8 @@ gen5_composite_set_target(struct sna *sna,
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
- } else {
- box.x1 = dst->pDrawable->x;
- box.y1 = dst->pDrawable->y;
- box.x2 = box.x1 + dst->pDrawable->width;
- box.y2 = box.y1 + dst->pDrawable->height;
- }
+ } else
+ sna_render_picture_extents(dst, &box);
op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
PREFER_GPU | FORCE_GPU | RENDER_GPU,
diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c
index 8e10af34..4990062f 100644
--- a/src/sna/gen6_render.c
+++ b/src/sna/gen6_render.c
@@ -2331,12 +2331,8 @@ gen6_composite_set_target(struct sna *sna,
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
- } else {
- box.x1 = dst->pDrawable->x;
- box.y1 = dst->pDrawable->y;
- box.x2 = box.x1 + dst->pDrawable->width;
- box.y2 = box.y1 + dst->pDrawable->height;
- }
+ } else
+ sna_render_picture_extents(dst, &box);
op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
PREFER_GPU | FORCE_GPU | RENDER_GPU,
diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c
index 51b002e0..1f59eb37 100644
--- a/src/sna/gen7_render.c
+++ b/src/sna/gen7_render.c
@@ -2438,12 +2438,8 @@ gen7_composite_set_target(struct sna *sna,
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
- } else {
- box.x1 = dst->pDrawable->x;
- box.y1 = dst->pDrawable->y;
- box.x2 = box.x1 + dst->pDrawable->width;
- box.y2 = box.y1 + dst->pDrawable->height;
- }
+ } else
+ sna_render_picture_extents(dst, &box);
op->dst.bo = sna_drawable_use_bo (dst->pDrawable,
PREFER_GPU | FORCE_GPU | RENDER_GPU,
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index 64f8a46f..216937a2 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -140,6 +140,25 @@ sna_render_get_alpha_gradient(struct sna *sna)
}
static inline void
+sna_render_picture_extents(PicturePtr p, BoxRec *box)
+{
+ box->x1 = p->pDrawable->x;
+ box->y1 = p->pDrawable->y;
+ box->x2 = p->pDrawable->x + p->pDrawable->width;
+ box->y2 = p->pDrawable->y + p->pDrawable->height;
+
+ if (box->x1 < p->pCompositeClip->extents.x1)
+ box->x1 = p->pCompositeClip->extents.x1;
+ if (box->y1 < p->pCompositeClip->extents.y1)
+ box->y1 = p->pCompositeClip->extents.y1;
+
+ if (box->x2 > p->pCompositeClip->extents.x2)
+ box->x2 = p->pCompositeClip->extents.x2;
+ if (box->y2 > p->pCompositeClip->extents.y2)
+ box->y2 = p->pCompositeClip->extents.y2;
+}
+
+static inline void
sna_render_reduce_damage(struct sna_composite_op *op,
int dst_x, int dst_y,
int width, int height)