summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/grey_scroll.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/grey_scroll.c')
-rw-r--r--apps/plugins/lib/grey_scroll.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/apps/plugins/lib/grey_scroll.c b/apps/plugins/lib/grey_scroll.c
index 35f73b7..78e5725 100644
--- a/apps/plugins/lib/grey_scroll.c
+++ b/apps/plugins/lib/grey_scroll.c
@@ -28,11 +28,14 @@
#include "plugin.h"
#include "grey.h"
+extern struct viewport _grey_default_vp;
+
/*** Scrolling ***/
/* Scroll left */
void grey_scroll_left(int count)
{
+ struct viewport *vp = &_grey_default_vp;
unsigned char *data, *data_end;
int length, blank;
@@ -45,8 +48,8 @@ void grey_scroll_left(int count)
data = _grey_info.buffer;
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = _grey_info.width - count;
- blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness : _grey_info.bg_brightness;
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
do
{
@@ -61,6 +64,7 @@ void grey_scroll_left(int count)
/* Scroll right */
void grey_scroll_right(int count)
{
+ struct viewport *vp = &_grey_default_vp;
unsigned char *data, *data_end;
int length, blank;
@@ -73,8 +77,8 @@ void grey_scroll_right(int count)
data = _grey_info.buffer;
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = _grey_info.width - count;
- blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness : _grey_info.bg_brightness;
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
do
{
@@ -88,6 +92,7 @@ void grey_scroll_right(int count)
/* Scroll up */
void grey_scroll_up(int count)
{
+ struct viewport *vp = &_grey_default_vp;
long shift, length;
int blank;
@@ -99,8 +104,8 @@ void grey_scroll_up(int count)
shift = _GREY_MULUQ(_grey_info.width, count);
length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
- blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness : _grey_info.bg_brightness;
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
rb->memmove(_grey_info.buffer, _grey_info.buffer + shift,
length);
@@ -110,6 +115,7 @@ void grey_scroll_up(int count)
/* Scroll down */
void grey_scroll_down(int count)
{
+ struct viewport *vp = &_grey_default_vp;
long shift, length;
int blank;
@@ -121,8 +127,8 @@ void grey_scroll_down(int count)
shift = _GREY_MULUQ(_grey_info.width, count);
length = _GREY_MULUQ(_grey_info.width, _grey_info.height - count);
- blank = (_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness : _grey_info.bg_brightness;
+ blank = (vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) : _GREY_BG_BRIGHTNESS(vp);
rb->memmove(_grey_info.buffer + shift, _grey_info.buffer,
length);
@@ -134,6 +140,7 @@ void grey_scroll_down(int count)
/* Scroll left */
void grey_ub_scroll_left(int count)
{
+ struct viewport *vp = &_grey_default_vp;
unsigned char *data, *data_end;
int blank, length;
@@ -147,9 +154,9 @@ void grey_ub_scroll_left(int count)
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = (_grey_info.width - count) << _GREY_BSHIFT;
count <<= _GREY_BSHIFT;
- blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness :
- _grey_info.bg_brightness];
+ blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) :
+ _GREY_BG_BRIGHTNESS(vp)];
do
{
rb->memmove(data, data + count, length);
@@ -167,6 +174,7 @@ void grey_ub_scroll_left(int count)
/* Scroll right */
void grey_ub_scroll_right(int count)
{
+ struct viewport *vp = &_grey_default_vp;
unsigned char *data, *data_end;
int blank, length;
@@ -180,9 +188,9 @@ void grey_ub_scroll_right(int count)
data_end = data + _GREY_MULUQ(_grey_info.width, _grey_info.height);
length = (_grey_info.width - count) << _GREY_BSHIFT;
count <<= _GREY_BSHIFT;
- blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness :
- _grey_info.bg_brightness];
+ blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) :
+ _GREY_BG_BRIGHTNESS(vp)];
do
{
rb->memmove(data + count, data, length);
@@ -199,6 +207,7 @@ void grey_ub_scroll_right(int count)
/* Scroll up */
void grey_ub_scroll_up(int count)
{
+ struct viewport *vp = &_grey_default_vp;
unsigned char *dst, *end, *src;
int blank;
@@ -210,9 +219,9 @@ void grey_ub_scroll_up(int count)
dst = _grey_info.values;
end = dst + _GREY_MULUQ(_grey_info.height, _grey_info.width);
- blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness :
- _grey_info.bg_brightness];
+ blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) :
+ _GREY_BG_BRIGHTNESS(vp)];
#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
|| (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
@@ -274,6 +283,7 @@ void grey_ub_scroll_up(int count)
/* Scroll down */
void grey_ub_scroll_down(int count)
{
+ struct viewport *vp = &_grey_default_vp;
unsigned char *start, *dst;
int blank;
@@ -285,9 +295,9 @@ void grey_ub_scroll_down(int count)
start = _grey_info.values;
dst = start + _GREY_MULUQ(_grey_info.height, _grey_info.width);
- blank = _grey_info.gvalue[(_grey_info.drawmode & DRMODE_INVERSEVID) ?
- _grey_info.fg_brightness :
- _grey_info.bg_brightness];
+ blank = _grey_info.gvalue[(vp->drawmode & DRMODE_INVERSEVID) ?
+ _GREY_FG_BRIGHTNESS(vp) :
+ _GREY_BG_BRIGHTNESS(vp)];
#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
|| (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)