diff options
Diffstat (limited to 'tools/bmp2rb.c')
-rw-r--r-- | tools/bmp2rb.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/tools/bmp2rb.c b/tools/bmp2rb.c index 2a7dcdee92..24ea1a8026 100644 --- a/tools/bmp2rb.c +++ b/tools/bmp2rb.c | |||
@@ -491,14 +491,6 @@ void generate_c_source(char *id, char* header_dir, int width, int height, | |||
491 | bool have_header = header_dir && header_dir[0]; | 491 | bool have_header = header_dir && header_dir[0]; |
492 | create_bm = have_header && create_bm; | 492 | create_bm = have_header && create_bm; |
493 | 493 | ||
494 | if (t_depth > 16) | ||
495 | { | ||
496 | fprintf(stderr, "Generating C source not supported for this format\n"); | ||
497 | fprintf(stderr, "because Rockbox does not support this display depth yet.\n"); | ||
498 | fprintf(stderr, "However you are welcome to fix this!\n"); | ||
499 | return; | ||
500 | } | ||
501 | |||
502 | if (!id || !id[0]) | 494 | if (!id || !id[0]) |
503 | id = "bitmap"; | 495 | id = "bitmap"; |
504 | 496 | ||
@@ -520,8 +512,11 @@ void generate_c_source(char *id, char* header_dir, int width, int height, | |||
520 | id, height, id, width); | 512 | id, height, id, width); |
521 | if (t_depth <= 8) | 513 | if (t_depth <= 8) |
522 | fprintf(fh, "extern const unsigned char %s[];\n", id); | 514 | fprintf(fh, "extern const unsigned char %s[];\n", id); |
523 | else | 515 | else if (t_depth <= 16) |
524 | fprintf(fh, "extern const unsigned short %s[];\n", id); | 516 | fprintf(fh, "extern const unsigned short %s[];\n", id); |
517 | else | ||
518 | fprintf(fh, "extern const fb_data %s[];\n", id); | ||
519 | |||
525 | 520 | ||
526 | if (create_bm) | 521 | if (create_bm) |
527 | { | 522 | { |
@@ -542,8 +537,10 @@ void generate_c_source(char *id, char* header_dir, int width, int height, | |||
542 | 537 | ||
543 | if (t_depth <= 8) | 538 | if (t_depth <= 8) |
544 | fprintf(f, "const unsigned char %s[] = {\n", id); | 539 | fprintf(f, "const unsigned char %s[] = {\n", id); |
545 | else | 540 | else if (t_depth == 16) |
546 | fprintf(f, "const unsigned short %s[] = {\n", id); | 541 | fprintf(f, "const unsigned short %s[] = {\n", id); |
542 | else if (t_depth == 24) | ||
543 | fprintf(f, "const fb_data %s[] = {\n", id); | ||
547 | 544 | ||
548 | for (i = 0; i < t_height; i++) | 545 | for (i = 0; i < t_height; i++) |
549 | { | 546 | { |
@@ -555,6 +552,12 @@ void generate_c_source(char *id, char* header_dir, int width, int height, | |||
555 | else if (t_depth == 16) | 552 | else if (t_depth == 16) |
556 | fprintf(f, "0x%04x,%c", t_bitmap->d16[i * t_width + a], | 553 | fprintf(f, "0x%04x,%c", t_bitmap->d16[i * t_width + a], |
557 | (a + 1) % 10 ? ' ' : '\n'); | 554 | (a + 1) % 10 ? ' ' : '\n'); |
555 | else if (t_depth == 24) | ||
556 | fprintf(f, "{ .r = 0x%02x, .g = 0x%02x, .b = 0x%02x },%c", | ||
557 | t_bitmap->d24[i * t_width + a].r, | ||
558 | t_bitmap->d24[i * t_width + a].g, | ||
559 | t_bitmap->d24[i * t_width + a].b, | ||
560 | (a + 1) % 4 ? ' ' : '\n'); | ||
558 | } | 561 | } |
559 | fprintf(f, "\n"); | 562 | fprintf(f, "\n"); |
560 | } | 563 | } |
@@ -651,7 +654,7 @@ void print_usage(void) | |||
651 | "\t 6 Greyscale iPod 4-grey\n" | 654 | "\t 6 Greyscale iPod 4-grey\n" |
652 | "\t 7 Greyscale X5 remote 4-grey\n" | 655 | "\t 7 Greyscale X5 remote 4-grey\n" |
653 | "\t 8 16-bit packed 5-6-5 RGB with a vertical stride\n" | 656 | "\t 8 16-bit packed 5-6-5 RGB with a vertical stride\n" |
654 | "\t 9 24-bit BGR (raw only for now)\n"); | 657 | "\t 9 24-bit BGR\n"); |
655 | printf("build date: " __DATE__ "\n\n"); | 658 | printf("build date: " __DATE__ "\n\n"); |
656 | } | 659 | } |
657 | 660 | ||