diff options
author | Mathias Agopian <mathias@google.com> | 2010-02-12 18:50:28 -0800 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-02-12 18:50:28 -0800 |
commit | c9e4a125464b389454619432cbdbcb2d9b11995a (patch) | |
tree | 53e02445736e4c5be44cc088b9957ab1c0588abd /libs/surfaceflinger/LayerBuffer.cpp | |
parent | 053c9e928bc8aa569572aea97430a63cb8fdc109 (diff) | |
download | frameworks_native-c9e4a125464b389454619432cbdbcb2d9b11995a.zip frameworks_native-c9e4a125464b389454619432cbdbcb2d9b11995a.tar.gz frameworks_native-c9e4a125464b389454619432cbdbcb2d9b11995a.tar.bz2 |
minor cleanup.
Diffstat (limited to 'libs/surfaceflinger/LayerBuffer.cpp')
-rw-r--r-- | libs/surfaceflinger/LayerBuffer.cpp | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp index bd3113b..6d1685b 100644 --- a/libs/surfaceflinger/LayerBuffer.cpp +++ b/libs/surfaceflinger/LayerBuffer.cpp @@ -472,10 +472,12 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const // First, try to use the buffer as an EGLImage directly if (mUseEGLImageDirectly) { // NOTE: Assume the buffer is allocated with the proper USAGE flags + sp<GraphicBuffer> buffer = new GraphicBuffer( src.img.w, src.img.h, src.img.format, GraphicBuffer::USAGE_HW_TEXTURE, src.img.w, src.img.handle, false); + err = mLayer.initializeEglImage(buffer, &mTexture); if (err != NO_ERROR) { mUseEGLImageDirectly = false; @@ -563,33 +565,27 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const } // Allocate a temporary buffer and create the corresponding EGLImageKHR - - status_t err; - mTempGraphicBuffer.clear(); - mTempGraphicBuffer = new GraphicBuffer( + // once the EGLImage has been created we don't need the + // graphic buffer reference anymore. + sp<GraphicBuffer> buffer = new GraphicBuffer( w, h, HAL_PIXEL_FORMAT_RGB_565, GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_HW_2D); - err = mTempGraphicBuffer->initCheck(); + status_t err = buffer->initCheck(); if (err == NO_ERROR) { NativeBuffer& dst(mTempBuffer); - dst.img.w = mTempGraphicBuffer->getStride(); + dst.img.w = buffer->getStride(); dst.img.h = h; - dst.img.format = mTempGraphicBuffer->getPixelFormat(); - dst.img.handle = (native_handle_t *)mTempGraphicBuffer->handle; + dst.img.format = buffer->getPixelFormat(); + dst.img.handle = (native_handle_t *)buffer->handle; dst.img.base = 0; dst.crop.l = 0; dst.crop.t = 0; dst.crop.r = w; dst.crop.b = h; - err = mLayer.initializeEglImage( - mTempGraphicBuffer, &mTexture); - // once the EGLImage has been created (whether it fails - // or not) we don't need the graphic buffer reference - // anymore. - mTempGraphicBuffer.clear(); + err = mLayer.initializeEglImage(buffer, &mTexture); } return err; @@ -606,9 +602,6 @@ void LayerBuffer::BufferSource::clearTempBufferImage() const Texture defaultTexture; mTexture = defaultTexture; mTexture.name = mLayer.createTexture(); - - // and the associated buffer - mTempGraphicBuffer.clear(); } // --------------------------------------------------------------------------- |