From 55e6e7dc4fc364677a24832f031031bda3b1c8dc Mon Sep 17 00:00:00 2001 From: codeworkx Date: Mon, 18 Jul 2011 16:42:57 -0700 Subject: [PATCH] graphics.c: revert RGB8888 support Change-Id: Id2a4c8055c2bc82120871293235cf98c7c5b50e6 --- minui/graphics.c | 54 +++++++++++------------------------------------- 1 file changed, 12 insertions(+), 42 deletions(-) diff --git a/minui/graphics.c b/minui/graphics.c index 6e4f436..1334e42 100644 --- a/minui/graphics.c +++ b/minui/graphics.c @@ -28,7 +28,6 @@ #include #include -#include #ifndef BOARD_LDPI_RECOVERY #include "font_10x18.h" @@ -94,11 +93,11 @@ static int get_framebuffer(GGLSurface *fb) #ifdef BOARD_HAS_JANKY_BACKBUFFER fb->stride = fi.line_length/2; #else - fb->stride = vi.xres_virtual; + fb->stride = vi.xres; #endif fb->data = bits; fb->format = GGL_PIXEL_FORMAT_RGB_565; - memset(fb->data, 0, vi.yres * vi.xres_virtual * vi.bits_per_pixel / 8); + memset(fb->data, 0, vi.yres * vi.xres * 2); fb++; @@ -109,11 +108,11 @@ static int get_framebuffer(GGLSurface *fb) fb->stride = fi.line_length/2; fb->data = (void*) (((unsigned) bits) + vi.yres * fi.line_length); #else - fb->stride = vi.xres_virtual; - fb->data = (void*) (((unsigned) bits) + (vi.yres * vi.xres_virtual * vi.bits_per_pixel / 8)); + fb->stride = vi.xres; + fb->data = (void*) (((unsigned) bits) + vi.yres * vi.xres * 2); #endif fb->format = GGL_PIXEL_FORMAT_RGB_565; - memset(fb->data, 0, vi.yres * vi.xres_virtual * vi.bits_per_pixel / 8); + memset(fb->data, 0, vi.yres * vi.xres * 2); return fd; } @@ -122,8 +121,8 @@ static void get_memory_surface(GGLSurface* ms) { ms->version = sizeof(*ms); ms->width = vi.xres; ms->height = vi.yres; - ms->stride = vi.xres_virtual; - ms->data = malloc(vi.xres_virtual * vi.yres * vi.bits_per_pixel / 8); + ms->stride = vi.xres; + ms->data = malloc(vi.xres * vi.yres * 2); ms->format = GGL_PIXEL_FORMAT_RGB_565; } @@ -132,33 +131,12 @@ static void set_active_framebuffer(unsigned n) if (n > 1) return; vi.yres_virtual = vi.yres * 2; vi.yoffset = n * vi.yres; + vi.bits_per_pixel = 16; if (ioctl(gr_fb_fd, FBIOPUT_VSCREENINFO, &vi) < 0) { perror("active fb swap failed"); } } -void gr_flip_32(unsigned *bits, unsigned short *ptr, unsigned count) -{ - unsigned i=0; - while (i> 11) & 0x1F); - red = (rgb32 << 3) | (rgb32 >> 2); - rgb32 = ((ptr[i] >> 5) & 0x3F); - green = (rgb32 << 2) | (rgb32 >> 4); - rgb32 = ((ptr[i]) & 0x1F); - blue = (rgb32 << 3) | (rgb32 >> 2); - alpha = 0xff; - rgb32 = (alpha << 24) | (blue << 16) - | (green << 8) | (red); - android_memset32((uint32_t *)bits, rgb32, 4); - i++; - bits++; - } -} - void gr_flip(void) { GGLContext *gl = gr_context; @@ -177,18 +155,9 @@ void gr_flip(void) #endif /* copy data from the in-memory surface to the buffer we're about - * to make active. */ - if(vi.bits_per_pixel == 32) - { - gr_flip_32((unsigned *)gr_framebuffer[gr_active_fb].data, \ - (unsigned short *)gr_mem_surface.data, - (vi.xres_virtual * vi.yres)); - } - else - { - memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, - vi.xres_virtual * vi.yres *2); - } + * to make active. */ + memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data, + vi.xres * vi.yres * 2); /* inform the display driver */ set_active_framebuffer(gr_active_fb); @@ -367,3 +336,4 @@ gr_pixel *gr_fb_data(void) { return (unsigned short *) gr_mem_surface.data; } +