: 2) Moving the #ifs into the bitmap SOURCES file simplifies the code a
: lot, but currently the sizes of the bitmaps still need to be defined in
: the C file itself - the size isn't taken from the output from bmp2rb.
: I've ignored this for now.
Its been awhile since I've reviewed much Rockbox code, but IMO
now would be a good time to solve this issue the correct way:
a rockbox bitmap needs to be a structure, not just an unknown
length array of unsigned char. The bmp2rb tool outputs a filled-in
bitmap structure header. Then, the lcd_bitmap() et al routines
take the address of the structure, rather than #defined values of
width, height for every bitmap. The type of bitmap is also included.
I'm thinking of something like the following:
struct bitmap { /* rb internal bitmap format*/
uchar bpp; /* bitmap type*/
uchar width, height;
uchar pitch; /* bytes per line, including pad*/
uchar *bits; /* image bits - size is height*pitch */
};
If the bmp2rb routine always created the bitmaps converted to
the desired bpp for the target, then the lcd_bitmap routine
wouldn't need to inspect the header bpp field. The bpp field
could become part of the structure name. See how convbdf -c
works for more details on naming. This would then allow all
bitmaps to be stored simultaneously in a library.
Regards,
Greg