diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2010-03-07 12:51:23 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2010-03-07 12:51:23 +0000 |
commit | f50885534ec6fa78c2c89e275c5ffd592be5cd2e (patch) | |
tree | b60a7d0f7a1c5124cddedeac585c0bb1c1a11d4f /apps/abrepeat.c | |
parent | 1e9789879ff620c78b594801bf37abc256bdcc2b (diff) | |
download | rockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.tar.gz rockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.zip |
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.c | 13 |
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) | |||
165 | static inline int ab_calc_mark_x_pos(int mark, int capacity, | 165 | static inline int ab_calc_mark_x_pos(int mark, int capacity, |
166 | int offset, int size) | 166 | int offset, int size) |
167 | { | 167 | { |
168 | int w = size - offset; | 168 | return offset + ( (size * mark) / capacity ); |
169 | return offset + ( (w * mark) / capacity ); | ||
170 | } | 169 | } |
171 | 170 | ||
172 | static inline void ab_draw_vertical_line_mark(struct screen * screen, | 171 | 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, | |||
195 | } | 194 | } |
196 | 195 | ||
197 | void ab_draw_markers(struct screen * screen, int capacity, | 196 | void ab_draw_markers(struct screen * screen, int capacity, |
198 | int x0, int x1, int y, int h) | 197 | int x, int y, int w, int h) |
199 | { | 198 | { |
200 | /* if both markers are set, determine if they're far enough apart | 199 | /* if both markers are set, determine if they're far enough apart |
201 | to draw arrows */ | 200 | to draw arrows */ |
202 | if ( ab_A_marker_set() && ab_B_marker_set() ) | 201 | if ( ab_A_marker_set() && ab_B_marker_set() ) |
203 | { | 202 | { |
204 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1); | 203 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); |
205 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1); | 204 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); |
206 | int arrow_width = (h+1) / 2; | 205 | int arrow_width = (h+1) / 2; |
207 | if ( (xb-xa) < (arrow_width*2) ) | 206 | if ( (xb-xa) < (arrow_width*2) ) |
208 | { | 207 | { |
@@ -219,12 +218,12 @@ void ab_draw_markers(struct screen * screen, int capacity, | |||
219 | { | 218 | { |
220 | if (ab_A_marker_set()) | 219 | if (ab_A_marker_set()) |
221 | { | 220 | { |
222 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1); | 221 | int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); |
223 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); | 222 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); |
224 | } | 223 | } |
225 | if (ab_B_marker_set()) | 224 | if (ab_B_marker_set()) |
226 | { | 225 | { |
227 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1); | 226 | int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); |
228 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); | 227 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); |
229 | } | 228 | } |
230 | } | 229 | } |