From b5d0bd024cbf7b33b67f51e712f4557488aa4d01 Mon Sep 17 00:00:00 2001 From: Carlos Silva Date: Mon, 17 Jan 2011 00:22:40 +0000 Subject: [PATCH] Add support for devices that have an upside-down mounted display. ZTE Blade is an example of this type of devices. The original patch comes from Sebastian404 -> http://goo.gl/QC37W Change-Id: Idffd97adf7da8a352617342bb6ff2161e6eac3a5 --- minui/Android.mk | 4 ++++ minui/graphics.c | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/minui/Android.mk b/minui/Android.mk index d71cea2..44f9fa1 100644 --- a/minui/Android.mk +++ b/minui/Android.mk @@ -15,6 +15,10 @@ ifneq ($(BOARD_HAS_JANKY_BACKBUFFER),) LOCAL_CFLAGS += -DBOARD_HAS_JANKY_BACKBUFFER endif +ifeq ($(BOARD_HAS_FLIPPED_SCREEN), true) + LOCAL_CFLAGS += -DBOARD_HAS_FLIPPED_SCREEN +endif + LOCAL_MODULE := libminui include $(BUILD_STATIC_LIBRARY) diff --git a/minui/graphics.c b/minui/graphics.c index 915873b..8192d3f 100644 --- a/minui/graphics.c +++ b/minui/graphics.c @@ -144,6 +144,16 @@ void gr_flip(void) /* swap front and back buffers */ gr_active_fb = (gr_active_fb + 1) & 1; +#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; + } +#endif + /* copy data from the in-memory surface to the buffer we're about * to make active. */ memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,