summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2014-10-03 21:03:11 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-03 21:03:11 +0000
commitfb992b7753d73f4f18ef7aa1c8e3df5c09e6efbd (patch)
treee377b343356b52c0d439202038e95813e0510fed /services/surfaceflinger
parent498f8526783fd72e8561a037faf2d30e6f9da4d5 (diff)
parent6c925ede620f4080227bb1fe8a41e4b4502348f8 (diff)
downloadframeworks_native-fb992b7753d73f4f18ef7aa1c8e3df5c09e6efbd.zip
frameworks_native-fb992b7753d73f4f18ef7aa1c8e3df5c09e6efbd.tar.gz
frameworks_native-fb992b7753d73f4f18ef7aa1c8e3df5c09e6efbd.tar.bz2
am 6c925ede: Fixed discrepancy between crop and frame transparencies.
* commit '6c925ede620f4080227bb1fe8a41e4b4502348f8': Fixed discrepancy between crop and frame transparencies.
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/Layer.cpp24
-rw-r--r--services/surfaceflinger/Layer.h1
2 files changed, 23 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index fa07656..f6ad503 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -278,12 +278,17 @@ static Rect reduce(const Rect& win, const Region& exclude) {
Rect Layer::computeBounds() const {
const Layer::State& s(getDrawingState());
+ return computeBounds(s.activeTransparentRegion);
+}
+
+Rect Layer::computeBounds(const Region& activeTransparentRegion) const {
+ const Layer::State& s(getDrawingState());
Rect win(s.active.w, s.active.h);
if (!s.active.crop.isEmpty()) {
win.intersect(s.active.crop, &win);
}
// subtract the transparent region and snap to the bounds
- return reduce(win, s.activeTransparentRegion);
+ return reduce(win, activeTransparentRegion);
}
FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const {
@@ -405,7 +410,22 @@ void Layer::setGeometry(
// apply the layer's transform, followed by the display's global transform
// here we're guaranteed that the layer's transform preserves rects
- Rect frame(s.transform.transform(computeBounds()));
+ Region activeTransparentRegion(s.activeTransparentRegion);
+ if (!s.active.crop.isEmpty()) {
+ Rect activeCrop(s.active.crop);
+ activeCrop = s.transform.transform(activeCrop);
+ activeCrop.intersect(hw->getViewport(), &activeCrop);
+ activeCrop = s.transform.inverse().transform(activeCrop);
+ // mark regions outside the crop as transparent
+ activeTransparentRegion.orSelf(Rect(0, 0, s.active.w, activeCrop.top));
+ activeTransparentRegion.orSelf(Rect(0, activeCrop.bottom,
+ s.active.w, s.active.h));
+ activeTransparentRegion.orSelf(Rect(0, activeCrop.top,
+ activeCrop.left, activeCrop.bottom));
+ activeTransparentRegion.orSelf(Rect(activeCrop.right, activeCrop.top,
+ s.active.w, activeCrop.bottom));
+ }
+ Rect frame(s.transform.transform(computeBounds(activeTransparentRegion)));
frame.intersect(hw->getViewport(), &frame);
const Transform& tr(hw->getTransform());
layer.setFrame(tr.transform(frame));
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index f0fe58a..1f8eff0 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -142,6 +142,7 @@ public:
void computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh,
bool useIdentityTransform) const;
+ Rect computeBounds(const Region& activeTransparentRegion) const;
Rect computeBounds() const;
sp<IBinder> getHandle();