void gui_display_pic(void *pic, size_t len) { if (info_bitmap.data) { free(info_bitmap.data); info_bitmap.data = NULL; info_bitmap.data_len = 0; } if (NULL == pic) { return; } printk("Allocating %d bytes for pic\n", len); info_bitmap.data = malloc(len); printk("Allocated pointer %p\n", info_bitmap.data); if (info_bitmap.data) { printk("Copying pic data\n"); info_bitmap.data_len = bmp_parse(info_bitmap.data, pic, len, &info_bitmap.height, &info_bitmap.width); /* info_bitmap.width = 80; */ /* info_bitmap.height = 80; */ /* info_bitmap.data_len = 80; */ printk("Parsed width %d, height %d\n", info_bitmap.width, info_bitmap.height); } }
static int bmp_parse_hdr(IMAGE_GENERIC_DESCR_T *pImg) { int rc = 0; BMP_FILE_T bmp; memset(&bmp, 0, sizeof(bmp)); bmp.pBuf = pImg->bs.buf; bmp.bufLen = pImg->bs.sz; if((rc = bmp_parse(&bmp)) == 0) { pImg->width = bmp.width; pImg->height = bmp.height; } return rc; }