summaryrefslogtreecommitdiff
path: root/tools/bmp2rb.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-06-18 07:15:00 +0200
committerThomas Martitz <kugel@rockbox.org>2014-06-21 00:15:53 +0200
commita1842c04f9cb73210d4cacde61a9e4b115050765 (patch)
treea37af61ef9285b763a42cd33797e2f3d634fbf9f /tools/bmp2rb.c
parent0250be1d6799db7b5ddc99cb33f31bf9cff01ed2 (diff)
downloadrockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.tar.gz
rockbox-a1842c04f9cb73210d4cacde61a9e4b115050765.zip
lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS can display from our 24bit framebuffer. It is not yet as performance optimized as the existing drivers but should be good enough.The vast number of small changes is due to the fact that fb_data can be a struct type now, while most of the code expected a scalar type. lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit it enforces the generic C code. All plugins are ported over. Except for rockpaint. It uses so much memory that it wouldnt fit into the 512k plugin buffer anymore (patches welcome). Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
Diffstat (limited to 'tools/bmp2rb.c')
-rw-r--r--tools/bmp2rb.c25
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