diff options
author | Mathias Agopian <mathias@google.com> | 2009-09-30 14:07:22 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-09-30 14:07:22 -0700 |
commit | bd23e30de410761af8c68afd8c4b27990e7a099a (patch) | |
tree | e895c2ed7e53b1a8dd636212f1aeb8128aff7f9f /libs/surfaceflinger | |
parent | 70cab91229c3c2ca4bb75ab63b552ac7d1a6a8bb (diff) | |
download | frameworks_base-bd23e30de410761af8c68afd8c4b27990e7a099a.zip frameworks_base-bd23e30de410761af8c68afd8c4b27990e7a099a.tar.gz frameworks_base-bd23e30de410761af8c68afd8c4b27990e7a099a.tar.bz2 |
fix [2152247] Windows sometimes drawn scaled up.
Diffstat (limited to 'libs/surfaceflinger')
-rw-r--r-- | libs/surfaceflinger/Layer.cpp | 38 |
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 |