summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger_client
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-05-17 17:27:26 -0700
committerMathias Agopian <mathias@google.com>2010-05-17 17:27:26 -0700
commitcd30f4f849bb215509bd2645726048271b5db01e (patch)
tree6182174b30879d9bbee5532faa2b098b9c81715c /libs/surfaceflinger_client
parentc5859388bd6c666a83017869bf8a9935defe0bd0 (diff)
downloadframeworks_base-cd30f4f849bb215509bd2645726048271b5db01e.zip
frameworks_base-cd30f4f849bb215509bd2645726048271b5db01e.tar.gz
frameworks_base-cd30f4f849bb215509bd2645726048271b5db01e.tar.bz2
fix some bugs in SharedBufferStack::resize
added buffers should now be labeled properly. Change-Id: I28aa753fbe89ab89134e7753575319478934c7fa
Diffstat (limited to 'libs/surfaceflinger_client')
-rw-r--r--libs/surfaceflinger_client/SharedBufferStack.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/surfaceflinger_client/SharedBufferStack.cpp b/libs/surfaceflinger_client/SharedBufferStack.cpp
index 4a98026..5705748 100644
--- a/libs/surfaceflinger_client/SharedBufferStack.cpp
+++ b/libs/surfaceflinger_client/SharedBufferStack.cpp
@@ -560,6 +560,7 @@ status_t SharedBufferServer::resize(int newNumBuffers)
int base = numBuffers;
int32_t avail = stack.available;
int tail = head - avail + 1;
+
if (tail >= 0) {
int8_t* const index = const_cast<int8_t*>(stack.index);
const int nb = numBuffers - head;
@@ -573,8 +574,9 @@ status_t SharedBufferServer::resize(int newNumBuffers)
// fill the new free space with unused buffers
BufferList::const_iterator curr(mBufferList.free_begin());
for (int i=0 ; i<extra ; i++) {
- stack.index[base+i] = *curr++;
- mBufferList.add(stack.index[base+i]);
+ stack.index[base+i] = *curr;
+ mBufferList.add(*curr);
+ ++curr;
}
mNumBuffers = newNumBuffers;