diff options
author | Thomas Martitz <kugel@rockbox.org> | 2012-01-07 23:30:53 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2012-01-22 18:46:45 +0100 |
commit | 5e9b62cd8ad4d38c7ca43c916b5bc831454bc267 (patch) | |
tree | 05821191bbd79fac95ff104e6237f3f310f7c9bf /firmware/target/hosted | |
parent | 094cbd586ffd16c75e11dd7eb32dbe7f79c21a99 (diff) | |
download | rockbox-5e9b62cd8ad4d38c7ca43c916b5bc831454bc267.tar.gz rockbox-5e9b62cd8ad4d38c7ca43c916b5bc831454bc267.zip |
ypr0: Use generic lcd memframe driver.
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r-- | firmware/target/hosted/ypr0/lcd-target.h | 26 | ||||
-rw-r--r-- | firmware/target/hosted/ypr0/lcd-ypr0.c | 53 |
2 files changed, 27 insertions, 52 deletions
diff --git a/firmware/target/hosted/ypr0/lcd-target.h b/firmware/target/hosted/ypr0/lcd-target.h new file mode 100644 index 0000000000..c8a6de74f9 --- /dev/null +++ b/firmware/target/hosted/ypr0/lcd-target.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version 2 | ||
13 | * of the License, or (at your option) any later version. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #ifndef __LCD_TARGET_H__ | ||
21 | #define __LCD_TARGET_H__ | ||
22 | |||
23 | extern fb_data *dev_fb; | ||
24 | #define LCD_FRAMEBUF_ADDR(col, row) (dev_fb + row*LCD_WIDTH + col) | ||
25 | |||
26 | #endif | ||
diff --git a/firmware/target/hosted/ypr0/lcd-ypr0.c b/firmware/target/hosted/ypr0/lcd-ypr0.c index f0565ae2d4..083a9fbe28 100644 --- a/firmware/target/hosted/ypr0/lcd-ypr0.c +++ b/firmware/target/hosted/ypr0/lcd-ypr0.c | |||
@@ -33,59 +33,8 @@ | |||
33 | #include "screendump.h" | 33 | #include "screendump.h" |
34 | #include "lcd.h" | 34 | #include "lcd.h" |
35 | 35 | ||
36 | /* eqivalent to fb + y*width + x */ | ||
37 | #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) | ||
38 | |||
39 | static int dev_fd = 0; | 36 | static int dev_fd = 0; |
40 | static fb_data *dev_fb = 0; | 37 | fb_data *dev_fb = 0; |
41 | |||
42 | void lcd_update(void) | ||
43 | { | ||
44 | /* update the entire display */ | ||
45 | memcpy(dev_fb, lcd_framebuffer, sizeof(lcd_framebuffer)); | ||
46 | } | ||
47 | |||
48 | /* Copy Rockbox frame buffer to the mmapped lcd device */ | ||
49 | void lcd_update_rect(int x, int y, int width, int height) | ||
50 | { | ||
51 | /* nothing to draw? */ | ||
52 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || | ||
53 | (y >= LCD_HEIGHT) || (x + width <= 0) || (y + height <= 0)) | ||
54 | return; | ||
55 | |||
56 | /* do the necessary clipping */ | ||
57 | if (x < 0) | ||
58 | { /* clip left */ | ||
59 | width += x; | ||
60 | x = 0; | ||
61 | } | ||
62 | if (y < 0) | ||
63 | { /* clip top */ | ||
64 | height += y; | ||
65 | y = 0; | ||
66 | } | ||
67 | if (x + width > LCD_WIDTH) | ||
68 | width = LCD_WIDTH - x; /* clip right */ | ||
69 | if (y + height > LCD_HEIGHT) | ||
70 | height = LCD_HEIGHT - y; /* clip bottom */ | ||
71 | |||
72 | fb_data* src = LCDADDR(x, y); | ||
73 | fb_data* dst = dev_fb + y*LCD_WIDTH + x; | ||
74 | |||
75 | if (LCD_WIDTH == width) | ||
76 | { /* optimized full-width update */ | ||
77 | memcpy(dst, src, width * height * sizeof(fb_data)); | ||
78 | } | ||
79 | else | ||
80 | { /* row by row */ | ||
81 | do | ||
82 | { | ||
83 | memcpy(dst, src, width * sizeof(fb_data)); | ||
84 | src += LCD_WIDTH; | ||
85 | dst += LCD_WIDTH; | ||
86 | } while(--height > 0); | ||
87 | } | ||
88 | } | ||
89 | 38 | ||
90 | void lcd_shutdown(void) | 39 | void lcd_shutdown(void) |
91 | { | 40 | { |