summaryrefslogtreecommitdiff
path: root/apps/abrepeat.c
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-03-07 12:51:23 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-03-07 12:51:23 +0000
commitf50885534ec6fa78c2c89e275c5ffd592be5cd2e (patch)
treeb60a7d0f7a1c5124cddedeac585c0bb1c1a11d4f /apps/abrepeat.c
parent1e9789879ff620c78b594801bf37abc256bdcc2b (diff)
Pass width instead of x+width to ab_draw_markers()/cue_draw_markers() and don't recalculate the width in these functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25053 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/abrepeat.c')
-rw-r--r--apps/abrepeat.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/abrepeat.c b/apps/abrepeat.c
index 5fbd880a17..aa37577644 100644
--- a/apps/abrepeat.c
+++ b/apps/abrepeat.c
@@ -165,8 +165,7 @@ void ab_set_B_marker(unsigned int song_position)
static inline int ab_calc_mark_x_pos(int mark, int capacity,
int offset, int size)
{
- int w = size - offset;
- return offset + ( (w * mark) / capacity );
+ return offset + ( (size * mark) / capacity );
}
static inline void ab_draw_vertical_line_mark(struct screen * screen,
@@ -195,14 +194,14 @@ static inline void ab_draw_arrow_mark(struct screen * screen,
}
void ab_draw_markers(struct screen * screen, int capacity,
- int x0, int x1, int y, int h)
+ int x, int y, int w, int h)
{
/* if both markers are set, determine if they're far enough apart
to draw arrows */
if ( ab_A_marker_set() && ab_B_marker_set() )
{
- int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1);
- int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1);
+ int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w);
+ int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w);
int arrow_width = (h+1) / 2;
if ( (xb-xa) < (arrow_width*2) )
{
@@ -219,12 +218,12 @@ void ab_draw_markers(struct screen * screen, int capacity,
{
if (ab_A_marker_set())
{
- int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1);
+ int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w);
ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT);
}
if (ab_B_marker_set())
{
- int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1);
+ int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w);
ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT);
}
}