diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-11-26 14:26:08 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-11-26 14:26:08 +0000 |
commit | 11e2e565ca65e9555bcc19ddb256775e9e911edb (patch) | |
tree | c1b3ef99b2f79c4b5d1e1d98358c2223002148e3 /firmware | |
parent | bbef13eddfefffa1fbcf82185ed73c04a18d22eb (diff) | |
download | rockbox-11e2e565ca65e9555bcc19ddb256775e9e911edb.tar.gz rockbox-11e2e565ca65e9555bcc19ddb256775e9e911edb.zip |
Backdrop support in the X5 remote LCD driver. Still needs to be wired to the UI and settings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11601 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rwxr-xr-x | firmware/drivers/lcd-remote-2bit-vi.c | 118 | ||||
-rw-r--r-- | firmware/export/lcd-remote.h | 5 |
2 files changed, 116 insertions, 7 deletions
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c index 2d4d9a3ee1..3c85512bea 100755 --- a/firmware/drivers/lcd-remote-2bit-vi.c +++ b/firmware/drivers/lcd-remote-2bit-vi.c | |||
@@ -42,7 +42,10 @@ | |||
42 | fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_FBWIDTH] | 42 | fb_remote_data lcd_remote_framebuffer[LCD_REMOTE_HEIGHT/8][LCD_REMOTE_FBWIDTH] |
43 | IBSS_ATTR; | 43 | IBSS_ATTR; |
44 | 44 | ||
45 | static const fb_data patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000}; | 45 | static const fb_remote_data patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000}; |
46 | |||
47 | static fb_remote_data* remote_backdrop = NULL; | ||
48 | static long remote_backdrop_offset IDATA_ATTR = 0; | ||
46 | 49 | ||
47 | static unsigned fg_pattern IDATA_ATTR = 0xFFFF; /* initially black */ | 50 | static unsigned fg_pattern IDATA_ATTR = 0xFFFF; /* initially black */ |
48 | static unsigned bg_pattern IDATA_ATTR = 0x0000; /* initially white */ | 51 | static unsigned bg_pattern IDATA_ATTR = 0x0000; /* initially white */ |
@@ -173,6 +176,16 @@ static void clearpixel(int x, int y) | |||
173 | *address = data ^ ((data ^ bg_pattern) & mask); | 176 | *address = data ^ ((data ^ bg_pattern) & mask); |
174 | } | 177 | } |
175 | 178 | ||
179 | static void clearimgpixel(int x, int y) | ||
180 | { | ||
181 | unsigned mask = 0x0101 << (y & 7); | ||
182 | fb_remote_data *address = &lcd_remote_framebuffer[y>>3][x]; | ||
183 | unsigned data = *address; | ||
184 | |||
185 | *address = data ^ ((data ^ *(fb_remote_data *)((long)address | ||
186 | + remote_backdrop_offset)) & mask); | ||
187 | } | ||
188 | |||
176 | static void flippixel(int x, int y) | 189 | static void flippixel(int x, int y) |
177 | { | 190 | { |
178 | unsigned mask = 0x0101 << (y & 7); | 191 | unsigned mask = 0x0101 << (y & 7); |
@@ -187,11 +200,18 @@ static void nopixel(int x, int y) | |||
187 | (void)y; | 200 | (void)y; |
188 | } | 201 | } |
189 | 202 | ||
190 | lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8] = { | 203 | lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs_bgcolor[8] = { |
191 | flippixel, nopixel, setpixel, setpixel, | 204 | flippixel, nopixel, setpixel, setpixel, |
192 | nopixel, clearpixel, nopixel, clearpixel | 205 | nopixel, clearpixel, nopixel, clearpixel |
193 | }; | 206 | }; |
194 | 207 | ||
208 | lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs_backdrop[8] = { | ||
209 | flippixel, nopixel, setpixel, setpixel, | ||
210 | nopixel, clearimgpixel, nopixel, clearimgpixel | ||
211 | }; | ||
212 | |||
213 | lcd_remote_pixelfunc_type* const *lcd_remote_pixelfuncs = lcd_remote_pixelfuncs_bgcolor; | ||
214 | |||
195 | /* 'mask' and 'bits' contain 2 bits per pixel */ | 215 | /* 'mask' and 'bits' contain 2 bits per pixel */ |
196 | static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits) | 216 | static void flipblock(fb_remote_data *address, unsigned mask, unsigned bits) |
197 | ICODE_ATTR; | 217 | ICODE_ATTR; |
@@ -209,6 +229,16 @@ static void bgblock(fb_remote_data *address, unsigned mask, unsigned bits) | |||
209 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); | 229 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); |
210 | } | 230 | } |
211 | 231 | ||
232 | static void bgimgblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
233 | ICODE_ATTR; | ||
234 | static void bgimgblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
235 | { | ||
236 | unsigned data = *address; | ||
237 | |||
238 | *address = data ^ ((data ^ *(fb_remote_data *)((long)address | ||
239 | + remote_backdrop_offset)) & mask & ~bits); | ||
240 | } | ||
241 | |||
212 | static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits) | 242 | static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits) |
213 | ICODE_ATTR; | 243 | ICODE_ATTR; |
214 | static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits) | 244 | static void fgblock(fb_remote_data *address, unsigned mask, unsigned bits) |
@@ -229,6 +259,17 @@ static void solidblock(fb_remote_data *address, unsigned mask, unsigned bits) | |||
229 | *address = data ^ ((data ^ bits) & mask); | 259 | *address = data ^ ((data ^ bits) & mask); |
230 | } | 260 | } |
231 | 261 | ||
262 | static void solidimgblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
263 | ICODE_ATTR; | ||
264 | static void solidimgblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
265 | { | ||
266 | unsigned data = *address; | ||
267 | unsigned bgp = *(fb_remote_data *)((long)address + remote_backdrop_offset); | ||
268 | |||
269 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | ||
270 | *address = data ^ ((data ^ bits) & mask); | ||
271 | } | ||
272 | |||
232 | static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits) | 273 | static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits) |
233 | ICODE_ATTR; | 274 | ICODE_ATTR; |
234 | static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits) | 275 | static void flipinvblock(fb_remote_data *address, unsigned mask, unsigned bits) |
@@ -245,6 +286,16 @@ static void bginvblock(fb_remote_data *address, unsigned mask, unsigned bits) | |||
245 | *address = data ^ ((data ^ bg_pattern) & mask & bits); | 286 | *address = data ^ ((data ^ bg_pattern) & mask & bits); |
246 | } | 287 | } |
247 | 288 | ||
289 | static void bgimginvblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
290 | ICODE_ATTR; | ||
291 | static void bgimginvblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
292 | { | ||
293 | unsigned data = *address; | ||
294 | |||
295 | *address = data ^ ((data ^ *(fb_remote_data *)((long)address | ||
296 | + remote_backdrop_offset)) & mask & bits); | ||
297 | } | ||
298 | |||
248 | static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits) | 299 | static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits) |
249 | ICODE_ATTR; | 300 | ICODE_ATTR; |
250 | static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits) | 301 | static void fginvblock(fb_remote_data *address, unsigned mask, unsigned bits) |
@@ -265,11 +316,53 @@ static void solidinvblock(fb_remote_data *address, unsigned mask, unsigned bits) | |||
265 | *address = data ^ ((data ^ bits) & mask); | 316 | *address = data ^ ((data ^ bits) & mask); |
266 | } | 317 | } |
267 | 318 | ||
268 | lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8] = { | 319 | static void solidimginvblock(fb_remote_data *address, unsigned mask, unsigned bits) |
320 | ICODE_ATTR; | ||
321 | static void solidimginvblock(fb_remote_data *address, unsigned mask, unsigned bits) | ||
322 | { | ||
323 | unsigned data = *address; | ||
324 | unsigned fgp = fg_pattern; | ||
325 | |||
326 | bits = fgp ^ ((fgp ^ *(fb_remote_data *)((long)address | ||
327 | + remote_backdrop_offset)) & bits); | ||
328 | *address = data ^ ((data ^ bits) & mask); | ||
329 | } | ||
330 | |||
331 | lcd_remote_blockfunc_type* const lcd_remote_blockfuncs_bgcolor[8] = { | ||
269 | flipblock, bgblock, fgblock, solidblock, | 332 | flipblock, bgblock, fgblock, solidblock, |
270 | flipinvblock, bginvblock, fginvblock, solidinvblock | 333 | flipinvblock, bginvblock, fginvblock, solidinvblock |
271 | }; | 334 | }; |
272 | 335 | ||
336 | lcd_remote_blockfunc_type* const lcd_remote_blockfuncs_backdrop[8] = { | ||
337 | flipblock, bgimgblock, fgblock, solidimgblock, | ||
338 | flipinvblock, bgimginvblock, fginvblock, solidimginvblock | ||
339 | }; | ||
340 | |||
341 | lcd_remote_blockfunc_type* const *lcd_remote_blockfuncs = lcd_remote_blockfuncs_bgcolor; | ||
342 | |||
343 | |||
344 | void lcd_remote_set_backdrop(fb_remote_data* backdrop) | ||
345 | { | ||
346 | remote_backdrop = backdrop; | ||
347 | if (backdrop) | ||
348 | { | ||
349 | remote_backdrop_offset = (long)backdrop - (long)lcd_remote_framebuffer; | ||
350 | lcd_remote_pixelfuncs = lcd_remote_pixelfuncs_backdrop; | ||
351 | lcd_remote_blockfuncs = lcd_remote_blockfuncs_backdrop; | ||
352 | } | ||
353 | else | ||
354 | { | ||
355 | remote_backdrop_offset = 0; | ||
356 | lcd_remote_pixelfuncs = lcd_remote_pixelfuncs_bgcolor; | ||
357 | lcd_remote_blockfuncs = lcd_remote_blockfuncs_bgcolor; | ||
358 | } | ||
359 | } | ||
360 | |||
361 | fb_remote_data* lcd_remote_get_backdrop(void) | ||
362 | { | ||
363 | return remote_backdrop; | ||
364 | } | ||
365 | |||
273 | static inline void setblock(fb_remote_data *address, unsigned mask, unsigned bits) | 366 | static inline void setblock(fb_remote_data *address, unsigned mask, unsigned bits) |
274 | { | 367 | { |
275 | unsigned data = *address; | 368 | unsigned data = *address; |
@@ -283,9 +376,20 @@ static inline void setblock(fb_remote_data *address, unsigned mask, unsigned bit | |||
283 | /* Clear the whole display */ | 376 | /* Clear the whole display */ |
284 | void lcd_remote_clear_display(void) | 377 | void lcd_remote_clear_display(void) |
285 | { | 378 | { |
286 | unsigned bits = (drawmode & DRMODE_INVERSEVID) ? fg_pattern : bg_pattern; | 379 | if (drawmode & DRMODE_INVERSEVID) |
287 | 380 | { | |
288 | memset16(lcd_remote_framebuffer, bits, sizeof lcd_remote_framebuffer / 2); | 381 | memset(lcd_remote_framebuffer, fg_pattern, |
382 | sizeof lcd_remote_framebuffer); | ||
383 | } | ||
384 | else | ||
385 | { | ||
386 | if (remote_backdrop) | ||
387 | memcpy(lcd_remote_framebuffer, remote_backdrop, | ||
388 | sizeof lcd_remote_framebuffer); | ||
389 | else | ||
390 | memset(lcd_remote_framebuffer, bg_pattern, | ||
391 | sizeof lcd_remote_framebuffer); | ||
392 | } | ||
289 | scrolling_lines = 0; | 393 | scrolling_lines = 0; |
290 | } | 394 | } |
291 | 395 | ||
@@ -497,7 +601,7 @@ void lcd_remote_fillrect(int x, int y, int width, int height) | |||
497 | 601 | ||
498 | if (drawmode & DRMODE_INVERSEVID) | 602 | if (drawmode & DRMODE_INVERSEVID) |
499 | { | 603 | { |
500 | if (drawmode & DRMODE_BG) | 604 | if ((drawmode & DRMODE_BG) && !remote_backdrop) |
501 | { | 605 | { |
502 | fillopt = true; | 606 | fillopt = true; |
503 | bits = bg_pattern; | 607 | bits = bg_pattern; |
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 9d5808b157..e4fffedac0 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h | |||
@@ -132,8 +132,13 @@ extern void lcd_remote_setfont(int font); | |||
132 | extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); | 132 | extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); |
133 | 133 | ||
134 | /* low level drawing function pointer arrays */ | 134 | /* low level drawing function pointer arrays */ |
135 | #if LCD_REMOTE_DEPTH > 1 | ||
136 | extern lcd_remote_pixelfunc_type* const *lcd_remote_pixelfuncs; | ||
137 | extern lcd_remote_blockfunc_type* const *lcd_remote_blockfuncs; | ||
138 | #else | ||
135 | extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8]; | 139 | extern lcd_remote_pixelfunc_type* const lcd_remote_pixelfuncs[8]; |
136 | extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8]; | 140 | extern lcd_remote_blockfunc_type* const lcd_remote_blockfuncs[8]; |
141 | #endif | ||
137 | 142 | ||
138 | extern void lcd_remote_drawpixel(int x, int y); | 143 | extern void lcd_remote_drawpixel(int x, int y); |
139 | extern void lcd_remote_drawline(int x1, int y1, int x2, int y2); | 144 | extern void lcd_remote_drawline(int x1, int y1, int x2, int y2); |