summaryrefslogtreecommitdiffstats
path: root/minuitwrp
diff options
context:
space:
mode:
authorthat <github@that.at>2016-02-09 01:42:08 +0100
committerDees Troy <dees_troy@teamw.in>2016-02-19 04:03:01 +0100
commit506fc803bfdb452192d1b70a7a319bd5119dbf08 (patch)
tree190cc62ed18eae96a7680262c8c58f2b56879305 /minuitwrp
parenttwrp: Add support for TW_SECONDARY_BRIGHTNESS_PATH (diff)
downloadandroid_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.tar
android_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.tar.gz
android_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.tar.bz2
android_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.tar.lz
android_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.tar.xz
android_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.tar.zst
android_bootable_recovery-506fc803bfdb452192d1b70a7a319bd5119dbf08.zip
Diffstat (limited to 'minuitwrp')
-rw-r--r--minuitwrp/graphics_fbdev.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/minuitwrp/graphics_fbdev.cpp b/minuitwrp/graphics_fbdev.cpp
index dc2bb2fdc..afc4151c9 100644
--- a/minuitwrp/graphics_fbdev.cpp
+++ b/minuitwrp/graphics_fbdev.cpp
@@ -282,15 +282,24 @@ static GRSurface* fbdev_flip(minui_backend* backend __unused) {
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);
+ /* flip buffer 180 degrees for devices with physically inverted screens */
+ unsigned int row_pixels = gr_draw->row_bytes / gr_framebuffer[0].pixel_bytes;
+ if (gr_framebuffer[0].pixel_bytes == 4) {
+ for (unsigned int y = 0; y < gr_draw->height; ++y) {
+ uint32_t* dst = reinterpret_cast<uint32_t*>(gr_framebuffer[gr_active_fb].data) + y * row_pixels;
+ uint32_t* src = reinterpret_cast<uint32_t*>(gr_draw->data) + (gr_draw->height - y - 1) * row_pixels + gr_draw->width;
+ for (unsigned int x = 0; x < gr_draw->width; ++x)
+ *(dst++) = *(--src);
+ }
+ } else {
+ for (unsigned int y = 0; y < gr_draw->height; ++y) {
+ uint16_t* dst = reinterpret_cast<uint16_t*>(gr_framebuffer[gr_active_fb].data) + y * row_pixels;
+ uint16_t* src = reinterpret_cast<uint16_t*>(gr_draw->data) + (gr_draw->height - y - 1) * row_pixels + gr_draw->width;
+ for (unsigned int x = 0; x < gr_draw->width; ++x)
+ *(dst++) = *(--src);
}
}
+
if (double_buffered)
set_displayed_framebuffer(1-displayed_buffer);
#endif