Skip to content

Commit de27d4c

Browse files
Heather Lee WilsonAndroid Git Automerger
authored andcommitted
am e5879c3: Byte swap to support BGRA in recovery mode
* commit 'e5879c3639789d61803605c12371a4f291e0b3cc': Byte swap to support BGRA in recovery mode
2 parents 2020564 + e5879c3 commit de27d4c

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)