diff options
author | Mathias Agopian <mathias@google.com> | 2009-05-05 00:59:23 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-05-05 00:59:23 -0700 |
commit | 21c59d0070fe24a8e04e52ce04d511a924a9932f (patch) | |
tree | fb3f5f8519fce57c714dce607b12dc44aba67702 /libs | |
parent | e71212ba5397387100a578d23b15862518a7a859 (diff) | |
download | frameworks_native-21c59d0070fe24a8e04e52ce04d511a924a9932f.zip frameworks_native-21c59d0070fe24a8e04e52ce04d511a924a9932f.tar.gz frameworks_native-21c59d0070fe24a8e04e52ce04d511a924a9932f.tar.bz2 |
get rid of android_native_buffer_t::getHandle() and replace it with an handle field
this abstraction was not necessary. things are easier now.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ui/Surface.cpp | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/libs/ui/Surface.cpp b/libs/ui/Surface.cpp index 5f2138e..782eac4 100644 --- a/libs/ui/Surface.cpp +++ b/libs/ui/Surface.cpp @@ -52,18 +52,18 @@ namespace android { ANDROID_SINGLETON_STATIC_INSTANCE( SurfaceBuffer ) SurfaceBuffer::SurfaceBuffer() - : BASE(), handle(0), mOwner(false), mBufferMapper(BufferMapper::get()) + : BASE(), mOwner(false), mBufferMapper(BufferMapper::get()) { width = height = stride = format = usage = 0; - android_native_buffer_t::getHandle = getHandle; + handle = NULL; } SurfaceBuffer::SurfaceBuffer(const Parcel& data) - : BASE(), handle(0), mOwner(true), mBufferMapper(BufferMapper::get()) + : BASE(), mOwner(true), mBufferMapper(BufferMapper::get()) { // we own the handle in this case width = data.readInt32(); @@ -72,7 +72,6 @@ SurfaceBuffer::SurfaceBuffer(const Parcel& data) format = data.readInt32(); usage = data.readInt32(); handle = data.readNativeHandle(); - android_native_buffer_t::getHandle = getHandle; } SurfaceBuffer::~SurfaceBuffer() @@ -83,13 +82,6 @@ SurfaceBuffer::~SurfaceBuffer() } } -int SurfaceBuffer::getHandle(android_native_buffer_t const * base, - buffer_handle_t* handle) -{ - *handle = getSelf(base)->handle; - return 0; -} - status_t SurfaceBuffer::lock(uint32_t usage, void** vaddr) { const Rect lockBounds(width, height); @@ -112,17 +104,12 @@ status_t SurfaceBuffer::unlock() status_t SurfaceBuffer::writeToParcel(Parcel* reply, android_native_buffer_t const* buffer) { - buffer_handle_t handle; - status_t err = buffer->getHandle(buffer, &handle); - if (err < 0) { - return err; - } reply->writeInt32(buffer->width); reply->writeInt32(buffer->height); reply->writeInt32(buffer->stride); reply->writeInt32(buffer->format); reply->writeInt32(buffer->usage); - reply->writeNativeHandle(handle); + reply->writeNativeHandle(buffer->handle); return NO_ERROR; } @@ -419,7 +406,7 @@ Surface::~Surface() // its buffers in this process. for (int i=0 ; i<2 ; i++) { if (mBuffers[i] != 0) { - getBufferMapper().unregisterBuffer(mBuffers[i]->getHandle()); + getBufferMapper().unregisterBuffer(mBuffers[i]->handle); } } @@ -689,10 +676,10 @@ status_t Surface::getBufferLocked(int index) if (buffer != 0) { sp<SurfaceBuffer>& currentBuffer(mBuffers[index]); if (currentBuffer != 0) { - getBufferMapper().unregisterBuffer(currentBuffer->getHandle()); + getBufferMapper().unregisterBuffer(currentBuffer->handle); currentBuffer.clear(); } - err = getBufferMapper().registerBuffer(buffer->getHandle()); + err = getBufferMapper().registerBuffer(buffer->handle); LOGW_IF(err, "map(...) failed %d (%s)", err, strerror(-err)); if (err == NO_ERROR) { currentBuffer = buffer; |