5 static void *
gfx_imagecreate(
int width,
int height,
unsigned int color,
int depth,
int flags,
int usenewheader)
9 int size, pitch, header_size = 4;
12 if ((!
__fb_gfx) || (width <= 0) || (height <= 0)) {
19 if ((bpp != 1) && (bpp != 2) && (bpp != 4)) {
29 case 1: color = 0;
break;
36 color = ((color & 0xF8) >> 3) | ((color & 0xFC00) >> 5) | ((color & 0xF80000) >> 8);
42 pitch = (pitch + 0xF) & ~0xF;
44 size = pitch * height;
47 int p_size = (
sizeof(
void *) + 0xF) & 0xF;
48 void *tmp = malloc(size + header_size + p_size + 0xF);
54 image = (
PUT_HEADER *)(((intptr_t)tmp + p_size + 0xF) & ~0xF);
55 ((
void **)image)[-1] = tmp;
60 image->old.width = width;
61 image->old.height = height;
67 image->height = height;
69 fb_hMemSet(image->_reserved, 0,
sizeof(image->_reserved));
73 context->
pixel_set((
unsigned char *)image + header_size, color, (pitch * height) / bpp);
91 if( image ==
NULL )
return;
92 free(((
void **)image)[-1]);