From f50b075a8b88eff482628e8ab62a04539117c7ea Mon Sep 17 00:00:00 2001 From: Vishal Bhoj Date: Thu, 15 Sep 2011 21:46:50 +0400 Subject: Botao's code change to fix inverted colors Change-Id: I19f4db0fedd1f1e4aeeab60e06320877bb9e7dee --- modules/gralloc/framebuffer.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp index 9d7709d4..b4e5bf04 100644 --- a/modules/gralloc/framebuffer.cpp +++ b/modules/gralloc/framebuffer.cpp @@ -354,9 +354,15 @@ int fb_device_open(hw_module_t const* module, const char* name, status = mapFrameBuffer(m); if (status >= 0) { int stride = m->finfo.line_length / (m->info.bits_per_pixel >> 3); - int format = (m->info.bits_per_pixel == 32) - ? HAL_PIXEL_FORMAT_RGBX_8888 - : HAL_PIXEL_FORMAT_RGB_565; + // int format = (m->info.bits_per_pixel == 32); + int format; + if (m->info.bits_per_pixel == 32) + if (m->info.red.offset == 0) + format = HAL_PIXEL_FORMAT_RGBX_8888; + else + format = HAL_PIXEL_FORMAT_BGRA_8888; + else + format = HAL_PIXEL_FORMAT_RGB_565; #ifdef NO_32BPP format = HAL_PIXEL_FORMAT_RGB_565; #endif -- cgit v1.2.3