From b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sun, 13 Nov 2005 16:13:00 +0000 Subject: Implement screen_dump() function for 16-bit colour displays git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7847 a1c6a512-1295-4272-9138-f99709370657 --- apps/misc.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/apps/misc.c b/apps/misc.c index 1c19c155d2..c29c71e69e 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -229,9 +229,6 @@ int read_line(int fd, char* buffer, int buffer_size) #elif LCD_DEPTH <= 8 #define BMP_BPP 8 #define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) -#elif LCD_DEPTH <= 16 -#define BMP_BPP 16 -#define BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3) #else #define BMP_BPP 24 #define BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3) @@ -279,15 +276,23 @@ static void (*screen_dump_hook)(int fh) = NULL; void screen_dump(void) { int fh; - int bx, by, iy; - int src_byte; char filename[MAX_PATH]; + int bx, by; +#if LCD_DEPTH < 16 + int iy; + int src_byte; +#endif #if LCD_DEPTH == 1 int ix, src_mask, dst_mask; static unsigned char line_block[8][BMP_LINESIZE]; #elif LCD_DEPTH == 2 int src_byte2; static unsigned char line_block[4][BMP_LINESIZE]; +#elif LCD_DEPTH == 16 + static unsigned char line_block[BMP_LINESIZE]; + unsigned char* dst; + unsigned short* src; + unsigned short pixel; #endif #ifdef HAVE_RTC @@ -352,6 +357,23 @@ void screen_dump(void) write(fh, &line_block[0][0], sizeof(line_block)); } +#elif LCD_DEPTH==16 + for (by = LCD_HEIGHT - 1; by >= 0; by--) + { + memset(line_block, 0, sizeof(line_block)); + src=(unsigned short*)&lcd_framebuffer[by][0]; + dst=line_block; + + for (bx = 0; bx < LCD_WIDTH; bx++) + { + pixel=swap16(*(src++)); + *(dst++)=(pixel&0x1f)<<3; /* Blue */ + *(dst++)=((pixel&0x07e0)>>5)<<2; /* Green */ + *(dst++)=((pixel&0xf800)>>11)<<3; /* Red */ + } + + write(fh, line_block, sizeof(line_block)); + } #endif /* LCD_DEPTH */ } -- cgit v1.2.3