diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2012-12-07 01:50:52 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2012-12-18 19:16:26 -0500 |
commit | 371c86bf3f4d1708fc40db2aa7fa572eb429d0b4 (patch) | |
tree | be339c62eac616ac6938c2929349b72377c10ee2 /apps/plugins/lib/osd.h | |
parent | f668c3624184fedc14d34f87ad7b5f1e43bc87a1 (diff) | |
download | rockbox-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.h | 62 |
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. */ |
33 | bool osd_init(void *backbuf, size_t backbuf_size, | 37 | enum 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 | }; | ||
45 | bool 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 */ | ||
50 | void osd_destroy(void); | ||
35 | 51 | ||
36 | enum | 52 | enum |
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 */ |
92 | void osd_lcd_update_rect(int x, int y, int width, int height); | 108 | void 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) */ | ||
112 | bool 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); | ||
115 | void osd_grey_destroy(void); | ||
116 | bool osd_grey_show(unsigned flags); | ||
117 | bool osd_grey_update(void); | ||
118 | bool osd_grey_update_rect(int x, int y, int width, int height); | ||
119 | bool osd_grey_update_pos(int x, int y, int width, int height); | ||
120 | void osd_grey_monitor_timeout(void); | ||
121 | void osd_grey_set_timeout(long timeout); | ||
122 | struct viewport * osd_grey_get_viewport(void); | ||
123 | void osd_grey_get_max_dims(int *maxwidth, int *maxheight); | ||
124 | bool osd_grey_enabled(void); | ||
125 | void osd_grey_lcd_update_prepare(void); | ||
126 | void osd_grey_lcd_update(void); | ||
127 | void 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 */ |