diff options
Diffstat (limited to 'apps/plugins/lib/xlcd.c')
-rw-r--r-- | apps/plugins/lib/xlcd.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/apps/plugins/lib/xlcd.c b/apps/plugins/lib/xlcd.c index a0dcc2ac3e..33d807f2f3 100644 --- a/apps/plugins/lib/xlcd.c +++ b/apps/plugins/lib/xlcd.c | |||
@@ -105,5 +105,119 @@ void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3) | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | #if LCD_DEPTH >= 8 | ||
109 | /* FIXME: intermediate solution until we have properly optimised memmove() */ | ||
110 | static void *my_memmove(void *dst0, const void *src0, size_t len0) | ||
111 | { | ||
112 | char *dst = (char *) dst0; | ||
113 | char *src = (char *) src0; | ||
114 | |||
115 | if (dst <= src) | ||
116 | { | ||
117 | while (len0--) | ||
118 | *dst++ = *src++; | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | dst += len0; | ||
123 | src += len0; | ||
124 | |||
125 | while (len0--) | ||
126 | *(--dst) = *(--src); | ||
127 | } | ||
128 | |||
129 | return dst0; | ||
130 | } | ||
131 | |||
132 | void xlcd_scroll_left(int count) | ||
133 | { | ||
134 | fb_data *data, *data_end; | ||
135 | int length, oldmode; | ||
136 | |||
137 | if ((unsigned)count >= LCD_WIDTH) | ||
138 | return; | ||
139 | |||
140 | data = local_rb->lcd_framebuffer; | ||
141 | data_end = data + LCD_WIDTH*LCD_HEIGHT; | ||
142 | length = LCD_WIDTH - count; | ||
143 | |||
144 | do | ||
145 | { | ||
146 | my_memmove(data, data + count, length * sizeof(fb_data)); | ||
147 | data += LCD_WIDTH; | ||
148 | } | ||
149 | while (data < data_end); | ||
150 | |||
151 | oldmode = local_rb->lcd_get_drawmode(); | ||
152 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
153 | local_rb->lcd_fillrect(length, 0, count, LCD_HEIGHT); | ||
154 | local_rb->lcd_set_drawmode(oldmode); | ||
155 | } | ||
156 | |||
157 | void xlcd_scroll_right(int count) | ||
158 | { | ||
159 | fb_data *data, *data_end; | ||
160 | int length, oldmode; | ||
161 | |||
162 | if ((unsigned)count >= LCD_WIDTH) | ||
163 | return; | ||
164 | |||
165 | data = local_rb->lcd_framebuffer; | ||
166 | data_end = data + LCD_WIDTH*LCD_HEIGHT; | ||
167 | length = LCD_WIDTH - count; | ||
168 | |||
169 | do | ||
170 | { | ||
171 | my_memmove(data + count, data, length * sizeof(fb_data)); | ||
172 | data += LCD_WIDTH; | ||
173 | } | ||
174 | while (data < data_end); | ||
175 | |||
176 | oldmode = local_rb->lcd_get_drawmode(); | ||
177 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
178 | local_rb->lcd_fillrect(0, 0, count, LCD_HEIGHT); | ||
179 | local_rb->lcd_set_drawmode(oldmode); | ||
180 | } | ||
181 | |||
182 | void xlcd_scroll_up(int count) | ||
183 | { | ||
184 | long length, oldmode; | ||
185 | |||
186 | if ((unsigned)count >= LCD_HEIGHT) | ||
187 | return; | ||
188 | |||
189 | length = LCD_HEIGHT - count; | ||
190 | |||
191 | my_memmove(local_rb->lcd_framebuffer, | ||
192 | local_rb->lcd_framebuffer + count * LCD_WIDTH, | ||
193 | length * LCD_WIDTH * sizeof(fb_data)); | ||
194 | |||
195 | oldmode = local_rb->lcd_get_drawmode(); | ||
196 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
197 | local_rb->lcd_fillrect(0, length, LCD_WIDTH, count); | ||
198 | local_rb->lcd_set_drawmode(oldmode); | ||
199 | } | ||
200 | |||
201 | void xlcd_scroll_down(int count) | ||
202 | { | ||
203 | long length, oldmode; | ||
204 | |||
205 | if ((unsigned)count >= LCD_HEIGHT) | ||
206 | return; | ||
207 | |||
208 | length = LCD_HEIGHT - count; | ||
209 | |||
210 | my_memmove(local_rb->lcd_framebuffer + count * LCD_WIDTH, | ||
211 | local_rb->lcd_framebuffer, | ||
212 | length * LCD_WIDTH * sizeof(fb_data)); | ||
213 | |||
214 | oldmode = local_rb->lcd_get_drawmode(); | ||
215 | local_rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
216 | local_rb->lcd_fillrect(0, 0, LCD_WIDTH, count); | ||
217 | local_rb->lcd_set_drawmode(oldmode); | ||
218 | } | ||
219 | |||
220 | #endif /* LCD_DEPTH >= 8 */ | ||
221 | |||
108 | #endif /* HAVE_LCD_BITMAP */ | 222 | #endif /* HAVE_LCD_BITMAP */ |
109 | 223 | ||