Android: When the backlight goes off, the RockboxFramebuffer/View isn't made invisibl...
[maemo-rb.git] / firmware / export / screendump.h
blob484bc4dc7a0373fcf56c310bc211451327b45ad8
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 by Jens Arnold
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef __SCREENDUMP_H__
23 #define __SCREENDUMP_H__
25 #include "config.h"
27 /* Make BMP colour map entries from R, G, B triples, without and with blending.
28 * Not within HAVE_LCD_BITMAP because it is also used for the Player sim */
29 #define RED_CMP(c) (((c) >> 16) & 0xff)
30 #define GREEN_CMP(c) (((c) >> 8) & 0xff)
31 #define BLUE_CMP(c) ((c) & 0xff)
33 #define BMP_COLOR(c) BLUE_CMP(c), GREEN_CMP(c), RED_CMP(c), 0
34 #define BMP_COLOR_MIX(c1, c2, num, den) \
35 (BLUE_CMP(c2) - BLUE_CMP(c1)) * (num) / (den) + BLUE_CMP(c1), \
36 (GREEN_CMP(c2) - GREEN_CMP(c1)) * (num) / (den) + GREEN_CMP(c1), \
37 (RED_CMP(c2) - RED_CMP(c1)) * (num) / (den) + RED_CMP(c1), 0
39 #define LE16_CONST(x) (x)&0xff, ((x)>>8)&0xff
40 #define LE32_CONST(x) (x)&0xff, ((x)>>8)&0xff, ((x)>>16)&0xff, ((x)>>24)&0xff
42 #if LCD_DEPTH <= 4
43 #define DUMP_BMP_BPP 4
44 #define DUMP_BMP_LINESIZE ((LCD_WIDTH/2 + 3) & ~3)
45 #elif LCD_DEPTH <= 8
46 #define DUMP_BMP_BPP 8
47 #define DUMP_BMP_LINESIZE ((LCD_WIDTH + 3) & ~3)
48 #elif LCD_DEPTH <= 16
49 #define DUMP_BMP_BPP 16
50 #define DUMP_BMP_LINESIZE ((LCD_WIDTH*2 + 3) & ~3)
51 #else
52 #define DUMP_BMP_BPP 24
53 #define DUMP_BMP_LINESIZE ((LCD_WIDTH*3 + 3) & ~3)
54 #endif
56 #ifdef BOOTLOADER
58 #define screen_dump()
59 #define remote_screen_dump()
61 #else /* !BOOTLOADER */
63 /* Save a .BMP file containing the current screen contents. */
64 void screen_dump(void);
66 #ifdef HAVE_LCD_BITMAP
67 void screen_dump_set_hook(void (*hook)(int fd));
68 #endif
70 #ifdef HAVE_REMOTE_LCD
71 /* Save a .BMP file containing the current remote screen contents. */
72 void remote_screen_dump(void);
73 #endif
75 #endif /* !BOOTLOADER */
77 #endif /* __SCREENDUMP_H__ */