summaryrefslogtreecommitdiff
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
parentd50c78c23821358ded916a52054b998883f1ad57 (diff)
downloadrockbox-13035a48afe35340828cccad2a2b0569434f155d.zip
rockbox-13035a48afe35340828cccad2a2b0569434f155d.tar.gz
rockbox-13035a48afe35340828cccad2a2b0569434f155d.tar.bz2
rockbox-13035a48afe35340828cccad2a2b0569434f155d.tar.xz
scrollbar.c: Simplify code a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24694 a1c6a512-1295-4272-9138-f99709370657
-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 2e80700..67bf60d 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,
*size = inner_len;
*start = 0;
}
-
+
return;
}
@@ -92,7 +92,7 @@ void gui_scrollbar_draw(struct screen * screen, int x, int y,
inner_y = y + 1;
inner_wd = width - 2;
inner_ht = height - 2;
-
+
/* Boundary check to make sure that height is reasonable, otherwise nothing
* to do
*/
@@ -194,32 +194,25 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm, int x,
screen->set_drawmode(DRMODE_SOLID);
if (flags & HORIZONTAL) {
-#if LCD_DEPTH > 1
- if (bm.format == FORMAT_MONO)
-#endif
- screen->mono_bitmap_part(bm.data, 0, 0,
- bm.width, x + start, y, size, height);
-#if LCD_DEPTH > 1
- else
- screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0,
- STRIDE(screen->screen_type,
- bm.width, bm.height),
- x + start, y, size, height);
-#endif
+ x += start;
+ width = size;
} else {
+ y += start;
+ height = size;
+ }
+
#if LCD_DEPTH > 1
- if (bm.format == FORMAT_MONO)
+ if (bm.format == FORMAT_MONO)
#endif
screen->mono_bitmap_part(bm.data, 0, 0,
- bm.width, x, y + start, width, size);
+ bm.width, x, y, width, height);
#if LCD_DEPTH > 1
- else
+ else
screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0,
STRIDE(screen->screen_type,
bm.width, bm.height),
- x, y + start, width, size);
+ x, y, width, height);
#endif
- }
}
void 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)
start, start+20, HORIZONTAL);
#if NB_SCREENS > 1
if (s->screen_type == SCREEN_MAIN)
- {
#endif
+ {
start += (dir*2);
if (start > 79)
dir = -1;
else if (start < 1)
dir = 1;
-#if NB_SCREENS > 1
}
-#endif
}
#endif /* HAVE_LCD_BITMAP */
diff --git a/apps/gui/scrollbar.h b/apps/gui/scrollbar.h
index c9b97b2..3c5b35e 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,
int width, int height, int items,
int min_shown, int max_shown,
unsigned flags);
-extern void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm, int x, int y,
+extern void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm,
+ int x, int y,
int width, int height, int items,
int min_shown, int max_shown,
unsigned flags);
-extern void show_busy_slider(struct screen *s, int x, int y, int width, int height);
+extern void show_busy_slider(struct screen *s, int x, int y,
+ int width, int height);
#endif /* HAVE_LCD_BITMAP */
#endif /* _GUI_SCROLLBAR_H_ */