diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-23 13:20:35 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2008-06-23 13:20:35 +0000 |
| commit | bdbdb97f19655a635a2d37f81f9fe1e31f9162b2 (patch) | |
| tree | ea5672478b70e550910bc179a7644afa70c0d057 /firmware/drivers | |
| parent | c1b8df05e1def3096ff6d2ea55f23b2e72936fce (diff) | |
| download | rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.zip rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.tar.gz rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.tar.bz2 rockbox-bdbdb97f19655a635a2d37f81f9fe1e31f9162b2.tar.xz | |
FS#9051 - remove LCD margins... use viewports if you need them...
NOTE to WPS people....
%m has been removed, but (i think) because of the other %m tags it wont fail if you try loading a wps with %m|..|, it will just be ignored.
Also note that if the statusbar is enabled the default viewport is 8 pixels shorter than when its not, i.e (0,0) is really (0,8) if the statusbar is shown... I dont think this will be a major issue because almost no WPS show the bar and use bitmaps... text only WPS shouldnt be affected.
Please report problem screens in http://forums.rockbox.org/index.php?topic=17358.0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17763 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
| -rw-r--r-- | firmware/drivers/lcd-16bit.c | 30 | ||||
| -rw-r--r-- | firmware/drivers/lcd-1bit-vert.c | 30 | ||||
| -rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 30 | ||||
| -rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 30 | ||||
| -rw-r--r-- | firmware/drivers/lcd-2bit-vi.c | 31 | ||||
| -rw-r--r-- | firmware/drivers/lcd-charcell.c | 26 |
6 files changed, 34 insertions, 143 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 020d6bf..a5b7533 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -61,8 +61,6 @@ static struct viewport default_vp = .height = LCD_HEIGHT, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG, .lss_pattern = LCD_DEFAULT_BG, @@ -180,12 +178,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_color, unsigned bg_color) current_vp->bg_pattern = bg_color; } -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - int lcd_getwidth(void) { return current_vp->width; @@ -196,16 +188,6 @@ int lcd_getheight(void) return current_vp->height; } -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - void lcd_setfont(int newfont) { current_vp->font = newfont; @@ -1005,8 +987,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, return; lcd_getstringsize(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length(str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length(str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; if (style & STYLE_COLORED) { @@ -1081,7 +1063,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, lcd_getstringsize(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -1094,7 +1076,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1113,7 +1095,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, s->y = y; s->len = utf8length(string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len; + s->startx = x * s->width / s->len; s->backward = false; lcd_scroll_info.lines++; } @@ -1159,7 +1141,7 @@ void lcd_scroll_fn(void) pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index c6fe40c..ffc78bd 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c @@ -56,8 +56,6 @@ static struct viewport default_vp = .height = LCDM(HEIGHT), .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, }; static struct viewport* current_vp = &default_vp; @@ -107,22 +105,6 @@ int LCDFN(get_drawmode)(void) return current_vp->drawmode; } -void LCDFN(setmargins)(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int LCDFN(getxmargin)(void) -{ - return current_vp->xmargin; -} - -int LCDFN(getymargin)(void) -{ - return current_vp->ymargin; -} - int LCDFN(getwidth)(void) { return current_vp->width; @@ -760,8 +742,8 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str, return; LCDFN(getstringsize)(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length(str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length(str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; LCDFN(putsxyofs)(xpos, ypos, offset, str); @@ -816,7 +798,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, LCDFN(getstringsize)(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -829,7 +811,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, /* scroll bidirectional or forward only depending on the string width */ if ( LCDFN(scroll_info).bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + LCDFN(scroll_info).bidir_limit) / 100; } else @@ -848,7 +830,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, s->y = y; s->len = utf8length(string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len;; + s->startx = x * s->width / s->len;; s->backward = false; LCDFN(scroll_info).lines++; @@ -880,7 +862,7 @@ void LCDFN(scroll_fn)(void) pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 30901ef..0818c29 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c @@ -54,8 +54,6 @@ static struct viewport default_vp = .height = LCD_HEIGHT, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG }; @@ -141,22 +139,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness) lcd_set_background(bg_brightness); } -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - int lcd_getwidth(void) { return current_vp->width; @@ -950,8 +932,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, return; lcd_getstringsize(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length((char *)str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length((char *)str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); @@ -1003,7 +985,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, lcd_getstringsize(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -1016,7 +998,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1035,7 +1017,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, s->y = y; s->len = utf8length((char *)string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len;; + s->startx = x * s->width / s->len;; s->backward = false; lcd_scroll_info.lines++; } @@ -1066,7 +1048,7 @@ void lcd_scroll_fn(void) pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index d43bf6c..285a592 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c @@ -56,8 +56,6 @@ static struct viewport default_vp = .height = LCD_HEIGHT, .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCD_DEFAULT_FG, .bg_pattern = LCD_DEFAULT_BG }; @@ -144,22 +142,6 @@ void lcd_set_drawinfo(int mode, unsigned fg_brightness, unsigned bg_brightness) lcd_set_background(bg_brightness); } -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - int lcd_getwidth(void) { return current_vp->width; @@ -1088,8 +1070,8 @@ void lcd_puts_style_offset(int x, int y, const unsigned char *str, return; lcd_getstringsize(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length((char *)str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length((char *)str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; lcd_putsxyofs(xpos, ypos, offset, str); @@ -1142,7 +1124,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, lcd_getstringsize(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8< w) { /* prepare scroll line */ char *end; @@ -1155,7 +1137,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, /* scroll bidirectional or forward only depending on the string width */ if ( lcd_scroll_info.bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -1174,7 +1156,7 @@ void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, s->y = y; s->len = utf8length((char *)string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len; + s->startx = x * s->width / s->len; s->backward = false; lcd_scroll_info.lines++; @@ -1206,7 +1188,7 @@ void lcd_scroll_fn(void) pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index 7d97f19..9decc0c 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c @@ -60,8 +60,6 @@ static struct viewport default_vp = .height = LCDM(HEIGHT), .font = FONT_SYSFIXED, .drawmode = DRMODE_SOLID, - .xmargin = 0, - .ymargin = 0, .fg_pattern = LCDM(DEFAULT_FG), .bg_pattern = LCDM(DEFAULT_BG) }; @@ -175,23 +173,6 @@ int LCDFN(getheight)(void) { return current_vp->height; } - -void LCDFN(setmargins)(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int LCDFN(getxmargin)(void) -{ - return current_vp->xmargin; -} - -int LCDFN(getymargin)(void) -{ - return current_vp->ymargin; -} - void LCDFN(setfont)(int newfont) { current_vp->font = newfont; @@ -1105,8 +1086,8 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str, return; LCDFN(getstringsize)(str, &w, &h); - xpos = current_vp->xmargin + x*w / utf8length((char *)str); - ypos = current_vp->ymargin + y*h; + xpos = x*w / utf8length((char *)str); + ypos = y*h; current_vp->drawmode = (style & STYLE_INVERT) ? (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; LCDFN(putsxyofs)(xpos, ypos, offset, str); @@ -1158,7 +1139,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, LCDFN(getstringsize)(string, &w, &h); - if (current_vp->width - x * 8 - current_vp->xmargin < w) { + if (current_vp->width - x * 8 < w) { /* prepare scroll line */ char *end; @@ -1171,7 +1152,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, /* scroll bidirectional or forward only depending on the string width */ if ( LCDFN(scroll_info).bidir_limit ) { - s->bidir = s->width < (current_vp->width - current_vp->xmargin) * + s->bidir = s->width < (current_vp->width) * (100 + LCDFN(scroll_info).bidir_limit) / 100; } else @@ -1190,7 +1171,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string, s->y = y; s->len = utf8length((char *)string); s->offset = offset; - s->startx = current_vp->xmargin + x * s->width / s->len; + s->startx = x * s->width / s->len; s->backward = false; LCDFN(scroll_info).lines++; @@ -1222,7 +1203,7 @@ void LCDFN(scroll_fn)(void) pf = font_get(current_vp->font); xpos = s->startx; - ypos = current_vp->ymargin + s->y * pf->height; + ypos = s->y * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { diff --git a/firmware/drivers/lcd-charcell.c b/firmware/drivers/lcd-charcell.c index 1bc634c..1c43b83 100644 --- a/firmware/drivers/lcd-charcell.c +++ b/firmware/drivers/lcd-charcell.c @@ -58,8 +58,6 @@ static struct viewport default_vp = .y = 0, .width = LCD_WIDTH, .height = LCD_HEIGHT, - .xmargin = 0, - .ymargin = 0, }; static struct viewport* current_vp = &default_vp; @@ -92,22 +90,6 @@ void lcd_update_viewport(void) /** parameter handling **/ -void lcd_setmargins(int x, int y) -{ - current_vp->xmargin = x; - current_vp->ymargin = y; -} - -int lcd_getxmargin(void) -{ - return current_vp->xmargin; -} - -int lcd_getymargin(void) -{ - return current_vp->ymargin; -} - int lcd_getwidth(void) { return current_vp->width; @@ -484,7 +466,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, lcd_puts_offset(x, y, string, offset); len = utf8length(string); - if (current_vp->width - x - current_vp->xmargin < len) + if (current_vp->width - x < len) { /* prepare scroll line */ char *end; @@ -498,7 +480,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, /* scroll bidirectional or forward only depending on the string width */ if (lcd_scroll_info.bidir_limit) { - s->bidir = s->len < (current_vp->width - current_vp->xmargin) * + s->bidir = s->len < (current_vp->width) * (100 + lcd_scroll_info.bidir_limit) / 100; } else @@ -517,7 +499,7 @@ void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, s->vp = current_vp; s->y = y; s->offset = offset; - s->startx = current_vp->xmargin + x; + s->startx = x; s->backward = false; lcd_scroll_info.lines++; } @@ -547,7 +529,7 @@ void lcd_scroll_fn(void) s->offset++; xpos = s->startx; - ypos = current_vp->ymargin + s->y; + ypos = s->y; if (s->bidir) /* scroll bidirectional */ { |