summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-1bit-vert.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-1bit-vert.c')
-rw-r--r--firmware/drivers/lcd-1bit-vert.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c
index c6fe40cdb7..ffc78bd53a 100644
--- a/firmware/drivers/lcd-1bit-vert.c
+++ b/firmware/drivers/lcd-1bit-vert.c
@@ -56,8 +56,6 @@ static struct viewport default_vp =
56 .height = LCDM(HEIGHT), 56 .height = LCDM(HEIGHT),
57 .font = FONT_SYSFIXED, 57 .font = FONT_SYSFIXED,
58 .drawmode = DRMODE_SOLID, 58 .drawmode = DRMODE_SOLID,
59 .xmargin = 0,
60 .ymargin = 0,
61}; 59};
62 60
63static struct viewport* current_vp = &default_vp; 61static struct viewport* current_vp = &default_vp;
@@ -107,22 +105,6 @@ int LCDFN(get_drawmode)(void)
107 return current_vp->drawmode; 105 return current_vp->drawmode;
108} 106}
109 107
110void LCDFN(setmargins)(int x, int y)
111{
112 current_vp->xmargin = x;
113 current_vp->ymargin = y;
114}
115
116int LCDFN(getxmargin)(void)
117{
118 return current_vp->xmargin;
119}
120
121int LCDFN(getymargin)(void)
122{
123 return current_vp->ymargin;
124}
125
126int LCDFN(getwidth)(void) 108int LCDFN(getwidth)(void)
127{ 109{
128 return current_vp->width; 110 return current_vp->width;
@@ -760,8 +742,8 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
760 return; 742 return;
761 743
762 LCDFN(getstringsize)(str, &w, &h); 744 LCDFN(getstringsize)(str, &w, &h);
763 xpos = current_vp->xmargin + x*w / utf8length(str); 745 xpos = x*w / utf8length(str);
764 ypos = current_vp->ymargin + y*h; 746 ypos = y*h;
765 current_vp->drawmode = (style & STYLE_INVERT) ? 747 current_vp->drawmode = (style & STYLE_INVERT) ?
766 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 748 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
767 LCDFN(putsxyofs)(xpos, ypos, offset, str); 749 LCDFN(putsxyofs)(xpos, ypos, offset, str);
@@ -816,7 +798,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
816 798
817 LCDFN(getstringsize)(string, &w, &h); 799 LCDFN(getstringsize)(string, &w, &h);
818 800
819 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 801 if (current_vp->width - x * 8 < w) {
820 /* prepare scroll line */ 802 /* prepare scroll line */
821 char *end; 803 char *end;
822 804
@@ -829,7 +811,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
829 /* scroll bidirectional or forward only depending on the string 811 /* scroll bidirectional or forward only depending on the string
830 width */ 812 width */
831 if ( LCDFN(scroll_info).bidir_limit ) { 813 if ( LCDFN(scroll_info).bidir_limit ) {
832 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 814 s->bidir = s->width < (current_vp->width) *
833 (100 + LCDFN(scroll_info).bidir_limit) / 100; 815 (100 + LCDFN(scroll_info).bidir_limit) / 100;
834 } 816 }
835 else 817 else
@@ -848,7 +830,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
848 s->y = y; 830 s->y = y;
849 s->len = utf8length(string); 831 s->len = utf8length(string);
850 s->offset = offset; 832 s->offset = offset;
851 s->startx = current_vp->xmargin + x * s->width / s->len;; 833 s->startx = x * s->width / s->len;;
852 s->backward = false; 834 s->backward = false;
853 835
854 LCDFN(scroll_info).lines++; 836 LCDFN(scroll_info).lines++;
@@ -880,7 +862,7 @@ void LCDFN(scroll_fn)(void)
880 862
881 pf = font_get(current_vp->font); 863 pf = font_get(current_vp->font);
882 xpos = s->startx; 864 xpos = s->startx;
883 ypos = current_vp->ymargin + s->y * pf->height; 865 ypos = s->y * pf->height;
884 866
885 if (s->bidir) { /* scroll bidirectional */ 867 if (s->bidir) { /* scroll bidirectional */
886 if (s->offset <= 0) { 868 if (s->offset <= 0) {