diff options
author | Doug Zongker <dougz@android.com> | 2011-01-14 01:43:44 +0100 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2011-01-14 01:43:44 +0100 |
commit | be3e6f13b810046fb1981b21d9e6f0715ae67a22 (patch) | |
tree | c3514c0893473c531446ffbcff27a1a8578655ce /minui | |
parent | Update make_ext4fs arguments in roots.c (diff) | |
download | android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.tar android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.tar.gz android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.tar.bz2 android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.tar.lz android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.tar.xz android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.tar.zst android_bootable_recovery-be3e6f13b810046fb1981b21d9e6f0715ae67a22.zip |
Diffstat (limited to 'minui')
-rw-r--r-- | minui/Android.mk | 4 | ||||
-rw-r--r-- | minui/graphics.c | 28 |
2 files changed, 22 insertions, 10 deletions
diff --git a/minui/Android.mk b/minui/Android.mk index 91dd939f6..7ded5d3d0 100644 --- a/minui/Android.mk +++ b/minui/Android.mk @@ -9,4 +9,8 @@ LOCAL_C_INCLUDES +=\ LOCAL_MODULE := libminui +ifneq ($(RECOVERY_24_BIT),) + LOCAL_CFLAGS += -DRECOVERY_24_BIT +endif + include $(BUILD_STATIC_LIBRARY) diff --git a/minui/graphics.c b/minui/graphics.c index 4127c400a..42c85e777 100644 --- a/minui/graphics.c +++ b/minui/graphics.c @@ -32,6 +32,14 @@ #include "font_10x18.h" #include "minui.h" +#ifdef RECOVERY_24_BIT +#define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGBX_8888 +#define PIXEL_SIZE 4 +#else +#define PIXEL_FORMAT GGL_PIXEL_FORMAT_RGB_565 +#define PIXEL_SIZE 2 +#endif + typedef struct { GGLSurface texture; unsigned cwidth; @@ -87,8 +95,8 @@ static int get_framebuffer(GGLSurface *fb) fb->height = vi.yres; fb->stride = vi.xres; fb->data = bits; - fb->format = GGL_PIXEL_FORMAT_RGB_565; - memset(fb->data, 0, vi.yres * vi.xres * 2); + fb->format = PIXEL_FORMAT; + memset(fb->data, 0, vi.yres * vi.xres * PIXEL_SIZE); fb++; @@ -96,9 +104,9 @@ static int get_framebuffer(GGLSurface *fb) fb->width = vi.xres; fb->height = vi.yres; fb->stride = vi.xres; - fb->data = (void*) (((unsigned) bits) + vi.yres * vi.xres * 2); - fb->format = GGL_PIXEL_FORMAT_RGB_565; - memset(fb->data, 0, vi.yres * vi.xres * 2); + fb->data = (void*) (((unsigned) bits) + vi.yres * vi.xres * PIXEL_SIZE); + fb->format = PIXEL_FORMAT; + memset(fb->data, 0, vi.yres * vi.xres * PIXEL_SIZE); return fd; } @@ -108,16 +116,16 @@ static void get_memory_surface(GGLSurface* ms) { ms->width = vi.xres; ms->height = vi.yres; ms->stride = vi.xres; - ms->data = malloc(vi.xres * vi.yres * 2); - ms->format = GGL_PIXEL_FORMAT_RGB_565; + ms->data = malloc(vi.xres * vi.yres * PIXEL_SIZE); + ms->format = PIXEL_FORMAT; } static void set_active_framebuffer(unsigned n) { if (n > 1) return; - vi.yres_virtual = vi.yres * 2; + vi.yres_virtual = vi.yres * PIXEL_SIZE; vi.yoffset = n * vi.yres; - vi.bits_per_pixel = 16; + vi.bits_per_pixel = PIXEL_SIZE * 8; if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) { perror("active fb swap failed"); } @@ -133,7 +141,7 @@ void gr_flip(void) /* 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, - vi.xres * vi.yres * 2); + vi.xres * vi.yres * PIXEL_SIZE); /* inform the display driver */ set_active_framebuffer(gr_active_fb); |