97,12 → 97,12 |
/* Conversion routines between different color representations */ |
static void rgb_4byte(void *dst, int rgb) |
{ |
*(int *)dst = rgb; |
*((int *) dst) = rgb; |
} |
|
static int byte4_rgb(void *src) |
{ |
return (*(int *)src) & 0xffffff; |
return (*((int *) src)) & 0xffffff; |
} |
|
static void rgb_3byte(void *dst, int rgb) |
133,7 → 133,7 |
static void rgb_2byte(void *dst, int rgb) |
{ |
/* 5-bit, 6-bits, 5-bits */ |
*((uint16_t *)(dst)) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); |
*((uint16_t *) dst) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5); |
} |
|
/** 16-bit depth (5:6:5) */ |
153,7 → 153,7 |
*/ |
static void rgb_1byte(void *dst, int rgb) |
{ |
*(uint8_t *)dst = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
*((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3); |
} |
|
/** Return pixel color - 8-bit depth (color palette/3:2:3) |
409,15 → 409,8 |
sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors); |
|
/* Allocate double buffer */ |
int totsize = scanline * yres; |
int pages = SIZE2FRAMES(totsize); |
int order; |
if (pages == 1) |
order = 0; |
else |
order = fnzb(pages - 1) + 1; |
|
dbbuffer = frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
unsigned int order = fnzb(SIZE2FRAMES(ALIGN_UP(fbsize, FRAME_SIZE))) + 1; |
dbbuffer = (uint8_t * ) frame_alloc(order, FRAME_ATOMIC | FRAME_KA); |
if (!dbbuffer) |
printf("Failed to allocate scroll buffer.\n"); |
dboffset = 0; |
426,11 → 419,9 |
blankline = (uint8_t *) malloc(ROW_BYTES, FRAME_ATOMIC); |
if (!blankline) |
panic("Failed to allocate blank line for framebuffer."); |
for (y=0; y < FONT_SCANLINES; y++) { |
for (x=0; x < xres; x++) { |
for (y = 0; y < FONT_SCANLINES; y++) |
for (x = 0; x < xres; x++) |
(*rgb2scr)(&blankline[POINTPOS(x,y)], COLOR(BGCOLOR)); |
} |
} |
|
clear_screen(); |
|
442,7 → 433,6 |
|
chardev_initialize("fb", &framebuffer, &fb_ops); |
stdout = &framebuffer; |
|
} |
|
/** @} |