diff options
author | Mathias Agopian <mathias@google.com> | 2011-03-31 19:10:24 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-04-01 14:43:35 -0700 |
commit | e5a1bffd9106b1d82259de1a202e1f2f28742392 (patch) | |
tree | 5db6b7eb4b1b32395aae1950e2bcec1c6a80fd4d /libs/gui/SurfaceTextureClient.cpp | |
parent | 616fb9a38a5b558b1245b0e7f6dc0c4e5ef1a985 (diff) | |
download | frameworks_base-e5a1bffd9106b1d82259de1a202e1f2f28742392.zip frameworks_base-e5a1bffd9106b1d82259de1a202e1f2f28742392.tar.gz frameworks_base-e5a1bffd9106b1d82259de1a202e1f2f28742392.tar.bz2 |
SurfaceTexture can now force the client to request a buffer
SurfaceTexture now has the concept of default size a new method,
setDefaultBufferSize() to set it. When the default size is
changed, dequeueBuffer() will return a value telling the
client that it must ask for a new buffer.
The above only applies if the client has not
overriden the buffer size with setGeometry.
Change-Id: I520dc40363054b7e37fdb67d6a2e7bce70326e81
Diffstat (limited to 'libs/gui/SurfaceTextureClient.cpp')
-rw-r--r-- | libs/gui/SurfaceTextureClient.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index a4812d0..29fc4d3 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -25,8 +25,8 @@ namespace android { SurfaceTextureClient::SurfaceTextureClient( const sp<ISurfaceTexture>& surfaceTexture): - mSurfaceTexture(surfaceTexture), mAllocator(0), mReqWidth(1), - mReqHeight(1), mReqFormat(DEFAULT_FORMAT), mReqUsage(0), + mSurfaceTexture(surfaceTexture), mAllocator(0), mReqWidth(0), + mReqHeight(0), mReqFormat(DEFAULT_FORMAT), mReqUsage(0), mTimestamp(NATIVE_WINDOW_TIMESTAMP_AUTO), mMutex() { // Initialize the ANativeWindow function pointers. ANativeWindow::setSwapInterval = setSwapInterval; @@ -100,7 +100,8 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) { return err; } sp<GraphicBuffer>& gbuf(mSlots[buf]); - if (gbuf == 0 || gbuf->getWidth() != mReqWidth || + if (err == ISurfaceTexture::BUFFER_NEEDS_REALLOCATION || + gbuf == 0 || gbuf->getWidth() != mReqWidth || gbuf->getHeight() != mReqHeight || uint32_t(gbuf->getPixelFormat()) != mReqFormat || (gbuf->getUsage() & mReqUsage) != mReqUsage) { |