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
This commit is contained in:
Carlos Silva 2011-01-17 00:22:40 +00:00
parent 066a1027a4
commit b5d0bd024c
2 changed files with 14 additions and 0 deletions

View File

@ -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)

View File

@ -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,