summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/xlcd.c
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-02-05 12:59:10 +0000
committerJens Arnold <amiconn@rockbox.org>2006-02-05 12:59:10 +0000
commite49cade42d00e8b1f6836f9e9c436cda67cf6437 (patch)
tree0df02bdf3959a3ec056c1ce7cf11f6b18de8594a /apps/plugins/lib/xlcd.c
parent1a03c3794776d2295b733ed516edee887bc81fcc (diff)
downloadrockbox-e49cade42d00e8b1f6836f9e9c436cda67cf6437.tar.gz
rockbox-e49cade42d00e8b1f6836f9e9c436cda67cf6437.zip
Colour targets: Adapted mandelbrot plugin. The plugin library now contains scrolling routines for >= 8 bpp displays.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8578 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/xlcd.c')
-rw-r--r--apps/plugins/lib/xlcd.c114
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() */
110static 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
132void 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
157void 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
182void 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
201void 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