diff options
author | Mathias Agopian <mathias@google.com> | 2010-04-12 15:34:55 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2010-06-01 15:57:44 -0700 |
commit | 49753266d2219d2fbf5c33dc4626f299dffcdd76 (patch) | |
tree | a85071eb34a5dbf792ad54f2dcbf62b76e461d12 /libs/ui/GraphicBuffer.cpp | |
parent | 5220f483382d314b38e24a4520080eae63005eb7 (diff) | |
download | frameworks_native-49753266d2219d2fbf5c33dc4626f299dffcdd76.zip frameworks_native-49753266d2219d2fbf5c33dc4626f299dffcdd76.tar.gz frameworks_native-49753266d2219d2fbf5c33dc4626f299dffcdd76.tar.bz2 |
fix a bug where fading in/out of opaque 32-bits windows wasn't working
opaque 32-bits windows are now allocated as RGBX_8888 buffers and
SurfaceFlinger always uses GL_MODULATE instead of trying to
optimize to GL_REPLACE when possible (makes no sense on
h/w accelerated GL).
we still have a small hack for devices that don't support
RGBX_8888 in their gralloc implementation where we revert to
RGBA_8888.
Diffstat (limited to 'libs/ui/GraphicBuffer.cpp')
-rw-r--r-- | libs/ui/GraphicBuffer.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp index ba1fd9c..35e4af3 100644 --- a/libs/ui/GraphicBuffer.cpp +++ b/libs/ui/GraphicBuffer.cpp @@ -122,11 +122,20 @@ status_t GraphicBuffer::reallocate(uint32_t w, uint32_t h, PixelFormat f, status_t GraphicBuffer::initSize(uint32_t w, uint32_t h, PixelFormat format, uint32_t reqUsage) { - if (format == PIXEL_FORMAT_RGBX_8888) - format = PIXEL_FORMAT_RGBA_8888; - GraphicBufferAllocator& allocator = GraphicBufferAllocator::get(); status_t err = allocator.alloc(w, h, format, reqUsage, &handle, &stride); + + if (err<0 && format == PIXEL_FORMAT_RGBX_8888) { + /* + * There is currently a bug with some gralloc implementations + * not supporting RGBX_8888. In this case, we revert to using RGBA_8888 + * which is not exactly the same, as GL_REPLACE will yield a different + * result. + */ + format = PIXEL_FORMAT_RGBA_8888; + err = allocator.alloc(w, h, format, reqUsage, &handle, &stride); + } + if (err == NO_ERROR) { this->width = w; this->height = h; |