summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2013-02-26 16:37:53 -0800
committerMathias Agopian <mathias@google.com>2013-02-28 18:43:04 -0800
commit5219a06d61ac4517506500363c5e8a5972dd7ac9 (patch)
tree6c71799f5875b715fd182c5183aa10781de567df
parenteb0d12963d271052c24abb025d698504df9e7573 (diff)
downloadframeworks_native-5219a06d61ac4517506500363c5e8a5972dd7ac9.zip
frameworks_native-5219a06d61ac4517506500363c5e8a5972dd7ac9.tar.gz
frameworks_native-5219a06d61ac4517506500363c5e8a5972dd7ac9.tar.bz2
set correct crop rectangle in LayerBase::setCrop
The crop always had left=top=0, because the crop position and the layer's transform were merged together in computeBounds() (which really used to compute the bounds in screen space, which we usually call the "frame" elsewhere in the code) Note: in practice this crop value is not used by hwc, because it's overridden in Layer::setGeometry(), which is why this bug was never apparent. Change-Id: I1ec6400a8fc8314408e4252708f43ea98c2fe64e
-rw-r--r--services/surfaceflinger/LayerBase.cpp17
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp2
2 files changed, 11 insertions, 8 deletions
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index dfdbf30..24b122a 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -259,7 +259,7 @@ Rect LayerBase::computeBounds() const {
if (!s.active.crop.isEmpty()) {
win.intersect(s.active.crop, &win);
}
- return s.transform.transform(win);
+ return win;
}
Region LayerBase::latchBuffer(bool& recomputeVisibleRegions) {
@@ -289,13 +289,16 @@ void LayerBase::setGeometry(
HWC_BLENDING_COVERAGE);
}
- const Transform& tr = hw->getTransform();
- Rect transformedBounds(computeBounds());
- transformedBounds = tr.transform(transformedBounds);
- // scaling is already applied in transformedBounds
- layer.setFrame(transformedBounds);
- layer.setCrop(transformedBounds.getBounds());
+ Rect bounds(computeBounds());
+
+ // apply the layer's transform, followed by the display's global transform
+ // here we're guaranteed that the layer's transform preserves rects
+
+ const Transform& tr = hw->getTransform();
+ Rect frame(tr.transform(s.transform.transform(bounds)));
+ layer.setFrame(frame);
+ layer.setCrop(bounds);
}
void LayerBase::setPerFrameData(const sp<const DisplayDevice>& hw,
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index ee3e93b..bdeffdf 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1384,7 +1384,7 @@ void SurfaceFlinger::computeVisibleRegions(
// handle hidden surfaces by setting the visible region to empty
if (CC_LIKELY(layer->isVisible())) {
const bool translucent = !layer->isOpaque();
- Rect bounds(layer->computeBounds());
+ Rect bounds(s.transform.transform(layer->computeBounds()));
visibleRegion.set(bounds);
if (!visibleRegion.isEmpty()) {
// Remove the transparent area from the visible region