summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-02-16 13:38:30 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-02-16 13:38:30 +0000
commit13035a48afe35340828cccad2a2b0569434f155d (patch)
tree416b3486e74d3035a04d54463602432652d290a3 /apps
parentd50c78c23821358ded916a52054b998883f1ad57 (diff)
downloadrockbox-13035a48afe35340828cccad2a2b0569434f155d.tar.gz
rockbox-13035a48afe35340828cccad2a2b0569434f155d.zip
scrollbar.c: Simplify code a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24694 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/scrollbar.c35
-rw-r--r--apps/gui/scrollbar.h6
2 files changed, 17 insertions, 24 deletions
diff --git a/apps/gui/scrollbar.c b/apps/gui/scrollbar.c
index 2e807002f0..67bf60de3f 100644
--- a/apps/gui/scrollbar.c
+++ b/apps/gui/scrollbar.c
@@ -73,7 +73,7 @@ static void scrollbar_helper(int min_shown, int max_shown, int items,
73 *size = inner_len; 73 *size = inner_len;
74 *start = 0; 74 *start = 0;
75 } 75 }
76 76
77 return; 77 return;
78} 78}
79 79
@@ -92,7 +92,7 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y,
92 inner_y = y + 1; 92 inner_y = y + 1;
93 inner_wd = width - 2; 93 inner_wd = width - 2;
94 inner_ht = height - 2; 94 inner_ht = height - 2;
95 95
96 /* Boundary check to make sure that height is reasonable, otherwise nothing 96 /* Boundary check to make sure that height is reasonable, otherwise nothing
97 * to do 97 * to do
98 */ 98 */
@@ -194,32 +194,25 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm, int x,
194 screen->set_drawmode(DRMODE_SOLID); 194 screen->set_drawmode(DRMODE_SOLID);
195 195
196 if (flags & HORIZONTAL) { 196 if (flags & HORIZONTAL) {
197#if LCD_DEPTH > 1 197 x += start;
198 if (bm.format == FORMAT_MONO) 198 width = size;
199#endif
200 screen->mono_bitmap_part(bm.data, 0, 0,
201 bm.width, x + start, y, size, height);
202#if LCD_DEPTH > 1
203 else
204 screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0,
205 STRIDE(screen->screen_type,
206 bm.width, bm.height),
207 x + start, y, size, height);
208#endif
209 } else { 199 } else {
200 y += start;
201 height = size;
202 }
203
210#if LCD_DEPTH > 1 204#if LCD_DEPTH > 1
211 if (bm.format == FORMAT_MONO) 205 if (bm.format == FORMAT_MONO)
212#endif 206#endif
213 screen->mono_bitmap_part(bm.data, 0, 0, 207 screen->mono_bitmap_part(bm.data, 0, 0,
214 bm.width, x, y + start, width, size); 208 bm.width, x, y, width, height);
215#if LCD_DEPTH > 1 209#if LCD_DEPTH > 1
216 else 210 else
217 screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0, 211 screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0,
218 STRIDE(screen->screen_type, 212 STRIDE(screen->screen_type,
219 bm.width, bm.height), 213 bm.width, bm.height),
220 x, y + start, width, size); 214 x, y, width, height);
221#endif 215#endif
222 }
223} 216}
224 217
225void show_busy_slider(struct screen *s, int x, int y, int width, int height) 218void show_busy_slider(struct screen *s, int x, int y, int width, int height)
@@ -229,16 +222,14 @@ void show_busy_slider(struct screen *s, int x, int y, int width, int height)
229 start, start+20, HORIZONTAL); 222 start, start+20, HORIZONTAL);
230#if NB_SCREENS > 1 223#if NB_SCREENS > 1
231 if (s->screen_type == SCREEN_MAIN) 224 if (s->screen_type == SCREEN_MAIN)
232 {
233#endif 225#endif
226 {
234 start += (dir*2); 227 start += (dir*2);
235 if (start > 79) 228 if (start > 79)
236 dir = -1; 229 dir = -1;
237 else if (start < 1) 230 else if (start < 1)
238 dir = 1; 231 dir = 1;
239#if NB_SCREENS > 1
240 } 232 }
241#endif
242} 233}
243 234
244#endif /* HAVE_LCD_BITMAP */ 235#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/gui/scrollbar.h b/apps/gui/scrollbar.h
index c9b97b268e..3c5b35eee9 100644
--- a/apps/gui/scrollbar.h
+++ b/apps/gui/scrollbar.h
@@ -53,10 +53,12 @@ extern void gui_scrollbar_draw(struct screen * screen, int x, int y,
53 int width, int height, int items, 53 int width, int height, int items,
54 int min_shown, int max_shown, 54 int min_shown, int max_shown,
55 unsigned flags); 55 unsigned flags);
56extern void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm, int x, int y, 56extern void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm,
57 int x, int y,
57 int width, int height, int items, 58 int width, int height, int items,
58 int min_shown, int max_shown, 59 int min_shown, int max_shown,
59 unsigned flags); 60 unsigned flags);
60extern void show_busy_slider(struct screen *s, int x, int y, int width, int height); 61extern void show_busy_slider(struct screen *s, int x, int y,
62 int width, int height);
61#endif /* HAVE_LCD_BITMAP */ 63#endif /* HAVE_LCD_BITMAP */
62#endif /* _GUI_SCROLLBAR_H_ */ 64#endif /* _GUI_SCROLLBAR_H_ */