diff options
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 07f9b8b..c15dfd5 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -270,6 +270,16 @@ uint32_t Layer::getContentTransform() const { return mCurrentTransform; } +static Rect reduce(const Rect& win, const Region& exclude) { + if (CC_LIKELY(exclude.isEmpty())) { + return win; + } + if (exclude.isRect()) { + return win.reduce(exclude.getBounds()); + } + return Region(win).subtract(exclude).getBounds(); +} + Rect Layer::computeBounds() const { const Layer::State& s(drawingState()); Rect win(s.active.w, s.active.h); @@ -277,8 +287,7 @@ Rect Layer::computeBounds() const { win.intersect(s.active.crop, &win); } // subtract the transparent region and snap to the bounds - win = Region(win).subtract(s.activeTransparentRegion).getBounds(); - return win; + return reduce(win, s.activeTransparentRegion); } Rect Layer::computeCrop(const sp<const DisplayDevice>& hw) const { @@ -312,6 +321,9 @@ Rect Layer::computeCrop(const sp<const DisplayDevice>& hw) const { // window's bounds activeCrop.intersect(Rect(s.active.w, s.active.h), &activeCrop); + // subtract the transparent region and snap to the bounds + activeCrop = reduce(activeCrop, s.activeTransparentRegion); + if (!activeCrop.isEmpty()) { // Transform the window crop to match the buffer coordinate system, // which means using the inverse of the current transform set on the @@ -669,7 +681,7 @@ void Layer::computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* mesh) win.intersect(s.active.crop, &win); } // subtract the transparent region and snap to the bounds - win = Region(win).subtract(s.activeTransparentRegion).getBounds(); + win = reduce(win, s.activeTransparentRegion); if (mesh) { tr.transform(mesh->mVertices[0], win.left, win.top); tr.transform(mesh->mVertices[1], win.left, win.bottom); |