am de27d4cb: am e5879c36: Byte swap to support BGRA in recovery mode

* commit 'de27d4cbb75a9c2f5ad0fc24edf5295d0f3d9fe0':
  Byte swap to support BGRA in recovery mode
This commit is contained in:
Heather Lee Wilson
2014-11-15 16:32:22 +00:00
committed by Android Git Automerger
+12
View File
@@ -179,6 +179,18 @@ static gr_surface fbdev_init(minui_backend* backend) {
static gr_surface fbdev_flip(minui_backend* backend __unused) { static gr_surface fbdev_flip(minui_backend* backend __unused) {
if (double_buffered) { 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, // Change gr_draw to point to the buffer currently displayed,
// then flip the driver so we're displaying the other buffer // then flip the driver so we're displaying the other buffer
// instead. // instead.