summaryrefslogtreecommitdiffstats
path: root/apps/plugins/lib/xlcd_scroll.c
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-09-12 16:42:11 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-09-12 16:42:11 +0000
commit2544b001b8d3e1cd34791ec492fca4104bc2b440 (patch)
tree60a779c7654f176fdb7b14d41774816e91e05e79 /apps/plugins/lib/xlcd_scroll.c
parentced32dfc48ea06c672d33aaa82a12b522efe51e1 (diff)
downloadrockbox-2544b001b8d3e1cd34791ec492fca4104bc2b440.tar.gz
rockbox-2544b001b8d3e1cd34791ec492fca4104bc2b440.zip
Add Vertical stride support to LCD scrolling functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22683 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/xlcd_scroll.c')
-rw-r--r--apps/plugins/lib/xlcd_scroll.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c
index 6b70e2cfd2..499dbf13a9 100644
--- a/apps/plugins/lib/xlcd_scroll.c
+++ b/apps/plugins/lib/xlcd_scroll.c
@@ -31,6 +31,97 @@
static const unsigned short patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
#endif
+#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
+void xlcd_scroll_left(int count)
+{
+ int length, oldmode;
+
+ if ((unsigned)count >= LCD_WIDTH)
+ return;
+
+ length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
+
+ rb->memmove(rb->lcd_framebuffer, rb->lcd_framebuffer + LCD_HEIGHT*count,
+ length * sizeof(fb_data));
+
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(LCD_WIDTH-count, 0, count, LCD_HEIGHT);
+ rb->lcd_set_drawmode(oldmode);
+}
+
+/* Scroll right */
+void xlcd_scroll_right(int count)
+{
+ int length, oldmode;
+
+ if ((unsigned)count >= LCD_WIDTH)
+ return;
+
+ length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
+
+ rb->memmove(rb->lcd_framebuffer + LCD_HEIGHT*count,
+ rb->lcd_framebuffer, length * sizeof(fb_data));
+
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, count, LCD_HEIGHT);
+ rb->lcd_set_drawmode(oldmode);
+}
+
+/* Scroll up */
+void xlcd_scroll_up(int count)
+{
+ int width, length, oldmode;
+
+ fb_data *data;
+
+ if ((unsigned)count >= LCD_HEIGHT)
+ return;
+
+ length = LCD_HEIGHT - count;
+
+ width = LCD_WIDTH;
+ data = rb->lcd_framebuffer;
+
+ do {
+ rb->memmove(data,data + count,length * sizeof(fb_data));
+ data += LCD_HEIGHT;
+ } while(width--);
+
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, length, LCD_WIDTH, count);
+ rb->lcd_set_drawmode(oldmode);
+}
+
+/* Scroll down */
+void xlcd_scroll_down(int count)
+{
+ int width, length, oldmode;
+
+ fb_data *data;
+
+ if ((unsigned)count >= LCD_HEIGHT)
+ return;
+
+ length = LCD_HEIGHT - count;
+
+ width = LCD_WIDTH;
+ data = rb->lcd_framebuffer;
+
+ do {
+ rb->memmove(data + count, data, length * sizeof(fb_data));
+ data += LCD_HEIGHT;
+ } while(width--);
+
+ oldmode = rb->lcd_get_drawmode();
+ rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
+ rb->lcd_fillrect(0, 0, LCD_WIDTH, count);
+ rb->lcd_set_drawmode(oldmode);
+}
+#else
+
#if (LCD_PIXELFORMAT == HORIZONTAL_PACKING) && (LCD_DEPTH < 8)
/* Scroll left */
@@ -629,5 +720,6 @@ void xlcd_scroll_down(int count)
}
#endif /* LCD_PIXELFORMAT, LCD_DEPTH */
+#endif /* defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE */
#endif /* HAVE_LCD_BITMAP */