diff options
Diffstat (limited to 'firmware/target/hosted/ypr0/lcd-ypr0.c')
-rw-r--r-- | firmware/target/hosted/ypr0/lcd-ypr0.c | 53 |
1 files changed, 1 insertions, 52 deletions
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 | { |