summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-08-20 21:41:07 -0700
committerMathias Agopian <mathias@google.com>2013-08-20 21:46:45 -0700
commit0e8f1443b87f9009159cef6394de48894f98f826 (patch)
tree182527e8cdd24dab9319b7d58c0bf2a1c598348f /services
parent4f4f0943489d9113c66ac22b58cfba8c21dfa879 (diff)
downloadframeworks_native-0e8f1443b87f9009159cef6394de48894f98f826.zip
frameworks_native-0e8f1443b87f9009159cef6394de48894f98f826.tar.gz
frameworks_native-0e8f1443b87f9009159cef6394de48894f98f826.tar.bz2
Fix a bug where non-cropped layer could be scaled incorrectly
If a layer is not cropped but its bounds are outside of the viewport (i.e.: clipped), the crop rectangle passed to hw composer would be invalid because it started invalid in the first place (to indicate "no crop"). Bug: 10410944 Change-Id: I4ae4d49a1adef0be7fa4304ecf84b1a5b7d03fe0
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/Layer.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 7150fa1..d88f6d0 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -287,7 +287,13 @@ FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const {
// pixels in the buffer.
// FIXME: the 3 lines below can produce slightly incorrect clipping when we have
// a viewport clipping and a window transform. we should use floating point to fix this.
- Rect activeCrop(s.transform.transform(s.active.crop));
+
+ Rect activeCrop(s.active.w, s.active.h);
+ if (!s.active.crop.isEmpty()) {
+ activeCrop = s.active.crop;
+ }
+
+ activeCrop = s.transform.transform(activeCrop);
activeCrop.intersect(hw->getViewport(), &activeCrop);
activeCrop = s.transform.inverse().transform(activeCrop);