summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYaniv Kamay <ykamay@redhat.com>2010-01-04 21:13:03 +0200
committerYaniv Kamay <ykamay@redhat.com>2010-01-04 21:13:03 +0200
commitc362f8473b606912f538d670af2d0560f702a0ee (patch)
tree307c343064bdf8bae0a5f274dd3d136a2d72282f /tools
parentd42620a3659e347db36ebb90b927c22d587cd024 (diff)
downloadspice-c362f8473b606912f538d670af2d0560f702a0ee.tar.gz
spice-c362f8473b606912f538d670af2d0560f702a0ee.tar.xz
spice-c362f8473b606912f538d670af2d0560f702a0ee.zip
client: use spice icon instead-of solidice icon
Diffstat (limited to 'tools')
-rw-r--r--tools/icon_to_c.c13
1 files changed, 12 insertions, 1 deletions
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");