From 97c602c5af5f3ffd69009bf496d86347b71a2b4c Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 19 Jul 2011 15:24:46 -0700 Subject: implement: "Add an ANativeWindow API for SurfaceFlinger to suggest an optimal buffer orientation" Bug: 4487161 Change-Id: I883f34efe542c2a566d04966f873374f40c50092 --- services/surfaceflinger/Layer.cpp | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index c29aecab96..e0268fa061 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -44,10 +44,6 @@ namespace android { -template inline T min(T a, T b) { - return a newFrontBuffer(mActiveBuffer); - if ((newFrontBuffer->getWidth() == front.requested_w && - newFrontBuffer->getHeight() == front.requested_h) || - isFixedSize()) + + if ((front.w != front.requested_w) || + (front.h != front.requested_h)) { - if ((front.w != front.requested_w) || - (front.h != front.requested_h)) + // check that we received a buffer of the right size + // (Take the buffer's orientation into account) + sp newFrontBuffer(mActiveBuffer); + uint32_t bufWidth = newFrontBuffer->getWidth(); + uint32_t bufHeight = newFrontBuffer->getHeight(); + if (mCurrentTransform & Transform::ROT_90) { + swap(bufWidth, bufHeight); + } + + if (isFixedSize() || + (bufWidth == front.requested_w && + bufHeight == front.requested_h)) { // Here we pretend the transaction happened by updating the // current and drawing states. Drawing state is only accessed @@ -483,10 +488,10 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions) // recompute visible region recomputeVisibleRegions = true; - } - // we now have the correct size, unfreeze the screen - mFreezeLock.clear(); + // we now have the correct size, unfreeze the screen + mFreezeLock.clear(); + } } } } -- cgit v1.2.3-59-g8ed1b