Skip to content

Instantly share code, notes, and snippets.

@psyke83
Created July 9, 2011 23:34
Show Gist options
  • Save psyke83/1074056 to your computer and use it in GitHub Desktop.
Save psyke83/1074056 to your computer and use it in GitHub Desktop.
diff -urdN -x .git /extra/git/koush/android_bootable_recovery//minui/graphics.c bootable/recovery//minui/graphics.c
--- /extra/git/koush/android_bootable_recovery//minui/graphics.c 2011-07-09 23:39:10.549892000 +0100
+++ bootable/recovery//minui/graphics.c 2011-07-10 00:34:18.934872001 +0100
@@ -56,11 +56,11 @@
static int gr_vt_fd = -1;
static struct fb_var_screeninfo vi;
+static struct fb_fix_screeninfo fi;
static int get_framebuffer(GGLSurface *fb)
{
int fd;
- struct fb_fix_screeninfo fi;
void *bits;
fd = open("/dev/graphics/fb0", O_RDWR);
@@ -94,11 +94,11 @@
#ifdef BOARD_HAS_JANKY_BACKBUFFER
fb->stride = fi.line_length/2;
#else
- fb->stride = vi.xres_virtual;
+ fb->stride = fi.line_length / (vi.bits_per_pixel / 8);
#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 +109,11 @@
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 = fi.line_length / (vi.bits_per_pixel / 8);
+ fb->data = (void*) (((unsigned) bits) + (vi.yres * fi.line_length));
#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 +122,8 @@
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 = fi.line_length / (vi.bits_per_pixel / 8);
+ ms->data = malloc(fi.line_length * vi.yres);
ms->format = GGL_PIXEL_FORMAT_RGB_565;
}
@@ -181,13 +181,13 @@
if( vi.bits_per_pixel == 16)
{
memcpy(gr_framebuffer[gr_active_fb].data, gr_mem_surface.data,
- vi.xres_virtual * vi.yres *2);
+ fi.line_length * vi.yres);
}
else
{
gr_flip_32((unsigned *)gr_framebuffer[gr_active_fb].data, \
- (unsigned short *)gr_mem_surface.data,
- (vi.xres_virtual * vi.yres));
+ (unsigned short *)gr_mem_surface.data, \
+ ((fi.line_length / (vi.bits_per_pixel / 8)) * vi.yres));
}
/* inform the display driver */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment