diff options
author | Mathias Agopian <mathias@google.com> | 2009-09-29 22:39:22 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-09-29 22:44:28 -0700 |
commit | e1b6f24423d61b7892e4a59f5a65b04231526712 (patch) | |
tree | 13ee13a164bea9004a05a76a0d751cbc66b226e7 /libs/surfaceflinger | |
parent | 8851617aea7d2cd61fd8a8585bd4414a14d71653 (diff) | |
download | frameworks_base-e1b6f24423d61b7892e4a59f5a65b04231526712.zip frameworks_base-e1b6f24423d61b7892e4a59f5a65b04231526712.tar.gz frameworks_base-e1b6f24423d61b7892e4a59f5a65b04231526712.tar.bz2 |
introduce the notion of the requested size in the Layer state
Diffstat (limited to 'libs/surfaceflinger')
-rw-r--r-- | libs/surfaceflinger/Layer.cpp | 16 | ||||
-rw-r--r-- | libs/surfaceflinger/LayerBase.cpp | 30 | ||||
-rw-r--r-- | libs/surfaceflinger/LayerBase.h | 2 |
3 files changed, 29 insertions, 19 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp index 2894bf0..d59f205 100644 --- a/libs/surfaceflinger/Layer.cpp +++ b/libs/surfaceflinger/Layer.cpp @@ -294,8 +294,8 @@ sp<SurfaceBuffer> Layer::requestBuffer(int index, int usage) this, index, w, h, strerror(-err)); } else { LOGD_IF(DEBUG_RESIZE, - "Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d", - this, index, w, h); + "Layer::requestBuffer(this=%p), index=%d, w=%d, h=%d, handle=%p", + this, index, w, h, buffer->handle); } if (err == NO_ERROR && buffer->handle != 0) { @@ -318,21 +318,21 @@ uint32_t Layer::doTransaction(uint32_t flags) const Layer::State& front(drawingState()); const Layer::State& temp(currentState()); - // Index of the back buffer - const bool backbufferChanged = (front.w != temp.w) || (front.h != temp.h); - if (backbufferChanged) { + if ((front.requested_w != temp.requested_w) || + (front.requested_h != temp.requested_h)) { // the size changed, we need to ask our client to request a new buffer LOGD_IF(DEBUG_RESIZE, "resize (layer=%p), requested (%dx%d), " "drawing (%d,%d), (%dx%d), (%dx%d)", - this, int(temp.w), int(temp.h), - int(drawingState().w), int(drawingState().h), + this, + int(temp.requested_w), int(temp.requested_h), + int(front.requested_w), int(front.requested_h), int(mBuffers[0]->getWidth()), int(mBuffers[0]->getHeight()), int(mBuffers[1]->getWidth()), int(mBuffers[1]->getHeight())); // record the new size, form this point on, when the client request a // buffer, it'll get the new size. - setDrawingSize(temp.w, temp.h); + setDrawingSize(temp.requested_w, temp.requested_h); // we're being resized and there is a freeze display request, // acquire a freeze lock, so that the screen stays put diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp index 28ef27c..df1407d 100644 --- a/libs/surfaceflinger/LayerBase.cpp +++ b/libs/surfaceflinger/LayerBase.cpp @@ -83,12 +83,14 @@ void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags) if (flags & ISurfaceComposer::eNonPremultiplied) mPremultipliedAlpha = false; - mCurrentState.z = 0; - mCurrentState.w = w; - mCurrentState.h = h; - mCurrentState.alpha = 0xFF; - mCurrentState.flags = layerFlags; - mCurrentState.sequence = 0; + mCurrentState.z = 0; + mCurrentState.w = w; + mCurrentState.h = h; + mCurrentState.requested_w = w; + mCurrentState.requested_h = h; + mCurrentState.alpha = 0xFF; + mCurrentState.flags = layerFlags; + mCurrentState.sequence = 0; mCurrentState.transform.set(0, 0); // drawing state & current state are identical @@ -132,10 +134,10 @@ bool LayerBase::setLayer(uint32_t z) { return true; } bool LayerBase::setSize(uint32_t w, uint32_t h) { - if (mCurrentState.w == w && mCurrentState.h == h) + if (mCurrentState.requested_w == w && mCurrentState.requested_h == h) return false; - mCurrentState.w = w; - mCurrentState.h = h; + mCurrentState.requested_w = w; + mCurrentState.requested_h = h; requestTransaction(); return true; } @@ -192,13 +194,19 @@ uint32_t LayerBase::doTransaction(uint32_t flags) const Layer::State& front(drawingState()); const Layer::State& temp(currentState()); + if ((front.requested_w != temp.requested_w) || + (front.requested_h != temp.requested_h)) { + // resize the layer, set the physical size to the requested size + Layer::State& editTemp(currentState()); + editTemp.w = temp.requested_w; + editTemp.h = temp.requested_h; + } + if (temp.sequence != front.sequence) { // invalidate and recompute the visible regions if needed flags |= eVisibleRegion; this->contentDirty = true; - } - if (temp.sequence != front.sequence) { const bool linearFiltering = mUseLinearFiltering; mUseLinearFiltering = false; if (!(mFlags & DisplayHardware::SLOW_CONFIG)) { diff --git a/libs/surfaceflinger/LayerBase.h b/libs/surfaceflinger/LayerBase.h index b3b838e..16ee542 100644 --- a/libs/surfaceflinger/LayerBase.h +++ b/libs/surfaceflinger/LayerBase.h @@ -88,6 +88,8 @@ public: struct State { uint32_t w; uint32_t h; + uint32_t requested_w; + uint32_t requested_h; uint32_t z; uint8_t alpha; uint8_t flags; |