summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/osd.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2012-12-07 01:50:52 -0500
committerMichael Sevakis <jethead71@rockbox.org>2012-12-18 19:16:26 -0500
commit371c86bf3f4d1708fc40db2aa7fa572eb429d0b4 (patch)
treebe339c62eac616ac6938c2929349b72377c10ee2 /apps/plugins/lib/osd.h
parentf668c3624184fedc14d34f87ad7b5f1e43bc87a1 (diff)
downloadrockbox-371c86bf3f4d1708fc40db2aa7fa572eb429d0b4.tar.gz
rockbox-371c86bf3f4d1708fc40db2aa7fa572eb429d0b4.zip
Adapt OSD in plugin lib to be greylib compatible.
Requires addition of viewports and alternate framebuffers to greylib which are essentially similar to the core implementation except that the framebuffer can be any size and relationship to a viewport. Drawing is always fully clipped to the intersecting area. Adapt oscilloscope.c to the API change. FFT will use the new features (later update). Get rid of silly and wrong lcd_bmp_part use in OSD. Remove it from plugin API (must be made incompatible now). Change-Id: Iafa5e2174148fb8ad11db6b9d4add0dcabc5c563
Diffstat (limited to 'apps/plugins/lib/osd.h')
-rw-r--r--apps/plugins/lib/osd.h62
1 files changed, 60 insertions, 2 deletions
diff --git a/apps/plugins/lib/osd.h b/apps/plugins/lib/osd.h
index 89441ae273..b5bf63d9fe 100644
--- a/apps/plugins/lib/osd.h
+++ b/apps/plugins/lib/osd.h
@@ -23,6 +23,10 @@
23#ifndef OSD_H 23#ifndef OSD_H
24#define OSD_H 24#define OSD_H
25 25
26#ifndef HAVE_LCD_BITMAP
27#error OSD requires bitmapped LCD
28#endif
29
26/* At this time: assumes use of the default viewport for normal drawing */ 30/* At this time: assumes use of the default viewport for normal drawing */
27 31
28/* Callback implemented by user. Paramters are OSD vp-relative coordinates */ 32/* Callback implemented by user. Paramters are OSD vp-relative coordinates */
@@ -30,8 +34,20 @@ typedef void (* osd_draw_cb_fn_t)(int x, int y, int width, int height);
30 34
31/* Initialize the OSD, set its backbuffer, update callback and enable it if 35/* Initialize the OSD, set its backbuffer, update callback and enable it if
32 * the call succeeded. */ 36 * the call succeeded. */
33bool osd_init(void *backbuf, size_t backbuf_size, 37enum osd_init_flags
34 osd_draw_cb_fn_t draw_cb); 38{
39 OSD_INIT_MAJOR_WIDTH = 0x0, /* Width guides buffer dims (default) */
40 OSD_INIT_MAJOR_HEIGHT = 0x1, /* Height guides buffer dims */
41 OSD_INIT_MINOR_MIN = 0x2, /* Treat minor axis dim as a minimum */
42 OSD_INIT_MINOR_MAX = 0x4, /* Treat minor axis dim as a maximum */
43 /* To get exact minor size, combine min/max flags */
44};
45bool osd_init(unsigned flags, void *backbuf, size_t backbuf_size,
46 osd_draw_cb_fn_t draw_cb, int *width,
47 int *height, size_t *bufused);
48
49/* Destroy the OSD, rendering it disabled */
50void osd_destroy(void);
35 51
36enum 52enum
37{ 53{
@@ -91,4 +107,46 @@ void osd_lcd_update(void);
91/* Update a part of the screen and restore OSD if it is visible */ 107/* Update a part of the screen and restore OSD if it is visible */
92void osd_lcd_update_rect(int x, int y, int width, int height); 108void osd_lcd_update_rect(int x, int y, int width, int height);
93 109
110#if LCD_DEPTH < 4
111/* Like other functions but for greylib surface (requires GREY_BUFFERED) */
112bool osd_grey_init(unsigned flags, void *backbuf, size_t backbuf_size,
113 osd_draw_cb_fn_t draw_cb, int *width,
114 int *height, size_t *bufused);
115void osd_grey_destroy(void);
116bool osd_grey_show(unsigned flags);
117bool osd_grey_update(void);
118bool osd_grey_update_rect(int x, int y, int width, int height);
119bool osd_grey_update_pos(int x, int y, int width, int height);
120void osd_grey_monitor_timeout(void);
121void osd_grey_set_timeout(long timeout);
122struct viewport * osd_grey_get_viewport(void);
123void osd_grey_get_max_dims(int *maxwidth, int *maxheight);
124bool osd_grey_enabled(void);
125void osd_grey_lcd_update_prepare(void);
126void osd_grey_lcd_update(void);
127void osd_grey_lcd_update_rect(int x, int y, int width, int height);
128#endif /* LCD_DEPTH < 4 */
129
130/* MYLCD-style helper defines to compile with different graphics libs */
131#ifdef __GREY_H__
132#define myosd_(fn) osd_grey_##fn
133#else
134#define myosd_(fn) osd_##fn
135#endif
136
137#define myosd_init myosd_(init)
138#define myosd_destroy myosd_(destroy)
139#define myosd_show myosd_(show)
140#define myosd_update myosd_(update)
141#define myosd_update_rect myosd_(update_rect)
142#define myosd_update_pos myosd_(update_pos)
143#define myosd_monitor_timeout myosd_(monitor_timeout)
144#define myosd_set_timeout myosd_(set_timeout)
145#define myosd_get_viewport myosd_(get_viewport)
146#define myosd_get_max_dims myosd_(get_max_dims)
147#define myosd_enabled myosd_(enabled)
148#define myosd_lcd_update_prepare myosd_(lcd_update_prepare)
149#define myosd_lcd_update myosd_(lcd_update)
150#define myosd_lcd_update_rect myosd_(lcd_update_rect)
151
94#endif /* OSD_H */ 152#endif /* OSD_H */