summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2009-02-09 00:32:59 +0000
committerJens Arnold <amiconn@rockbox.org>2009-02-09 00:32:59 +0000
commit0d935ce75e1408dfd9832ae7dbb7d84df50a645d (patch)
tree9ddcc5d21dcd0e576d0fa824e74c58755fa9d1a0 /apps/misc.c
parent94537f954e67d44fdd9703c062c4ee53599e0e74 (diff)
downloadrockbox-0d935ce75e1408dfd9832ae7dbb7d84df50a645d.tar.gz
rockbox-0d935ce75e1408dfd9832ae7dbb7d84df50a645d.zip
Put the display colours for monochrome and greyscale targets into the target config files, and use them both for the simulator UI and screendumps. The Clip now shows the split display properly in screendumps and simulator. A side effect is that screendumps of ordinary monochrome targets are now 4-bit BMP files (saves an alternate code path, and might be more compatible with some gfx programs). * Simplify the simulation of split display, and also simplify greylib simulation. The simulator now always calculates 129 shades (2*128 for a Clip sim), and just uses 2 (or 4) of those for native display simulation. * Centralised the simulator LCD dimension definition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19950 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c84
1 files changed, 46 insertions, 38 deletions
diff --git a/apps/misc.c b/apps/misc.c
index 6e871acd3b..43dfd45e51 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -344,19 +344,20 @@ int fast_readline(int fd, char *buf, int buf_size, void *parameters,
344#if LCD_DEPTH == 16 344#if LCD_DEPTH == 16
345#define BMP_COMPRESSION 3 /* BI_BITFIELDS */ 345#define BMP_COMPRESSION 3 /* BI_BITFIELDS */
346#define BMP_NUMCOLORS 3 346#define BMP_NUMCOLORS 3
347#else 347#else /* LCD_DEPTH != 16 */
348#define BMP_COMPRESSION 0 /* BI_RGB */ 348#define BMP_COMPRESSION 0 /* BI_RGB */
349#if LCD_DEPTH <= 8 349#if LCD_DEPTH <= 8
350#define BMP_NUMCOLORS (1 << LCD_DEPTH) 350#ifdef HAVE_LCD_SPLIT
351#define BMP_NUMCOLORS (2 << LCD_DEPTH)
351#else 352#else
352#define BMP_NUMCOLORS 0 353#define BMP_NUMCOLORS (1 << LCD_DEPTH)
353#endif
354#endif 354#endif
355#else /* LCD_DEPTH > 8 */
356#define BMP_NUMCOLORS 0
357#endif /* LCD_DEPTH > 8 */
358#endif /* LCD_DEPTH != 16 */
355 359
356#if LCD_DEPTH == 1 360#if LCD_DEPTH <= 4
357#define BMP_BPP 1
358#define BMP_LINESIZE ((LCD_WIDTH/8 + 3) & ~3)
359#elif LCD_DEPTH <= 4
360#define BMP_BPP 4 361#define BMP_BPP 4
361#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3) 362#define BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3)
362#elif LCD_DEPTH <= 8 363#elif LCD_DEPTH <= 8
@@ -386,7 +387,7 @@ static const unsigned char bmpheader[] =
386 387
387 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */ 388 0x28, 0x00, 0x00, 0x00, /* Size of (2nd) header */
388 LE32_CONST(LCD_WIDTH), /* Width in pixels */ 389 LE32_CONST(LCD_WIDTH), /* Width in pixels */
389 LE32_CONST(LCD_HEIGHT), /* Height in pixels */ 390 LE32_CONST(LCD_HEIGHT+LCD_SPLIT_LINES), /* Height in pixels */
390 0x01, 0x00, /* Number of planes (always 1) */ 391 0x01, 0x00, /* Number of planes (always 1) */
391 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */ 392 LE16_CONST(BMP_BPP), /* Bits per pixel 1/4/8/16/24 */
392 LE32_CONST(BMP_COMPRESSION),/* Compression mode */ 393 LE32_CONST(BMP_COMPRESSION),/* Compression mode */
@@ -397,22 +398,26 @@ static const unsigned char bmpheader[] =
397 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */ 398 LE32_CONST(BMP_NUMCOLORS), /* Number of important colours */
398 399
399#if LCD_DEPTH == 1 400#if LCD_DEPTH == 1
400#ifdef MROBE_100 401#ifdef HAVE_NEGATIVE_LCD
401 2, 2, 94, 0x00, /* Colour #0 */ 402 BMP_COLOR(LCD_BL_DARKCOLOR),
402 3, 6, 241, 0x00 /* Colour #1 */ 403 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
403#else 404#ifdef HAVE_LCD_SPLIT
404 0x90, 0xee, 0x90, 0x00, /* Colour #0 */ 405 BMP_COLOR(LCD_BL_DARKCOLOR_2),
405 0x00, 0x00, 0x00, 0x00 /* Colour #1 */ 406 BMP_COLOR(LCD_BL_BRIGHTCOLOR_2),
406#endif 407#endif
408#else /* positive display */
409 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
410 BMP_COLOR(LCD_BL_DARKCOLOR),
411#endif /* positive display */
407#elif LCD_DEPTH == 2 412#elif LCD_DEPTH == 2
408 0xe6, 0xd8, 0xad, 0x00, /* Colour #0 */ 413 BMP_COLOR(LCD_BL_BRIGHTCOLOR),
409 0x99, 0x90, 0x73, 0x00, /* Colour #1 */ 414 BMP_COLOR_MIX(LCD_BL_BRIGHTCOLOR, LCD_BL_DARKCOLOR, 1, 3),
410 0x4c, 0x48, 0x39, 0x00, /* Colour #2 */ 415 BMP_COLOR_MIX(LCD_BL_BRIGHTCOLOR, LCD_BL_DARKCOLOR, 2, 3),
411 0x00, 0x00, 0x00, 0x00 /* Colour #3 */ 416 BMP_COLOR(LCD_BL_DARKCOLOR),
412#elif LCD_DEPTH == 16 417#elif LCD_DEPTH == 16
413 0x00, 0xf8, 0x00, 0x00, /* red bitfield mask */ 418 0x00, 0xf8, 0x00, 0x00, /* red bitfield mask */
414 0xe0, 0x07, 0x00, 0x00, /* green bitfield mask */ 419 0xe0, 0x07, 0x00, 0x00, /* green bitfield mask */
415 0x1f, 0x00, 0x00, 0x00 /* blue bitfield mask */ 420 0x1f, 0x00, 0x00, 0x00, /* blue bitfield mask */
416#endif 421#endif
417}; 422};
418 423
@@ -461,30 +466,33 @@ void screen_dump(void)
461 for (by = LCD_FBHEIGHT - 1; by >= 0; by--) 466 for (by = LCD_FBHEIGHT - 1; by >= 0; by--)
462 { 467 {
463 unsigned char *src = &lcd_framebuffer[by][0]; 468 unsigned char *src = &lcd_framebuffer[by][0];
464 unsigned char *dst = &line_block[0][0]; 469 unsigned char *dst = &line_block[7][0];
465 470
466 memset(line_block, 0, sizeof(line_block)); 471 memset(line_block, 0, sizeof(line_block));
467 for (bx = LCD_WIDTH/8; bx > 0; bx--) 472
473#ifdef HAVE_LCD_SPLIT
474 if (by == (LCD_SPLIT_POS/8 - 1))
475 write(fh, line_block, LCD_SPLIT_LINES * sizeof(line_block[0]));
476#endif
477 for (bx = LCD_WIDTH/2; bx > 0; bx--)
468 { 478 {
469 unsigned dst_mask = 0x80; 479 unsigned char *dst_blk = dst++;
470 int ix; 480 unsigned src_byte0 = *src++ << 4;
481 unsigned src_byte1 = *src++;
482 int iy;
471 483
472 for (ix = 8; ix > 0; ix--) 484 for (iy = 8; iy > 0; iy--)
473 { 485 {
474 unsigned char *dst_blk = dst; 486 *dst_blk = (src_byte0 & 0x10)
475 unsigned src_byte = *src++; 487 | (src_byte1 & 0x01)
476 int iy; 488#ifdef HAVE_LCD_SPLIT
477 489 | (by < (LCD_SPLIT_POS/8) ? 0x22 : 0)
478 for (iy = 8; iy > 0; iy--) 490#endif
479 { 491 ;
480 if (src_byte & 0x80) 492 src_byte0 >>= 1;
481 *dst_blk |= dst_mask; 493 src_byte1 >>= 1;
482 src_byte <<= 1; 494 dst_blk -= BMP_LINESIZE;
483 dst_blk += BMP_LINESIZE;
484 }
485 dst_mask >>= 1;
486 } 495 }
487 dst++;
488 } 496 }
489 497
490 write(fh, line_block, sizeof(line_block)); 498 write(fh, line_block, sizeof(line_block));