diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-03-16 21:56:08 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-03-16 21:56:08 +0000 |
commit | 4d6374c9236b93e0bd457f99944164fc493d1120 (patch) | |
tree | ff9630fcef66e63c61cc0a74e97f21220e668f75 /apps/gui/splash.c | |
parent | 2c643b9f3e22ee07f7949a5471f726758dc40841 (diff) | |
download | rockbox-4d6374c9236b93e0bd457f99944164fc493d1120.tar.gz rockbox-4d6374c9236b93e0bd457f99944164fc493d1120.zip |
Get rid of the 'center' parameter for splashes. There were only 2 of almost 500 splashes which were not centered.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12807 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/splash.c')
-rw-r--r-- | apps/gui/splash.c | 64 |
1 files changed, 26 insertions, 38 deletions
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 30909217b2..4234171207 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -39,8 +39,7 @@ | |||
39 | 39 | ||
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | static void splash(struct screen * screen, bool center, | 42 | static void splash(struct screen * screen, const char *fmt, va_list ap) |
43 | const char *fmt, va_list ap) | ||
44 | { | 43 | { |
45 | char splash_buf[MAXBUFFER]; | 44 | char splash_buf[MAXBUFFER]; |
46 | short widths[MAXLINES]; | 45 | short widths[MAXLINES]; |
@@ -127,43 +126,33 @@ static void splash(struct screen * screen, bool center, | |||
127 | #ifdef HAVE_LCD_BITMAP | 126 | #ifdef HAVE_LCD_BITMAP |
128 | /* If we center the display, then just clear the box we need and put | 127 | /* If we center the display, then just clear the box we need and put |
129 | a nice little frame and put the text in there! */ | 128 | a nice little frame and put the text in there! */ |
130 | if (center) | 129 | y = (screen->height - y) / 2; /* height => y start position */ |
131 | { | 130 | x = (screen->width - maxw) / 2 - 2; |
132 | y = (screen->height - y) / 2; /* height => y start position */ | ||
133 | x = (screen->width - maxw) / 2 - 2; | ||
134 | 131 | ||
135 | #if LCD_DEPTH > 1 | 132 | #if LCD_DEPTH > 1 |
136 | if (screen->depth > 1) | 133 | if (screen->depth > 1) |
137 | { | 134 | { |
138 | prevfg = screen->get_foreground(); | 135 | prevfg = screen->get_foreground(); |
139 | screen->set_drawmode(DRMODE_FG); | 136 | screen->set_drawmode(DRMODE_FG); |
140 | screen->set_foreground( | 137 | screen->set_foreground( |
141 | SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY)); | 138 | SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY)); |
142 | } | 139 | } |
143 | else | 140 | else |
144 | #endif | 141 | #endif |
145 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 142 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
146 | 143 | ||
147 | screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4); | 144 | screen->fillrect(x, y-2, maxw+4, screen->height-y*2+4); |
148 | 145 | ||
149 | #if LCD_DEPTH > 1 | 146 | #if LCD_DEPTH > 1 |
150 | if (screen->depth > 1) | 147 | if (screen->depth > 1) |
151 | screen->set_foreground( | 148 | screen->set_foreground(SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK)); |
152 | SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK)); | 149 | else |
153 | else | ||
154 | #endif | 150 | #endif |
155 | screen->set_drawmode(DRMODE_SOLID); | 151 | screen->set_drawmode(DRMODE_SOLID); |
156 | 152 | ||
157 | screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4); | 153 | screen->drawrect(x, y-2, maxw+4, screen->height-y*2+4); |
158 | } | ||
159 | else | ||
160 | { | ||
161 | y = 0; | ||
162 | x = 0; | ||
163 | screen->clear_display(); | ||
164 | } | ||
165 | #else /* HAVE_LCD_CHARCELLS */ | 154 | #else /* HAVE_LCD_CHARCELLS */ |
166 | y = 0; /* vertical center on 2 lines would be silly */ | 155 | y = 0; /* vertical centering on 2 lines would be silly */ |
167 | x = 0; | 156 | x = 0; |
168 | screen->clear_display(); | 157 | screen->clear_display(); |
169 | #endif | 158 | #endif |
@@ -172,8 +161,7 @@ static void splash(struct screen * screen, bool center, | |||
172 | 161 | ||
173 | for (i = 0; i <= line; i++) | 162 | for (i = 0; i <= line; i++) |
174 | { | 163 | { |
175 | if (center) | 164 | x = MAX((screen->width - widths[i]) / 2, 0); |
176 | x = MAX((screen->width - widths[i]) / 2, 0); | ||
177 | 165 | ||
178 | #ifdef HAVE_LCD_BITMAP | 166 | #ifdef HAVE_LCD_BITMAP |
179 | screen->putsxy(x, y, lines[i]); | 167 | screen->putsxy(x, y, lines[i]); |
@@ -184,7 +172,7 @@ static void splash(struct screen * screen, bool center, | |||
184 | } | 172 | } |
185 | 173 | ||
186 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1) | 174 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1) |
187 | if (center && screen->depth > 1) | 175 | if (screen->depth > 1) |
188 | { | 176 | { |
189 | screen->set_foreground(prevfg); | 177 | screen->set_foreground(prevfg); |
190 | screen->set_drawmode(DRMODE_SOLID); | 178 | screen->set_drawmode(DRMODE_SOLID); |
@@ -195,25 +183,25 @@ static void splash(struct screen * screen, bool center, | |||
195 | #endif | 183 | #endif |
196 | } | 184 | } |
197 | 185 | ||
198 | void gui_splash(struct screen * screen, int ticks, | 186 | void gui_splash(struct screen * screen, int ticks, |
199 | bool center, const unsigned char *fmt, ...) | 187 | const unsigned char *fmt, ...) |
200 | { | 188 | { |
201 | va_list ap; | 189 | va_list ap; |
202 | va_start( ap, fmt ); | 190 | va_start( ap, fmt ); |
203 | splash(screen, center, fmt, ap); | 191 | splash(screen, fmt, ap); |
204 | va_end( ap ); | 192 | va_end( ap ); |
205 | 193 | ||
206 | if(ticks) | 194 | if(ticks) |
207 | sleep(ticks); | 195 | sleep(ticks); |
208 | } | 196 | } |
209 | 197 | ||
210 | void gui_syncsplash(int ticks, bool center, const unsigned char *fmt, ...) | 198 | void gui_syncsplash(int ticks, const unsigned char *fmt, ...) |
211 | { | 199 | { |
212 | va_list ap; | 200 | va_list ap; |
213 | int i; | 201 | int i; |
214 | va_start( ap, fmt ); | 202 | va_start( ap, fmt ); |
215 | FOR_NB_SCREENS(i) | 203 | FOR_NB_SCREENS(i) |
216 | splash(&(screens[i]), center, fmt, ap); | 204 | splash(&(screens[i]), fmt, ap); |
217 | va_end( ap ); | 205 | va_end( ap ); |
218 | 206 | ||
219 | if(ticks) | 207 | if(ticks) |