diff options
author | Heather Lee Wilson <hwilson@google.com> | 2014-11-14 09:57:54 -0800 |
---|---|---|
committer | Heather Lee Wilson <hwilson@google.com> | 2014-11-14 12:00:18 -0800 |
commit | e5879c3639789d61803605c12371a4f291e0b3cc (patch) | |
tree | 2fc31e2931286ae9c9aba143c9273633d80a9a30 /minui | |
parent | be81e51c171a0cf9b9b5045ee949282b7f36d779 (diff) | |
download | bootable_recovery-e5879c3639789d61803605c12371a4f291e0b3cc.zip bootable_recovery-e5879c3639789d61803605c12371a4f291e0b3cc.tar.gz bootable_recovery-e5879c3639789d61803605c12371a4f291e0b3cc.tar.bz2 |
Byte swap to support BGRA in recovery mode
Fixes color palate of recovery mode when double buffer enabled.
Bug: 18169447
Change-Id: Ia50b0fb9afd8001dfd740c09ce109fa421e691f7
Diffstat (limited to 'minui')
-rw-r--r-- | minui/graphics_fbdev.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/minui/graphics_fbdev.c b/minui/graphics_fbdev.c index c0c1bcb..6df2726 100644 --- a/minui/graphics_fbdev.c +++ b/minui/graphics_fbdev.c @@ -179,6 +179,18 @@ static gr_surface fbdev_init(minui_backend* backend) { static gr_surface fbdev_flip(minui_backend* backend __unused) { if (double_buffered) { +#if defined(RECOVERY_BGRA) + // In case of BGRA, do some byte swapping + unsigned int idx; + unsigned char tmp; + unsigned char* ucfb_vaddr = (unsigned char*)gr_draw->data; + for (idx = 0 ; idx < (gr_draw->height * gr_draw->row_bytes); + idx += 4) { + tmp = ucfb_vaddr[idx]; + ucfb_vaddr[idx ] = ucfb_vaddr[idx + 2]; + ucfb_vaddr[idx + 2] = tmp; + } +#endif // Change gr_draw to point to the buffer currently displayed, // then flip the driver so we're displaying the other buffer // instead. |