summaryrefslogtreecommitdiff
path: root/apps/misc.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-10-01 10:20:55 +0000
committerJens Arnold <amiconn@rockbox.org>2005-10-01 10:20:55 +0000
commit05042affc76ec42481bcddba4a3f94a7b77ec98d (patch)
treefc1f73129fbe09b3e2022828c717ba7eb9507603 /apps/misc.c
parentf0fe3c94772ddf971810e5082dcfb9b0ac462ae4 (diff)
downloadrockbox-05042affc76ec42481bcddba4a3f94a7b77ec98d.zip
rockbox-05042affc76ec42481bcddba4a3f94a7b77ec98d.tar.gz
rockbox-05042affc76ec42481bcddba4a3f94a7b77ec98d.tar.bz2
rockbox-05042affc76ec42481bcddba4a3f94a7b77ec98d.tar.xz
Core: A graphics framework can now register a hook function to extend the core screendump routine. * Grayscale library: (1) Changed the screendump routine into a hook, and implemented it for H1x0. (2) The planar pixel setting routines now use one register less. Fixes build problem with developer builds (frame pointers enabled) on coldfire.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7574 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/misc.c')
-rw-r--r--apps/misc.c84
1 files changed, 50 insertions, 34 deletions
diff --git a/apps/misc.c b/apps/misc.c
index d1b5c22..1c19c15 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -274,6 +274,8 @@ static const unsigned char bmpheader[] =
#endif
};
+static void (*screen_dump_hook)(int fh) = NULL;
+
void screen_dump(void)
{
int fh;
@@ -298,56 +300,70 @@ void screen_dump(void)
if (fh < 0)
return;
- write(fh, bmpheader, sizeof(bmpheader));
-
- /* BMP image goes bottom up */
-#if LCD_DEPTH == 1
- for (by = LCD_HEIGHT/8 - 1; by >= 0; by--)
+ if (screen_dump_hook)
{
- memset(&line_block[0][0], 0, sizeof(line_block));
+ screen_dump_hook(fh);
+ }
+ else
+ {
+ write(fh, bmpheader, sizeof(bmpheader));
- for (bx = 0; bx < LCD_WIDTH/8; bx++)
+ /* BMP image goes bottom up */
+#if LCD_DEPTH == 1
+ for (by = LCD_HEIGHT/8 - 1; by >= 0; by--)
{
- dst_mask = 0x01;
- for (ix = 7; ix >= 0; ix--)
+ memset(&line_block[0][0], 0, sizeof(line_block));
+
+ for (bx = 0; bx < LCD_WIDTH/8; bx++)
{
- src_byte = lcd_framebuffer[by][8*bx+ix];
- src_mask = 0x01;
- for (iy = 7; iy >= 0; iy--)
+ dst_mask = 0x01;
+ for (ix = 7; ix >= 0; ix--)
{
- if (src_byte & src_mask)
- line_block[iy][bx] |= dst_mask;
- src_mask <<= 1;
+ src_byte = lcd_framebuffer[by][8*bx+ix];
+ src_mask = 0x01;
+ for (iy = 7; iy >= 0; iy--)
+ {
+ if (src_byte & src_mask)
+ line_block[iy][bx] |= dst_mask;
+ src_mask <<= 1;
+ }
+ dst_mask <<= 1;
}
- dst_mask <<= 1;
}
+
+ write(fh, &line_block[0][0], sizeof(line_block));
}
-
- write(fh, &line_block[0][0], sizeof(line_block));
- }
#elif LCD_DEPTH == 2
- for (by = LCD_HEIGHT/4 - 1; by >= 0; by--)
- {
- memset(&line_block[0][0], 0, sizeof(line_block));
-
- for (bx = 0; bx < LCD_WIDTH/2; bx++)
+ for (by = LCD_HEIGHT/4 - 1; by >= 0; by--)
{
- src_byte = lcd_framebuffer[by][2*bx];
- src_byte2 = lcd_framebuffer[by][2*bx+1];
- for (iy = 3; iy >= 0; iy--)
+ memset(&line_block[0][0], 0, sizeof(line_block));
+
+ for (bx = 0; bx < LCD_WIDTH/2; bx++)
{
- line_block[iy][bx] = ((src_byte & 3) << 4) | (src_byte2 & 3);
- src_byte >>= 2;
- src_byte2 >>= 2;
+ src_byte = lcd_framebuffer[by][2*bx];
+ src_byte2 = lcd_framebuffer[by][2*bx+1];
+ for (iy = 3; iy >= 0; iy--)
+ {
+ line_block[iy][bx] = ((src_byte & 3) << 4) | (src_byte2 & 3);
+ src_byte >>= 2;
+ src_byte2 >>= 2;
+ }
}
- }
- write(fh, &line_block[0][0], sizeof(line_block));
+ write(fh, &line_block[0][0], sizeof(line_block));
+ }
+#endif /* LCD_DEPTH */
}
-#endif
+
close(fh);
}
-#endif
+
+void screen_dump_set_hook(void (*hook)(int fh))
+{
+ screen_dump_hook = hook;
+}
+
+#endif /* HAVE_LCD_BITMAP */
/* parse a line from a configuration file. the line format is: