Skip to content

Commit e5879c3

Browse files
author
Heather Lee Wilson
committed
Byte swap to support BGRA in recovery mode
Fixes color palate of recovery mode when double buffer enabled. Bug: 18169447 Change-Id: Ia50b0fb9afd8001dfd740c09ce109fa421e691f7
1 parent be81e51 commit e5879c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

minui/graphics_fbdev.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,18 @@ static gr_surface fbdev_init(minui_backend* backend) {
179179

180180
static gr_surface fbdev_flip(minui_backend* backend __unused) {
181181
if (double_buffered) {
182+
#if defined(RECOVERY_BGRA)
183+
// In case of BGRA, do some byte swapping
184+
unsigned int idx;
185+
unsigned char tmp;
186+
unsigned char* ucfb_vaddr = (unsigned char*)gr_draw->data;
187+
for (idx = 0 ; idx < (gr_draw->height * gr_draw->row_bytes);
188+
idx += 4) {
189+
tmp = ucfb_vaddr[idx];
190+
ucfb_vaddr[idx ] = ucfb_vaddr[idx + 2];
191+
ucfb_vaddr[idx + 2] = tmp;
192+
}
193+
#endif
182194
// Change gr_draw to point to the buffer currently displayed,
183195
// then flip the driver so we're displaying the other buffer
184196
// instead.

0 commit comments

Comments
 (0)