diff options
| author | Dave Chapman <dave@dchapman.com> | 2005-11-13 16:13:00 +0000 |
|---|---|---|
| committer | Dave Chapman <dave@dchapman.com> | 2005-11-13 16:13:00 +0000 |
| commit | b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2 (patch) | |
| tree | 13d8d2320d57fda91572aeae48214e745d1b46e6 | |
| parent | ab8d25e4012779bbb695d0d702a9430e372a5716 (diff) | |
| download | rockbox-b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2.zip rockbox-b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2.tar.gz rockbox-b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2.tar.bz2 rockbox-b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2.tar.xz | |
Implement screen_dump() function for 16-bit colour displays
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7847 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/misc.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/apps/misc.c b/apps/misc.c index 1c19c15..c29c71e 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 */ } |