summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-2bit-horz.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-2bit-horz.c')
-rw-r--r--firmware/drivers/lcd-2bit-horz.c30
1 files changed, 6 insertions, 24 deletions
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c
index 30901efb98..0818c29d47 100644
--- a/firmware/drivers/lcd-2bit-horz.c
+++ b/firmware/drivers/lcd-2bit-horz.c
@@ -54,8 +54,6 @@ static struct viewport default_vp =
54 .height = LCD_HEIGHT, 54 .height = LCD_HEIGHT,
55 .font = FONT_SYSFIXED, 55 .font = FONT_SYSFIXED,
56 .drawmode = DRMODE_SOLID, 56 .drawmode = DRMODE_SOLID,
57 .xmargin = 0,
58 .ymargin = 0,
59 .fg_pattern = LCD_DEFAULT_FG, 57 .fg_pattern = LCD_DEFAULT_FG,
60 .bg_pattern = LCD_DEFAULT_BG 58 .bg_pattern = LCD_DEFAULT_BG
61}; 59};
@@ -141,22 +139,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness)
141 lcd_set_background(bg_brightness); 139 lcd_set_background(bg_brightness);
142} 140}
143 141
144void lcd_setmargins(int x, int y)
145{
146 current_vp->xmargin = x;
147 current_vp->ymargin = y;
148}
149
150int lcd_getxmargin(void)
151{
152 return current_vp->xmargin;
153}
154
155int lcd_getymargin(void)
156{
157 return current_vp->ymargin;
158}
159
160int lcd_getwidth(void) 142int lcd_getwidth(void)
161{ 143{
162 return current_vp->width; 144 return current_vp->width;
@@ -950,8 +932,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str,
950 return; 932 return;
951 933
952 lcd_getstringsize(str, &w, &h); 934 lcd_getstringsize(str, &w, &h);
953 xpos = current_vp->xmargin + x*w / utf8length((char *)str); 935 xpos = x*w / utf8length((char *)str);
954 ypos = current_vp->ymargin + y*h; 936 ypos = y*h;
955 current_vp->drawmode = (style & STYLE_INVERT) ? 937 current_vp->drawmode = (style & STYLE_INVERT) ?
956 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; 938 (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID;
957 lcd_putsxyofs(xpos, ypos, offset, str); 939 lcd_putsxyofs(xpos, ypos, offset, str);
@@ -1003,7 +985,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1003 985
1004 lcd_getstringsize(string, &w, &h); 986 lcd_getstringsize(string, &w, &h);
1005 987
1006 if (current_vp->width - x * 8 - current_vp->xmargin < w) { 988 if (current_vp->width - x * 8 < w) {
1007 /* prepare scroll line */ 989 /* prepare scroll line */
1008 char *end; 990 char *end;
1009 991
@@ -1016,7 +998,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1016 /* scroll bidirectional or forward only depending on the string 998 /* scroll bidirectional or forward only depending on the string
1017 width */ 999 width */
1018 if ( lcd_scroll_info.bidir_limit ) { 1000 if ( lcd_scroll_info.bidir_limit ) {
1019 s->bidir = s->width < (current_vp->width - current_vp->xmargin) * 1001 s->bidir = s->width < (current_vp->width) *
1020 (100 + lcd_scroll_info.bidir_limit) / 100; 1002 (100 + lcd_scroll_info.bidir_limit) / 100;
1021 } 1003 }
1022 else 1004 else
@@ -1035,7 +1017,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
1035 s->y = y; 1017 s->y = y;
1036 s->len = utf8length((char *)string); 1018 s->len = utf8length((char *)string);
1037 s->offset = offset; 1019 s->offset = offset;
1038 s->startx = current_vp->xmargin + x * s->width / s->len;; 1020 s->startx = x * s->width / s->len;;
1039 s->backward = false; 1021 s->backward = false;
1040 lcd_scroll_info.lines++; 1022 lcd_scroll_info.lines++;
1041 } 1023 }
@@ -1066,7 +1048,7 @@ void lcd_scroll_fn(void)
1066 1048
1067 pf = font_get(current_vp->font); 1049 pf = font_get(current_vp->font);
1068 xpos = s->startx; 1050 xpos = s->startx;
1069 ypos = current_vp->ymargin + s->y * pf->height; 1051 ypos = s->y * pf->height;
1070 1052
1071 if (s->bidir) { /* scroll bidirectional */ 1053 if (s->bidir) { /* scroll bidirectional */
1072 if (s->offset <= 0) { 1054 if (s->offset <= 0) {