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:18:57 +0200
commit68fa759dc468d23881b9b2521f644e4b4fb5f0c4 (patch)
treeffdb4a02385d4780a4f466fdb59d575d5a225b64 /tools
parentfc5c668f469be9860c5a92ac16dea57b3fb29534 (diff)
downloadspice-68fa759dc468d23881b9b2521f644e4b4fb5f0c4.tar.gz
spice-68fa759dc468d23881b9b2521f644e4b4fb5f0c4.tar.xz
spice-68fa759dc468d23881b9b2521f644e4b4fb5f0c4.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");