summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/grey.h2
-rw-r--r--apps/plugins/lib/grey_core.c13
-rw-r--r--apps/plugins/lib/grey_parm.c4
-rw-r--r--apps/plugins/lib/osd.c27
-rw-r--r--apps/plugins/lib/xlcd.h2
-rw-r--r--apps/plugins/lib/xlcd_core.c9
-rw-r--r--apps/plugins/lib/xlcd_draw.c14
-rw-r--r--apps/plugins/lib/xlcd_scroll.c107
8 files changed, 139 insertions, 39 deletions
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 0e064f46b2..5cafc6a83e 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -62,7 +62,7 @@ void grey_deferred_lcd_update(void);
62 62
63/* Viewports and framebuffers */ 63/* Viewports and framebuffers */
64void grey_clear_viewport(void); 64void grey_clear_viewport(void);
65void grey_set_viewport(struct viewport *vp); 65struct viewport *grey_set_viewport(struct viewport *vp);
66void grey_viewport_set_fullscreen(struct viewport *vp, 66void grey_viewport_set_fullscreen(struct viewport *vp,
67 const enum screen_type screen); 67 const enum screen_type screen);
68void grey_viewport_set_pos(struct viewport *vp, 68void grey_viewport_set_pos(struct viewport *vp,
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c
index 9686f1d021..e3543aeba2 100644
--- a/apps/plugins/lib/grey_core.c
+++ b/apps/plugins/lib/grey_core.c
@@ -765,6 +765,11 @@ static const unsigned char colorindex[4] = {128, 85, 43, 0};
765 content (b&w and greyscale overlay) to an 8-bit BMP file. */ 765 content (b&w and greyscale overlay) to an 8-bit BMP file. */
766static void grey_screendump_hook(int fd) 766static void grey_screendump_hook(int fd)
767{ 767{
768 fb_data *lcd_fb;
769 struct viewport *vp_main = rb->lcd_set_viewport(NULL);
770 rb->viewport_set_fullscreen(vp_main, SCREEN_MAIN);
771 lcd_fb = vp_main->buffer->fb_ptr;
772
768 int i; 773 int i;
769 int y, gx, gy; 774 int y, gx, gy;
770#if LCD_PIXELFORMAT == VERTICAL_PACKING 775#if LCD_PIXELFORMAT == VERTICAL_PACKING
@@ -845,7 +850,7 @@ static void grey_screendump_hook(int fd)
845 gsrc = _grey_info.values + _GREY_MULUQ(_grey_info.width, gy); 850 gsrc = _grey_info.values + _GREY_MULUQ(_grey_info.width, gy);
846 851
847#if LCD_DEPTH == 2 852#if LCD_DEPTH == 2
848 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_FBWIDTH, y); 853 src = lcd_fb + _GREY_MULUQ(LCD_FBWIDTH, y);
849 854
850 do 855 do
851 { 856 {
@@ -876,7 +881,7 @@ static void grey_screendump_hook(int fd)
876 881
877#if LCD_DEPTH == 1 882#if LCD_DEPTH == 1
878 mask = BIT_N(y & 7); 883 mask = BIT_N(y & 7);
879 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 884 src = lcd_fb + _GREY_MULUQ(LCD_WIDTH, y >> 3);
880 885
881 do 886 do
882 { 887 {
@@ -908,7 +913,7 @@ static void grey_screendump_hook(int fd)
908 913
909#elif LCD_DEPTH == 2 914#elif LCD_DEPTH == 2
910 shift = 2 * (y & 3); 915 shift = 2 * (y & 3);
911 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 2); 916 src = lcd_fb + _GREY_MULUQ(LCD_WIDTH, y >> 2);
912 917
913 do 918 do
914 { 919 {
@@ -933,7 +938,7 @@ static void grey_screendump_hook(int fd)
933 938
934#if LCD_DEPTH == 2 939#if LCD_DEPTH == 2
935 shift = y & 7; 940 shift = y & 7;
936 src = *rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); 941 src = lcd_fb + _GREY_MULUQ(LCD_WIDTH, y >> 3);
937 942
938 do 943 do
939 { 944 {
diff --git a/apps/plugins/lib/grey_parm.c b/apps/plugins/lib/grey_parm.c
index d2dfde42f1..700b6f0026 100644
--- a/apps/plugins/lib/grey_parm.c
+++ b/apps/plugins/lib/grey_parm.c
@@ -154,8 +154,9 @@ static void grey_update_clip_rect(void)
154} 154}
155 155
156/* Set current grey viewport for draw routines */ 156/* Set current grey viewport for draw routines */
157void grey_set_viewport(struct viewport *vp) 157struct viewport *grey_set_viewport(struct viewport *vp)
158{ 158{
159 struct viewport *last_vp = _grey_info.vp;
159 if (vp == NULL) 160 if (vp == NULL)
160 vp = &_grey_default_vp; 161 vp = &_grey_default_vp;
161 162
@@ -164,6 +165,7 @@ void grey_set_viewport(struct viewport *vp)
164 _grey_info.vp = vp; 165 _grey_info.vp = vp;
165 grey_update_clip_rect(); 166 grey_update_clip_rect();
166 } 167 }
168 return last_vp;
167} 169}
168 170
169/* Set viewport to default settings */ 171/* Set viewport to default settings */
diff --git a/apps/plugins/lib/osd.c b/apps/plugins/lib/osd.c
index 97db09cc1e..7d6e10a410 100644
--- a/apps/plugins/lib/osd.c
+++ b/apps/plugins/lib/osd.c
@@ -52,6 +52,7 @@ struct osd
52 OSD_ERASED, /* Erased in preparation for regular drawing */ 52 OSD_ERASED, /* Erased in preparation for regular drawing */
53 } status; /* View status */ 53 } status; /* View status */
54 struct viewport vp; /* Clipping viewport */ 54 struct viewport vp; /* Clipping viewport */
55 struct frame_buffer_t framebuf; /* Holds framebuffer reference */
55 int lcd_bitmap_stride; /* Stride of LCD bitmap */ 56 int lcd_bitmap_stride; /* Stride of LCD bitmap */
56 void *lcd_bitmap_data; /* Backbuffer framebuffer data */ 57 void *lcd_bitmap_data; /* Backbuffer framebuffer data */
57 int back_bitmap_stride; /* Stride of backbuffer bitmap */ 58 int back_bitmap_stride; /* Stride of backbuffer bitmap */
@@ -68,7 +69,7 @@ struct osd
68 int height); 69 int height);
69 void (*lcd_update)(void); 70 void (*lcd_update)(void);
70 void (*lcd_update_rect)(int x, int y, int width, int height); 71 void (*lcd_update_rect)(int x, int y, int width, int height);
71 void (*lcd_set_viewport)(struct viewport *vp); 72 struct viewport *(*lcd_set_viewport)(struct viewport *vp);
72 void (*lcd_set_framebuffer)(void *buf); 73 void (*lcd_set_framebuffer)(void *buf);
73 void (*lcd_framebuffer_set_pos)(int x, int y, int width, int height); 74 void (*lcd_framebuffer_set_pos)(int x, int y, int width, int height);
74 void (*lcd_bitmap_part)(const void *src, int src_x, int src_y, 75 void (*lcd_bitmap_part)(const void *src, int src_x, int src_y,
@@ -227,7 +228,8 @@ static void * _osd_lcd_init_buffers(struct osd *osd, unsigned flags,
227 osd->back_bitmap_stride = w; 228 osd->back_bitmap_stride = w;
228#endif /* end stride type selection */ 229#endif /* end stride type selection */
229 230
230 osd->lcd_bitmap_data = (void *)*rb->lcd_framebuffer; 231 /* vp is currently initialized to the default framebuffer */
232 osd->lcd_bitmap_data = osd->vp.buffer->data;
231 osd->back_bitmap_data = buf; 233 osd->back_bitmap_data = buf;
232 234
233 osd->maxwidth = w; 235 osd->maxwidth = w;
@@ -686,6 +688,25 @@ static void _osd_lcd_update_rect(struct osd *osd,
686 osd->lcd_update_rect(x, y, width, height); 688 osd->lcd_update_rect(x, y, width, height);
687} 689}
688 690
691static void _osd_lcd_viewport_set_buffer(void *buffer)
692{
693 if (buffer)
694 {
695 native_osd.framebuf.data = buffer;
696 native_osd.framebuf.elems = native_osd.maxheight * native_osd.maxwidth;
697 native_osd.framebuf.get_address_fn = NULL; /*Default iterator*/
698
699 if (buffer == native_osd.back_bitmap_data)
700 native_osd.framebuf.stride = (native_osd.back_bitmap_stride);
701 else
702 native_osd.framebuf.stride = (native_osd.lcd_bitmap_stride);
703
704 rb->viewport_set_buffer(NULL, &native_osd.framebuf, SCREEN_MAIN);
705 }
706 else
707 rb->viewport_set_buffer(NULL, NULL, SCREEN_MAIN);
708}
709
689/* Native LCD, public */ 710/* Native LCD, public */
690bool osd_init(unsigned flags, void *backbuf, size_t backbuf_size, 711bool osd_init(unsigned flags, void *backbuf, size_t backbuf_size,
691 osd_draw_cb_fn_t draw_cb, int *width, int *height, 712 osd_draw_cb_fn_t draw_cb, int *width, int *height,
@@ -696,7 +717,7 @@ bool osd_init(unsigned flags, void *backbuf, size_t backbuf_size,
696 native_osd.lcd_update = rb->lcd_update; 717 native_osd.lcd_update = rb->lcd_update;
697 native_osd.lcd_update_rect = rb->lcd_update_rect; 718 native_osd.lcd_update_rect = rb->lcd_update_rect;
698 native_osd.lcd_set_viewport = rb->lcd_set_viewport; 719 native_osd.lcd_set_viewport = rb->lcd_set_viewport;
699 native_osd.lcd_set_framebuffer = (void *)rb->lcd_set_framebuffer; 720 native_osd.lcd_set_framebuffer = (void *)_osd_lcd_viewport_set_buffer;
700#if LCD_DEPTH < 4 721#if LCD_DEPTH < 4
701 native_osd.lcd_framebuffer_set_pos = NULL; 722 native_osd.lcd_framebuffer_set_pos = NULL;
702#endif /* LCD_DEPTH < 4 */ 723#endif /* LCD_DEPTH < 4 */
diff --git a/apps/plugins/lib/xlcd.h b/apps/plugins/lib/xlcd.h
index 963c7c4831..069cc00508 100644
--- a/apps/plugins/lib/xlcd.h
+++ b/apps/plugins/lib/xlcd.h
@@ -34,6 +34,8 @@ void xlcd_fillcircle_screen(struct screen* display, int cx, int cy, int radius);
34void xlcd_drawcircle(int cx, int cy, int radius); 34void xlcd_drawcircle(int cx, int cy, int radius);
35void xlcd_drawcircle_screen(struct screen* display, int cx, int cy, int radius); 35void xlcd_drawcircle_screen(struct screen* display, int cx, int cy, int radius);
36 36
37fb_data* get_framebuffer(struct viewport *vp, size_t *stride); /*CORE*/
38
37#if LCD_DEPTH >= 8 39#if LCD_DEPTH >= 8
38void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, 40void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
39 int stride, int x, int y, int width, int height); 41 int stride, int x, int y, int width, int height);
diff --git a/apps/plugins/lib/xlcd_core.c b/apps/plugins/lib/xlcd_core.c
index 47875a51a9..9a274cb48d 100644
--- a/apps/plugins/lib/xlcd_core.c
+++ b/apps/plugins/lib/xlcd_core.c
@@ -26,3 +26,12 @@
26 26
27#include "xlcd.h" 27#include "xlcd.h"
28 28
29fb_data* get_framebuffer(struct viewport *vp, size_t *stride)
30{
31 struct viewport *vp_main = *(rb->screens[SCREEN_MAIN]->current_viewport);
32 if (vp)
33 *vp = *vp_main;
34 if (stride)
35 *stride = vp_main->buffer->stride;
36 return vp_main->buffer->fb_ptr;
37}
diff --git a/apps/plugins/lib/xlcd_draw.c b/apps/plugins/lib/xlcd_draw.c
index b6ed403353..0bd1c7a9e2 100644
--- a/apps/plugins/lib/xlcd_draw.c
+++ b/apps/plugins/lib/xlcd_draw.c
@@ -349,6 +349,9 @@ static const fb_data graylut[256] = {
349void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, 349void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
350 int stride, int x, int y, int width, int height) 350 int stride, int x, int y, int width, int height)
351{ 351{
352 size_t dst_stride;
353 fb_data *lcd_fb = get_framebuffer(NULL, &dst_stride);
354
352 const unsigned char *src_end; 355 const unsigned char *src_end;
353 fb_data *dst; 356 fb_data *dst;
354 357
@@ -377,7 +380,7 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
377 380
378 src += stride * src_y + src_x; /* move starting point */ 381 src += stride * src_y + src_x; /* move starting point */
379 src_end = src + stride * height; 382 src_end = src + stride * height;
380 dst = *rb->lcd_framebuffer + LCD_WIDTH * y + x; 383 dst = lcd_fb + dst_stride * y + x;
381 384
382 do 385 do
383 { 386 {
@@ -398,7 +401,7 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
398#endif 401#endif
399 402
400 src += stride; 403 src += stride;
401 dst += LCD_WIDTH; 404 dst += dst_stride;
402 } 405 }
403 while (src < src_end); 406 while (src < src_end);
404} 407}
@@ -416,6 +419,9 @@ void xlcd_gray_bitmap(const unsigned char *src, int x, int y, int width,
416void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y, 419void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
417 int stride, int x, int y, int width, int height) 420 int stride, int x, int y, int width, int height)
418{ 421{
422 size_t dst_stride;
423 fb_data *lcd_fb = get_framebuffer(NULL, &dst_stride);
424
419 const unsigned char *src_end; 425 const unsigned char *src_end;
420 fb_data *dst; 426 fb_data *dst;
421 427
@@ -444,7 +450,7 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
444 450
445 src += 3 * (stride * src_y + src_x); /* move starting point */ 451 src += 3 * (stride * src_y + src_x); /* move starting point */
446 src_end = src + 3 * stride * height; 452 src_end = src + 3 * stride * height;
447 dst = *rb->lcd_framebuffer + LCD_WIDTH * y + x; 453 dst = lcd_fb + dst_stride * y + x;
448 454
449 do 455 do
450 { 456 {
@@ -471,7 +477,7 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y,
471 while (src_row < row_end); 477 while (src_row < row_end);
472 478
473 src += 3 * stride; 479 src += 3 * stride;
474 dst += LCD_WIDTH; 480 dst += dst_stride;
475 } 481 }
476 while (src < src_end); 482 while (src < src_end);
477} 483}
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c
index ab9ee1c4cb..89427b6118 100644
--- a/apps/plugins/lib/xlcd_scroll.c
+++ b/apps/plugins/lib/xlcd_scroll.c
@@ -33,6 +33,11 @@ static const unsigned short patterns[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
33#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE 33#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
34void xlcd_scroll_left(int count) 34void xlcd_scroll_left(int count)
35{ 35{
36 /*size_t dst_stride;*/
37 /*struct viewport *vp_main = NULL;*/
38 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
39
40
36 int length, oldmode; 41 int length, oldmode;
37 42
38 if ((unsigned)count >= LCD_WIDTH) 43 if ((unsigned)count >= LCD_WIDTH)
@@ -43,8 +48,7 @@ void xlcd_scroll_left(int count)
43 48
44 length = (LCD_WIDTH-count)*LCD_FBHEIGHT; 49 length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
45 50
46 rb->memmove(*rb->lcd_framebuffer, *rb->lcd_framebuffer + LCD_HEIGHT*count, 51 rb->memmove(lcd_fb, lcd_fb + LCD_HEIGHT*count, length * sizeof(fb_data));
47 length * sizeof(fb_data));
48 52
49 oldmode = rb->lcd_get_drawmode(); 53 oldmode = rb->lcd_get_drawmode();
50 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 54 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -55,6 +59,11 @@ void xlcd_scroll_left(int count)
55/* Scroll right */ 59/* Scroll right */
56void xlcd_scroll_right(int count) 60void xlcd_scroll_right(int count)
57{ 61{
62 /*size_t dst_stride;*/
63 /*struct viewport *vp_main = NULL;*/
64 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
65
66
58 int length, oldmode; 67 int length, oldmode;
59 68
60 if ((unsigned)count >= LCD_WIDTH) 69 if ((unsigned)count >= LCD_WIDTH)
@@ -65,8 +74,8 @@ void xlcd_scroll_right(int count)
65 74
66 length = (LCD_WIDTH-count)*LCD_FBHEIGHT; 75 length = (LCD_WIDTH-count)*LCD_FBHEIGHT;
67 76
68 rb->memmove(*rb->lcd_framebuffer + LCD_HEIGHT*count, 77 rb->memmove(lcd_fb + LCD_HEIGHT*count,
69 *rb->lcd_framebuffer, length * sizeof(fb_data)); 78 lcd_fb, length * sizeof(fb_data));
70 79
71 oldmode = rb->lcd_get_drawmode(); 80 oldmode = rb->lcd_get_drawmode();
72 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 81 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
@@ -77,6 +86,11 @@ void xlcd_scroll_right(int count)
77/* Scroll up */ 86/* Scroll up */
78void xlcd_scroll_up(int count) 87void xlcd_scroll_up(int count)
79{ 88{
89 /*size_t dst_stride;*/
90 /*struct viewport *vp_main = NULL;*/
91 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
92
93
80 int width, length, oldmode; 94 int width, length, oldmode;
81 95
82 fb_data *data; 96 fb_data *data;
@@ -90,7 +104,7 @@ void xlcd_scroll_up(int count)
90 length = LCD_HEIGHT - count; 104 length = LCD_HEIGHT - count;
91 105
92 width = LCD_WIDTH-1; 106 width = LCD_WIDTH-1;
93 data = *rb->lcd_framebuffer; 107 data = lcd_fb;
94 108
95 do { 109 do {
96 rb->memmove(data,data + count,length * sizeof(fb_data)); 110 rb->memmove(data,data + count,length * sizeof(fb_data));
@@ -106,6 +120,11 @@ void xlcd_scroll_up(int count)
106/* Scroll down */ 120/* Scroll down */
107void xlcd_scroll_down(int count) 121void xlcd_scroll_down(int count)
108{ 122{
123 /*size_t dst_stride;*/
124 /*struct viewport *vp_main = NULL;*/
125 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
126
127
109 int width, length, oldmode; 128 int width, length, oldmode;
110 129
111 fb_data *data; 130 fb_data *data;
@@ -119,7 +138,7 @@ void xlcd_scroll_down(int count)
119 length = LCD_HEIGHT - count; 138 length = LCD_HEIGHT - count;
120 139
121 width = LCD_WIDTH-1; 140 width = LCD_WIDTH-1;
122 data = *rb->lcd_framebuffer; 141 data = lcd_fb;
123 142
124 do { 143 do {
125 rb->memmove(data + count, data, length * sizeof(fb_data)); 144 rb->memmove(data + count, data, length * sizeof(fb_data));
@@ -138,6 +157,11 @@ void xlcd_scroll_down(int count)
138/* Scroll left */ 157/* Scroll left */
139void xlcd_scroll_left(int count) 158void xlcd_scroll_left(int count)
140{ 159{
160 /*size_t dst_stride;*/
161 /*struct viewport *vp_main = NULL;*/
162 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
163
164
141 int bitcount=0, oldmode; 165 int bitcount=0, oldmode;
142 int blockcount=0, blocklen; 166 int blockcount=0, blocklen;
143 167
@@ -155,7 +179,7 @@ void xlcd_scroll_left(int count)
155 179
156 if (blockcount) 180 if (blockcount)
157 { 181 {
158 unsigned char *data = *rb->lcd_framebuffer; 182 unsigned char *data = lcd_fb;
159 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT; 183 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
160 184
161 do 185 do
@@ -168,7 +192,7 @@ void xlcd_scroll_left(int count)
168 if (bitcount) 192 if (bitcount)
169 { 193 {
170 int bx, y; 194 int bx, y;
171 unsigned char *addr = *rb->lcd_framebuffer + blocklen; 195 unsigned char *addr = lcd_fb + blocklen;
172#if LCD_DEPTH == 2 196#if LCD_DEPTH == 2
173 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount; 197 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
174#endif 198#endif
@@ -196,6 +220,11 @@ void xlcd_scroll_left(int count)
196/* Scroll right */ 220/* Scroll right */
197void xlcd_scroll_right(int count) 221void xlcd_scroll_right(int count)
198{ 222{
223 /*size_t dst_stride;*/
224 /*struct viewport *vp_main = NULL;*/
225 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
226
227
199 int bitcount=0, oldmode; 228 int bitcount=0, oldmode;
200 int blockcount=0, blocklen; 229 int blockcount=0, blocklen;
201 230
@@ -213,7 +242,7 @@ void xlcd_scroll_right(int count)
213 242
214 if (blockcount) 243 if (blockcount)
215 { 244 {
216 unsigned char *data = *rb->lcd_framebuffer; 245 unsigned char *data = lcd_fb;
217 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT; 246 unsigned char *data_end = data + LCD_FBWIDTH*LCD_HEIGHT;
218 247
219 do 248 do
@@ -226,7 +255,7 @@ void xlcd_scroll_right(int count)
226 if (bitcount) 255 if (bitcount)
227 { 256 {
228 int bx, y; 257 int bx, y;
229 unsigned char *addr = *rb->lcd_framebuffer + blockcount; 258 unsigned char *addr = lcd_fb + blockcount;
230#if LCD_DEPTH == 2 259#if LCD_DEPTH == 2
231 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3); 260 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
232#endif 261#endif
@@ -256,6 +285,11 @@ void xlcd_scroll_right(int count)
256/* Scroll left */ 285/* Scroll left */
257void xlcd_scroll_left(int count) 286void xlcd_scroll_left(int count)
258{ 287{
288 /*size_t dst_stride;*/
289 /*struct viewport *vp_main = NULL;*/
290 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
291
292
259 fb_data *data, *data_end; 293 fb_data *data, *data_end;
260 int length, oldmode; 294 int length, oldmode;
261 295
@@ -265,7 +299,7 @@ void xlcd_scroll_left(int count)
265 return; 299 return;
266 } 300 }
267 301
268 data = *rb->lcd_framebuffer; 302 data = lcd_fb;
269 data_end = data + LCD_WIDTH*LCD_FBHEIGHT; 303 data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
270 length = LCD_WIDTH - count; 304 length = LCD_WIDTH - count;
271 305
@@ -285,6 +319,11 @@ void xlcd_scroll_left(int count)
285/* Scroll right */ 319/* Scroll right */
286void xlcd_scroll_right(int count) 320void xlcd_scroll_right(int count)
287{ 321{
322 /*size_t dst_stride;*/
323 /*struct viewport *vp_main = NULL;*/
324 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
325
326
288 fb_data *data, *data_end; 327 fb_data *data, *data_end;
289 int length, oldmode; 328 int length, oldmode;
290 329
@@ -294,7 +333,7 @@ void xlcd_scroll_right(int count)
294 return; 333 return;
295 } 334 }
296 335
297 data = *rb->lcd_framebuffer; 336 data = lcd_fb;
298 data_end = data + LCD_WIDTH*LCD_FBHEIGHT; 337 data_end = data + LCD_WIDTH*LCD_FBHEIGHT;
299 length = LCD_WIDTH - count; 338 length = LCD_WIDTH - count;
300 339
@@ -318,6 +357,10 @@ void xlcd_scroll_right(int count)
318/* Scroll up */ 357/* Scroll up */
319void xlcd_scroll_up(int count) 358void xlcd_scroll_up(int count)
320{ 359{
360 /*size_t dst_stride;*/
361 /*struct viewport *vp_main = NULL;*/
362 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
363
321 int length, oldmode; 364 int length, oldmode;
322 365
323 if ((unsigned)count >= LCD_HEIGHT) 366 if ((unsigned)count >= LCD_HEIGHT)
@@ -328,8 +371,8 @@ void xlcd_scroll_up(int count)
328 371
329 length = LCD_HEIGHT - count; 372 length = LCD_HEIGHT - count;
330 373
331 rb->memmove(*rb->lcd_framebuffer, 374 rb->memmove(lcd_fb,
332 *rb->lcd_framebuffer + count * LCD_FBWIDTH, 375 lcd_fb + count * LCD_FBWIDTH,
333 length * LCD_FBWIDTH * sizeof(fb_data)); 376 length * LCD_FBWIDTH * sizeof(fb_data));
334 377
335 oldmode = rb->lcd_get_drawmode(); 378 oldmode = rb->lcd_get_drawmode();
@@ -341,6 +384,10 @@ void xlcd_scroll_up(int count)
341/* Scroll down */ 384/* Scroll down */
342void xlcd_scroll_down(int count) 385void xlcd_scroll_down(int count)
343{ 386{
387 /*size_t dst_stride;*/
388 /*struct viewport *vp_main = NULL;*/
389 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
390
344 int length, oldmode; 391 int length, oldmode;
345 392
346 if ((unsigned)count >= LCD_HEIGHT) 393 if ((unsigned)count >= LCD_HEIGHT)
@@ -351,8 +398,8 @@ void xlcd_scroll_down(int count)
351 398
352 length = LCD_HEIGHT - count; 399 length = LCD_HEIGHT - count;
353 400
354 rb->memmove(*rb->lcd_framebuffer + count * LCD_FBWIDTH, 401 rb->memmove(lcd_fb + count * LCD_FBWIDTH,
355 *rb->lcd_framebuffer, 402 lcd_fb,
356 length * LCD_FBWIDTH * sizeof(fb_data)); 403 length * LCD_FBWIDTH * sizeof(fb_data));
357 404
358 oldmode = rb->lcd_get_drawmode(); 405 oldmode = rb->lcd_get_drawmode();
@@ -367,6 +414,10 @@ void xlcd_scroll_down(int count)
367/* Scroll up */ 414/* Scroll up */
368void xlcd_scroll_up(int count) 415void xlcd_scroll_up(int count)
369{ 416{
417 /*size_t dst_stride;*/
418 /*struct viewport *vp_main = NULL;*/
419 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
420
370 int bitcount=0, oldmode; 421 int bitcount=0, oldmode;
371 int blockcount=0, blocklen; 422 int blockcount=0, blocklen;
372 423
@@ -388,8 +439,8 @@ void xlcd_scroll_up(int count)
388 439
389 if (blockcount) 440 if (blockcount)
390 { 441 {
391 rb->memmove(*rb->lcd_framebuffer, 442 rb->memmove(lcd_fb,
392 *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH, 443 lcd_fb + blockcount * LCD_FBWIDTH,
393 blocklen * LCD_FBWIDTH * sizeof(fb_data)); 444 blocklen * LCD_FBWIDTH * sizeof(fb_data));
394 } 445 }
395 if (bitcount) 446 if (bitcount)
@@ -424,7 +475,7 @@ void xlcd_scroll_up(int count)
424 : /* inputs */ 475 : /* inputs */
425 [wide]"r"(LCD_FBWIDTH), 476 [wide]"r"(LCD_FBWIDTH),
426 [rows]"r"(blocklen), 477 [rows]"r"(blocklen),
427 [addr]"a"(*rb->lcd_framebuffer + blocklen * LCD_FBWIDTH), 478 [addr]"a"(lcd_fb + blocklen * LCD_FBWIDTH),
428 [cnt] "d"(bitcount), 479 [cnt] "d"(bitcount),
429 [bkg] "d"(0x55 * (~rb->lcd_get_background() & 3)) 480 [bkg] "d"(0x55 * (~rb->lcd_get_background() & 3))
430 : /* clobbers */ 481 : /* clobbers */
@@ -432,7 +483,7 @@ void xlcd_scroll_up(int count)
432 ); 483 );
433#else /* C version */ 484#else /* C version */
434 int x, by; 485 int x, by;
435 unsigned char *addr = *rb->lcd_framebuffer + blocklen * LCD_FBWIDTH; 486 unsigned char *addr = lcd_fb + blocklen * LCD_FBWIDTH;
436#if LCD_DEPTH == 2 487#if LCD_DEPTH == 2
437 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3); 488 unsigned fill = 0x55 * (~rb->lcd_get_background() & 3);
438#else 489#else
@@ -457,7 +508,7 @@ void xlcd_scroll_up(int count)
457 508
458#if LCD_DEPTH == 2 509#if LCD_DEPTH == 2
459 int x, by; 510 int x, by;
460 fb_data *addr = *rb->lcd_framebuffer + blocklen * LCD_FBWIDTH; 511 fb_data *addr = lcd_fb + blocklen * LCD_FBWIDTH;
461 unsigned fill, mask; 512 unsigned fill, mask;
462 513
463 fill = patterns[rb->lcd_get_background() & 3] << 8; 514 fill = patterns[rb->lcd_get_background() & 3] << 8;
@@ -491,6 +542,10 @@ void xlcd_scroll_up(int count)
491/* Scroll up */ 542/* Scroll up */
492void xlcd_scroll_down(int count) 543void xlcd_scroll_down(int count)
493{ 544{
545 /*size_t dst_stride;*/
546 /*struct viewport *vp_main = NULL;*/
547 fb_data *lcd_fb = get_framebuffer(NULL, NULL);
548
494 int bitcount=0, oldmode; 549 int bitcount=0, oldmode;
495 int blockcount=0, blocklen; 550 int blockcount=0, blocklen;
496 551
@@ -512,8 +567,8 @@ void xlcd_scroll_down(int count)
512 567
513 if (blockcount) 568 if (blockcount)
514 { 569 {
515 rb->memmove(*rb->lcd_framebuffer + blockcount * LCD_FBWIDTH, 570 rb->memmove(lcd_fb + blockcount * LCD_FBWIDTH,
516 *rb->lcd_framebuffer, 571 lcd_fb,
517 blocklen * LCD_FBWIDTH * sizeof(fb_data)); 572 blocklen * LCD_FBWIDTH * sizeof(fb_data));
518 } 573 }
519 if (bitcount) 574 if (bitcount)
@@ -548,7 +603,7 @@ void xlcd_scroll_down(int count)
548 : /* inputs */ 603 : /* inputs */
549 [wide]"r"(LCD_WIDTH), 604 [wide]"r"(LCD_WIDTH),
550 [rows]"r"(blocklen), 605 [rows]"r"(blocklen),
551 [addr]"a"(*rb->lcd_framebuffer + blockcount * LCD_FBWIDTH), 606 [addr]"a"(lcd_fb + blockcount * LCD_FBWIDTH),
552 [cnt] "d"(bitcount), 607 [cnt] "d"(bitcount),
553 [bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount) 608 [bkg] "d"((0x55 * (~rb->lcd_get_background() & 3)) << bitcount)
554 : /* clobbers */ 609 : /* clobbers */
@@ -556,7 +611,7 @@ void xlcd_scroll_down(int count)
556 ); 611 );
557#else /* C version */ 612#else /* C version */
558 int x, by; 613 int x, by;
559 unsigned char *addr = *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH; 614 unsigned char *addr = lcd_fb + blockcount * LCD_FBWIDTH;
560#if LCD_DEPTH == 2 615#if LCD_DEPTH == 2
561 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount; 616 unsigned fill = (0x55 * (~rb->lcd_get_background() & 3)) << bitcount;
562#else 617#else
@@ -581,7 +636,7 @@ void xlcd_scroll_down(int count)
581 636
582#if LCD_DEPTH == 2 637#if LCD_DEPTH == 2
583 int x, by; 638 int x, by;
584 fb_data *addr = *rb->lcd_framebuffer + blockcount * LCD_FBWIDTH; 639 fb_data *addr = lcd_fb + blockcount * LCD_FBWIDTH;
585 unsigned fill, mask; 640 unsigned fill, mask;
586 641
587 fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount); 642 fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount);