diff options
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 1297363..cd24478 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -858,11 +858,13 @@ status_t Layer::BufferManager::resize(size_t size, Mutex::Autolock _l(mLock); if (size < mNumBuffers) { - // Move the active texture into slot 0 - BufferData activeBufferData = mBufferData[mActiveBufferIndex]; - mBufferData[mActiveBufferIndex] = mBufferData[0]; - mBufferData[0] = activeBufferData; - mActiveBufferIndex = 0; + // If there is an active texture, move it into slot 0 if needed + if (mActiveBufferIndex > 0) { + BufferData activeBufferData = mBufferData[mActiveBufferIndex]; + mBufferData[mActiveBufferIndex] = mBufferData[0]; + mBufferData[0] = activeBufferData; + mActiveBufferIndex = 0; + } // Free the buffers that are no longer needed. for (size_t i = size; i < mNumBuffers; i++) { |