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>
This commit is contained in:
parent
57d77b82a3
commit
2677c839bb
|
@ -41,7 +41,7 @@ int error (char * msg, FILE *fp)
|
||||||
|
|
||||||
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, x;
|
int i, x, padding;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
bitmap_t bmp;
|
bitmap_t bmp;
|
||||||
bitmap_t *b = &bmp;
|
bitmap_t *b = &bmp;
|
||||||
|
@ -138,11 +138,17 @@ int main (int argc, char *argv[])
|
||||||
printf ("};\n");
|
printf ("};\n");
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf ("unsigned char bmp_logo_bitmap[] = {\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 (i=(b->height-1)*b->width; i>=0; i-=b->width) {
|
||||||
for (x = 0; x < b->width; x++) {
|
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;
|
+ DEFAULT_CMAP_SIZE;
|
||||||
}
|
}
|
||||||
|
for (x = 0; x < padding; ++x)
|
||||||
|
/* read padding bytes if any */
|
||||||
|
fgetc(fp);
|
||||||
}
|
}
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue