summaryrefslogtreecommitdiff
path: root/apps/abrepeat.c
diff options
context:
space:
mode:
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)
165static inline int ab_calc_mark_x_pos(int mark, int capacity, 165static 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
172static inline void ab_draw_vertical_line_mark(struct screen * screen, 171static 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
197void ab_draw_markers(struct screen * screen, int capacity, 196void 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 }