From 8c789753008408f05983b33c6df836cce842f40b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 19 Aug 2002 08:04:48 +0000 Subject: [PATCH] made it output valid C code even if given a filename that starts with a dot, also made the width and height get written as proper #defines in the output C source. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1795 a1c6a512-1295-4272-9138-f99709370657 --- tools/bmp2rb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/bmp2rb.c b/tools/bmp2rb.c index 5eec2cbdb7..5674e4a477 100644 --- a/tools/bmp2rb.c +++ b/tools/bmp2rb.c @@ -140,7 +140,6 @@ int read_bmp_file(char* filename, close(fd); return 3; } - debugf("Bitmap is %d pixels wide\n", readlong(fh.Width)); /* Exit if too high */ if(readlong(fh.Height) > 64) @@ -150,7 +149,6 @@ int read_bmp_file(char* filename, close(fd); return 4; } - debugf("Bitmap is %d pixels heigh\n", readlong(fh.Height)); for(l=0;l < 2;l++) { @@ -243,7 +241,14 @@ void generate_c_source(char *id, int width, int height, unsigned char *bitmap) f = stdout; - fprintf(f, "\nconst unsigned char %s[] = {\n", id); + if(!id || !id[0]) + id = "bitmap"; + + fprintf(f, + "#define BMPHEIGHT_%s %d" + "\n#define BMPWIDTH_%s %d" + "\nconst unsigned char %s[] = {\n", + id, height, id, width, id ); for(i=0, eline=0; i< height; i+=8, eline++) { for (a=0; a