diff options
author | Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com> | 2010-12-03 17:30:03 +0100 |
---|---|---|
committer | Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com> | 2011-02-17 07:08:18 +0100 |
commit | 2677c839bb3cfb28a19467b3dcea08d1ea067644 (patch) | |
tree | 4bad943ca8150ea099272ada239c21acdcc455bc | |
parent | 57d77b82a3c4fda2bf5a06b8c5d7127795153486 (diff) |
u-boot: BMP_LOGO tool fixes
This patch fixes two issues:
* width of bitmap has to be aligned to 4 (otherwise padding bytes
will be added and bitmap will be not properly displayed)
* size of bitmap can't be bigger than 65535 (LCD on Sciphone G2
is 240x320 = 76800)
Signed-off-by: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com>
-rw-r--r-- | tools/bmp_logo.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c index 47228d255..c222d7ac1 100644 --- a/tools/bmp_logo.c +++ b/tools/bmp_logo.c @@ -41,7 +41,7 @@ int error (char * msg, FILE *fp) int main (int argc, char *argv[]) { - int i, x; + int i, x, padding; FILE *fp; bitmap_t bmp; bitmap_t *b = &bmp; @@ -138,11 +138,17 @@ int main (int argc, char *argv[]) printf ("};\n"); printf ("\n"); printf ("unsigned char bmp_logo_bitmap[] = {\n"); + /* check if there will be any padding bytes in bitmap */ + padding = (b->width % 4) ? (4 - (b->width % 4)) : 0; + for (i=(b->height-1)*b->width; i>=0; i-=b->width) { for (x = 0; x < b->width; x++) { - b->data[(uint16_t) i + x] = (uint8_t) fgetc (fp) \ + b->data[i + x] = (uint8_t) fgetc (fp) \ + DEFAULT_CMAP_SIZE; } + for (x = 0; x < padding; ++x) + /* read padding bytes if any */ + fgetc(fp); } fclose (fp); |