summaryrefslogtreecommitdiffstats
path: root/minuitwrp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2016-02-01 17:31:59 +0100
committerEthan Yonker <dees_troy@teamw.in>2016-02-01 17:31:59 +0100
commit871b07f7b4de54c07cb895bc48f654eec771a403 (patch)
treef8d2addceeeffada6b575f8e0c6020c5c2103f43 /minuitwrp
parentBring back option to flip screen for overlay devices (diff)
downloadandroid_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.tar
android_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.tar.gz
android_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.tar.bz2
android_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.tar.lz
android_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.tar.xz
android_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.tar.zst
android_bootable_recovery-871b07f7b4de54c07cb895bc48f654eec771a403.zip
Diffstat (limited to 'minuitwrp')
-rw-r--r--minuitwrp/graphics_fbdev.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/minuitwrp/graphics_fbdev.cpp b/minuitwrp/graphics_fbdev.cpp
index e653c5a4a..5da329bf1 100644
--- a/minuitwrp/graphics_fbdev.cpp
+++ b/minuitwrp/graphics_fbdev.cpp
@@ -243,19 +243,20 @@ static GRSurface* fbdev_init(minui_backend* backend) {
}
static GRSurface* 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;
- }
+ // 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
+#ifndef BOARD_HAS_FLIPPED_SCREEN
+ if (double_buffered) {
// Copy from the in-memory surface to the framebuffer.
memcpy(gr_framebuffer[1-displayed_buffer].data, gr_draw->data,
gr_draw->height * gr_draw->row_bytes);
@@ -265,6 +266,23 @@ static GRSurface* fbdev_flip(minui_backend* backend __unused) {
memcpy(gr_framebuffer[0].data, gr_draw->data,
gr_draw->height * gr_draw->row_bytes);
}
+#else
+ int gr_active_fb = 0;
+ if (double_buffered)
+ gr_active_fb = 1-displayed_buffer;
+
+ /* flip buffer 180 degrees for devices with physicaly inverted screens */
+ unsigned int i, j;
+ for (i = 0; i < vi.yres; i++) {
+ for (j = 0; j < vi.xres; j++) {
+ memcpy(gr_framebuffer[gr_active_fb].data + (i * vi.xres_virtual + j) * gr_framebuffer[0].pixel_bytes,
+ gr_draw->data + ((vi.yres - i - 1) * vi.xres_virtual + vi.xres - j - 1) * gr_framebuffer[0].pixel_bytes,
+ gr_framebuffer[0].pixel_bytes);
+ }
+ }
+ if (double_buffered)
+ set_displayed_framebuffer(1-displayed_buffer);
+#endif
return gr_draw;
}