Latch transform with geometry state.
WindowManager would like this feature for animating
windows between sizes. For example, if we are animating
from a smaller to larger window, we need to complete the resize
at the beginning of the animation to avoid up-scaling. However
to avoid artifacts we need the window to appear at its old size
following this resize, so we use the transform to scale down. However
as the transform is latched immediately, we result in a frame where
the window is too small, until the resize is complete. This is
a change in behavior but it's hard to understand how it could
cause errors. Previously if someone wished to set the transform
and resize a window in the same transaction, then the results
would be undefined (depending on the state of the window buffer),
and there would be no avenue for synchronization.
Bug: 26454664
Change-Id: I4e8475967e0a19aa5879af965a5716eb173f9700
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0a3534f..db03c23 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1563,7 +1563,7 @@
// compute the actual visible region
// TODO: we could cache the transformed region
const Layer::State& s(layer->getDrawingState());
- Region visibleReg = s.transform.transform(
+ Region visibleReg = s.active.transform.transform(
Region(Rect(s.active.w, s.active.h)));
invalidateLayerStack(s.layerStack, visibleReg);
}
@@ -1666,12 +1666,12 @@
// handle hidden surfaces by setting the visible region to empty
if (CC_LIKELY(layer->isVisible())) {
const bool translucent = !layer->isOpaque(s);
- Rect bounds(s.transform.transform(layer->computeBounds()));
+ Rect bounds(s.active.transform.transform(layer->computeBounds()));
visibleRegion.set(bounds);
if (!visibleRegion.isEmpty()) {
// Remove the transparent area from the visible region
if (translucent) {
- const Transform tr(s.transform);
+ const Transform tr(s.active.transform);
if (tr.transformed()) {
if (tr.preserveRects()) {
// transform the transparent region
@@ -1687,7 +1687,7 @@
}
// compute the opaque region
- const int32_t layerOrientation = s.transform.getOrientation();
+ const int32_t layerOrientation = s.active.transform.getOrientation();
if (s.alpha == 1.0f && !translucent &&
((layerOrientation & Transform::ROT_INVALID) == false)) {
// the opaque region is the layer's footprint