summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-09-30 14:07:22 -0700
committerMathias Agopian <mathias@google.com>2009-09-30 14:07:22 -0700
commitdf3e0b934f2822ea0a334777e51e681f04a64d7c (patch)
tree188b19fa4ca3fdca0e9b56f1f712e8a5a99b2328 /libs/surfaceflinger/Layer.cpp
parent6656dbc81273424d9b4bf78c42a4e179dbe1cb71 (diff)
downloadframeworks_native-df3e0b934f2822ea0a334777e51e681f04a64d7c.zip
frameworks_native-df3e0b934f2822ea0a334777e51e681f04a64d7c.tar.gz
frameworks_native-df3e0b934f2822ea0a334777e51e681f04a64d7c.tar.bz2
fix [2152247] Windows sometimes drawn scaled up.
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r--libs/surfaceflinger/Layer.cpp38
1 files changed, 34 insertions, 4 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index 022388a..07222ec 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -342,6 +342,12 @@ uint32_t Layer::doTransaction(uint32_t flags)
}
}
+ // this will make sure LayerBase::doTransaction doesn't update
+ // the drawing state's size
+ Layer::State& editDraw(mDrawingState);
+ editDraw.requested_w = temp.requested_w;
+ editDraw.requested_h = temp.requested_h;
+
// record the new size, form this point on, when the client request a
// buffer, it'll get the new size.
setDrawingSize(temp.requested_w, temp.requested_h);
@@ -389,11 +395,35 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
const Region dirty(lcblk->getDirtyRegion(buf));
mPostedDirtyRegion = dirty.intersect( newFrontBuffer->getBounds() );
-
const Layer::State& front(drawingState());
- if (newFrontBuffer->getWidth() == front.w &&
- newFrontBuffer->getHeight() ==front.h) {
- mFreezeLock.clear();
+ if (newFrontBuffer->getWidth() == front.requested_w &&
+ newFrontBuffer->getHeight() == front.requested_h)
+ {
+ if ((front.w != front.requested_w) ||
+ (front.h != front.requested_h))
+ {
+ // Here we pretend the transaction happened by updating the
+ // current and drawing states. Drawing state is only accessed
+ // in this thread, no need to have it locked
+ Layer::State& editDraw(mDrawingState);
+ editDraw.w = editDraw.requested_w;
+ editDraw.h = editDraw.requested_h;
+
+ // We also need to update the current state so that we don't
+ // end-up doing too much work during the next transaction.
+ // NOTE: We actually don't need hold the transaction lock here
+ // because State::w and State::h are only accessed from
+ // this thread
+ Layer::State& editTemp(currentState());
+ editTemp.w = editDraw.w;
+ editTemp.h = editDraw.h;
+
+ // recompute visible region
+ recomputeVisibleRegions = true;
+
+ // we now have the correct size, unfreeze the screen
+ mFreezeLock.clear();
+ }
}
// FIXME: signal an event if we have more buffers waiting