summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-06-07 14:18:55 -0700
committerMathias Agopian <mathias@google.com>2012-06-07 17:12:20 -0700
commit0cd545f14261d829513e0d6e8fa5e4e4f3372b3d (patch)
treef215784f7b8e7031dfba053cc790da94751434de
parentba43e0a1faee9629ca2d0beb53dd6c44bb9bfd05 (diff)
downloadnative-0cd545f14261d829513e0d6e8fa5e4e4f3372b3d.tar.gz
sometimes we would incorrectly scale the content of a surface
this would happen when a resize was pending (ie: we have received and processed a resize transaction but have not received a buffer with the right size) and a new transaction came in that didn't involve a resize, for instance a translate-only transaction. in this case, we would incorrectly update the drawing state with the pending size, eventhough we still don't have a buffer for it. the solution is quite simple, we never allow the size to propagate from current to drawing state during the regular transaction processing (unless we are in fixed-size mode -- meaning we don't need to have a matching size buffer), this propagation happens later once we receive the buffer. Bug: 6624163 Change-Id: I11a97e4b88a7f3a0571ddcfe99c86cb04ce01a4d
-rw-r--r--services/surfaceflinger/Layer.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 593f1781ae..40623404d4 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -469,18 +469,31 @@ uint32_t Layer::doTransaction(uint32_t flags)
front.requested.crop.getWidth(),
front.requested.crop.getHeight());
- if (!isFixedSize()) {
- // this will make sure LayerBase::doTransaction doesn't update
- // the drawing state's geometry
- flags |= eDontUpdateGeometryState;
- }
-
// record the new size, form this point on, when the client request
// a buffer, it'll get the new size.
mSurfaceTexture->setDefaultBufferSize(
temp.requested.w, temp.requested.h);
}
+ if (!isFixedSize()) {
+
+ const bool resizePending = (temp.requested.w != temp.active.w) ||
+ (temp.requested.h != temp.active.h);
+
+ if (resizePending) {
+ // don't let LayerBase::doTransaction update the drawing state
+ // if we have a pending resize, unless we are in fixed-size mode.
+ // the drawing state will be updated only once we receive a buffer
+ // with the correct size.
+ //
+ // in particular, we want to make sure the clip (which is part
+ // of the geometry state) is latched together with the size but is
+ // latched immediately when no resizing is involved.
+
+ flags |= eDontUpdateGeometryState;
+ }
+ }
+
return LayerBase::doTransaction(flags);
}