From c362f8473b606912f538d670af2d0560f702a0ee Mon Sep 17 00:00:00 2001 From: Yaniv Kamay Date: Mon, 4 Jan 2010 21:13:03 +0200 Subject: client: use spice icon instead-of solidice icon --- tools/icon_to_c.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/icon_to_c.c b/tools/icon_to_c.c index 0d37ca9f..6fd96fd0 100644 --- a/tools/icon_to_c.c +++ b/tools/icon_to_c.c @@ -33,6 +33,8 @@ #define ERROR(str) printf("%s: error: %s\n", prog_name, str); exit(-1); +#define ALIGN(a, b) (((a) + ((b) - 1)) & ~((b) - 1)) + static char *prog_name = NULL; static size_t read_input(const char *file_name, uint8_t** out_buf) @@ -153,11 +155,20 @@ static Icon *init_icon(uint8_t *buf, size_t buf_size) if (bitmap->header_size != 40) { ERROR("invalid bitmap header"); } + + if (ico->plans == 0) { // 0 and 1 are equivalent + ico->plans = 1; + } + if (bitmap->width != ico->width || bitmap->height != ico->height * 2 || - bitmap->plans != ico->plans || bitmap->bpp != ico->bpp || !bitmap->image_size) { + bitmap->plans != ico->plans || bitmap->bpp != ico->bpp) { ERROR("invalid bitmap header"); } + if (!bitmap->image_size) { + bitmap->image_size = ALIGN(bitmap->bpp * bitmap->width, 32) / 8 * bitmap->height; + } + if (bitmap->compression || bitmap->horizontal_resolution || bitmap->vertical_resolution || bitmap->num_colors || bitmap->important_colors) { ERROR("invalid bitmap header"); -- cgit