From 232b9fd7ed5d65f94fff22130dbd81dbb98dcae4 Mon Sep 17 00:00:00 2001 From: Hashcode Date: Wed, 3 Jul 2013 11:19:17 -0700 Subject: graphics: update BOARD_HAS_FLIPPED_SCREEN function to work with 16bpp or 32bpp Change-Id: I93391596eece6b08ecf2e54f443e9821573cb871 --- minuitwrp/graphics.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'minuitwrp') diff --git a/minuitwrp/graphics.c b/minuitwrp/graphics.c index 627e34392..fc34b6b19 100644 --- a/minuitwrp/graphics.c +++ b/minuitwrp/graphics.c @@ -259,10 +259,14 @@ void gr_flip(void) #ifdef BOARD_HAS_FLIPPED_SCREEN /* flip buffer 180 degrees for devices with physicaly inverted screens */ unsigned int i; - for (i = 1; i < (vi.xres * vi.yres); i++) { - unsigned short tmp = gr_mem_surface.data[i]; - gr_mem_surface.data[i] = gr_mem_surface.data[(vi.xres * vi.yres * 2) - i]; - gr_mem_surface.data[(vi.xres * vi.yres * 2) - i] = tmp; + unsigned int j; + uint8_t tmp; + for (i = 0; i < ((vi.xres_virtual * vi.yres)/2); i++) { + for (j = 0; j < PIXEL_SIZE; j++) { + tmp = gr_mem_surface.data[i * PIXEL_SIZE + j]; + gr_mem_surface.data[i * PIXEL_SIZE + j] = gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j]; + gr_mem_surface.data[(vi.xres_virtual * vi.yres * PIXEL_SIZE) - ((i+1) * PIXEL_SIZE) + j] = tmp; + } } #endif -- cgit v1.2.3