diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-11 15:28:55 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-11 15:28:55 +0100 |
commit | 07926bfe507071a3d46a2ec13bb86a36bc225761 (patch) | |
tree | 0f27fb1929bd9e4b8071feeb3fadf177ca5718cf /src | |
parent | 519d0007d4add23b14b5a9fd83cf4a1b68c63d03 (diff) |
sna: Remove the temporary region allocation from sna_do_copy
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/sna/sna_accel.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index dc8e4dda..50aa48e1 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -5458,7 +5458,7 @@ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, int dx, int dy, sna_copy_func copy, Pixel bitPlane, void *closure) { - RegionPtr clip, free_clip = NULL; + RegionPtr clip; RegionRec region; bool expose; @@ -5510,14 +5510,37 @@ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, } else if (src->type == DRAWABLE_PIXMAP) { DBG(("%s: pixmap -- no source clipping\n", __FUNCTION__)); } else if (gc->subWindowMode == IncludeInferiors) { + WindowPtr w = (WindowPtr)src; + + DBG(("%s: include inferiors (is-clipped? %d)\n", + __FUNCTION__, w->parent || RegionNil(&w->borderClip))); + /* * XFree86 DDX empties the border clip when the * VT is inactive, make sure the region isn't empty */ - if (((WindowPtr)src)->parent || - RegionNil(&((WindowPtr)src)->borderClip)) { - DBG(("%s: include inferiors\n", __FUNCTION__)); - free_clip = clip = NotClippedByChildren((WindowPtr)src); + if (w->parent || RegionNil(&w->borderClip)) { + int16_t v; + + v = max(w->borderClip.extents.x1, + w->winSize.extents.x1); + if (region.extents.x1 < v) + region.extents.x1 = v; + + v = max(w->borderClip.extents.y1, + w->winSize.extents.y1); + if (region.extents.y1 < v) + region.extents.y1 = v; + + v = min(w->borderClip.extents.x2, + w->winSize.extents.x2); + if (region.extents.x2 > v) + region.extents.x2 = v; + + v = min(w->borderClip.extents.y2, + w->winSize.extents.y2); + if (region.extents.y2 > v) + region.extents.y2 = v; } } else { DBG(("%s: window clip\n", __FUNCTION__)); @@ -5547,8 +5570,6 @@ sna_do_copy(DrawablePtr src, DrawablePtr dst, GCPtr gc, } else { expose = false; RegionIntersect(®ion, ®ion, clip); - if (free_clip) - RegionDestroy(free_clip); } DBG(("%s: src extents (%d, %d), (%d, %d) x %ld\n", __FUNCTION__, region.extents.x1, region.extents.y1, |