summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2005-11-13 16:13:00 +0000
committerDave Chapman <dave@dchapman.com>2005-11-13 16:13:00 +0000
commitb27ecbd629aa5a08d830340ab59a7efd6bdb9ce2 (patch)
tree13d8d2320d57fda91572aeae48214e745d1b46e6
parentab8d25e4012779bbb695d0d702a9430e372a5716 (diff)
downloadrockbox-b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2.tar.gz
rockbox-b27ecbd629aa5a08d830340ab59a7efd6bdb9ce2.zip
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.c32
1 files 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)
229#elif LCD_DEPTH <= 8 229#elif LCD_DEPTH <= 8
230#define BMP_BPP 8 230#define BMP_BPP 8
231#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3) 231#define BMP_LINESIZE ((LCD_WIDTH + 3) & ~3)
232#elif LCD_DEPTH <= 16
233#define BMP_BPP 16
234#define BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3)
235#else 232#else
236#define BMP_BPP 24 233#define BMP_BPP 24
237#define BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3) 234#define BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3)
@@ -279,15 +276,23 @@ static void (*screen_dump_hook)(int fh) = NULL;
279void screen_dump(void) 276void screen_dump(void)
280{ 277{
281 int fh; 278 int fh;
282 int bx, by, iy;
283 int src_byte;
284 char filename[MAX_PATH]; 279 char filename[MAX_PATH];
280 int bx, by;
281#if LCD_DEPTH < 16
282 int iy;
283 int src_byte;
284#endif
285#if LCD_DEPTH == 1 285#if LCD_DEPTH == 1
286 int ix, src_mask, dst_mask; 286 int ix, src_mask, dst_mask;
287 static unsigned char line_block[8][BMP_LINESIZE]; 287 static unsigned char line_block[8][BMP_LINESIZE];
288#elif LCD_DEPTH == 2 288#elif LCD_DEPTH == 2
289 int src_byte2; 289 int src_byte2;
290 static unsigned char line_block[4][BMP_LINESIZE]; 290 static unsigned char line_block[4][BMP_LINESIZE];
291#elif LCD_DEPTH == 16
292 static unsigned char line_block[BMP_LINESIZE];
293 unsigned char* dst;
294 unsigned short* src;
295 unsigned short pixel;
291#endif 296#endif
292 297
293#ifdef HAVE_RTC 298#ifdef HAVE_RTC
@@ -352,6 +357,23 @@ void screen_dump(void)
352 357
353 write(fh, &line_block[0][0], sizeof(line_block)); 358 write(fh, &line_block[0][0], sizeof(line_block));
354 } 359 }
360#elif LCD_DEPTH==16
361 for (by = LCD_HEIGHT - 1; by >= 0; by--)
362 {
363 memset(line_block, 0, sizeof(line_block));
364 src=(unsigned short*)&lcd_framebuffer[by][0];
365 dst=line_block;
366
367 for (bx = 0; bx < LCD_WIDTH; bx++)
368 {
369 pixel=swap16(*(src++));
370 *(dst++)=(pixel&0x1f)<<3; /* Blue */
371 *(dst++)=((pixel&0x07e0)>>5)<<2; /* Green */
372 *(dst++)=((pixel&0xf800)>>11)<<3; /* Red */
373 }
374
375 write(fh, line_block, sizeof(line_block));
376 }
355#endif /* LCD_DEPTH */ 377#endif /* LCD_DEPTH */
356 } 378 }
357 379