summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
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));