diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-06 14:16:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-07-06 14:16:36 +0100 |
commit | 24b59a8955eb15522ad334a541530aca937fcf07 (patch) | |
tree | dfe5fe29378c5867ea9b2aa59ed1ca69aa444d32 | |
parent | 68b357454af705f1ed3a9599435a402f2611a180 (diff) |
sna: Refactor a common function: is_clipped()
Had I done this earlier, I would not have the bug in the open-coded
version. Le sigh.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 8 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 4 | ||||
-rw-r--r-- | src/sna/sna_glyphs.c | 4 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index bda3cb87..3219e151 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -703,4 +703,12 @@ inline static bool is_power_of_two(unsigned x) return (x & (x-1)) == 0; } +inline static bool is_clipped(const RegionRec *r, + const DrawableRec *d) +{ + return (r->data || + r->extents.x2 - r->extents.x1 != d->width || + r->extents.y2 - r->extents.y1 != d->height); +} + #endif /* _SNA_H */ diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index 36b40a74..e1b5de67 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -522,9 +522,7 @@ sna_dri_copy_to_front(struct sna *sna, DrawablePtr draw, RegionPtr region, if (draw->type != DRAWABLE_PIXMAP) { WindowPtr win = (WindowPtr)draw; - if (win->clipList.data || - win->clipList.extents.x2 - win->clipList.extents.x1 != draw->width || - win->clipList.extents.y2 - win->clipList.extents.y1 != draw->height) { + if (is_clipped(&win->clipList, draw)) { DBG(("%s: draw=(%d, %d), delta=(%d, %d), clip.extents=(%d, %d), (%d, %d)\n", __FUNCTION__, draw->x, draw->y, get_drawable_dx(draw), get_drawable_dy(draw), diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index d4ace9df..d9a3dcf6 100644 --- a/src/sna/sna_glyphs.c +++ b/src/sna/sna_glyphs.c @@ -471,9 +471,7 @@ glyphs_to_dst(struct sna *sna, __FUNCTION__, op, src_x, src_y, nlist, list->xOff, list->yOff, dst->pDrawable->x, dst->pDrawable->y)); - if (dst->pCompositeClip->extents.x2 - dst->pCompositeClip->extents.x1 < dst->pDrawable->width || - dst->pCompositeClip->extents.y2 - dst->pCompositeClip->extents.y1 < dst->pDrawable->height || - dst->pCompositeClip->data) { + if (is_clipped(dst->pCompositeClip, dst->pDrawable)) { rects = REGION_RECTS(dst->pCompositeClip); nrect = REGION_NUM_RECTS(dst->pCompositeClip); } else |