Respect the progressbar length when drawing AB markers. Fixes FS#6463. Also fix a function name typo.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11857 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2006-12-29 19:17:03 +00:00
parent 5dc0abda11
commit 08c813d45a
3 changed files with 11 additions and 11 deletions

View file

@ -166,7 +166,7 @@ static inline int ab_calc_mark_x_pos(int mark, int capacity,
return offset + ( (w * mark) / capacity ); return offset + ( (w * mark) / capacity );
} }
static inline void ab_draw_veritcal_line_mark(struct screen * screen, static inline void ab_draw_vertical_line_mark(struct screen * screen,
int x, int y, int h) int x, int y, int h)
{ {
screen->set_drawmode(DRMODE_COMPLEMENT); screen->set_drawmode(DRMODE_COMPLEMENT);
@ -192,20 +192,19 @@ static inline void ab_draw_arrow_mark(struct screen * screen,
} }
void ab_draw_markers(struct screen * screen, int capacity, void ab_draw_markers(struct screen * screen, int capacity,
int x, int y, int h) int x0, int x1, int y, int h)
{ {
int w = screen->width;
/* if both markers are set, determine if they're far enough apart /* if both markers are set, determine if they're far enough apart
to draw arrows */ to draw arrows */
if ( ab_A_marker_set() && ab_B_marker_set() ) if ( ab_A_marker_set() && ab_B_marker_set() )
{ {
int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1);
int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1);
int arrow_width = (h+1) / 2; int arrow_width = (h+1) / 2;
if ( (xb-xa) < (arrow_width*2) ) if ( (xb-xa) < (arrow_width*2) )
{ {
ab_draw_veritcal_line_mark(screen, xa, y, h); ab_draw_vertical_line_mark(screen, xa, y, h);
ab_draw_veritcal_line_mark(screen, xb, y, h); ab_draw_vertical_line_mark(screen, xb, y, h);
} }
else else
{ {
@ -217,12 +216,12 @@ void ab_draw_markers(struct screen * screen, int capacity,
{ {
if (ab_A_marker_set()) if (ab_A_marker_set())
{ {
int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w); int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1);
ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT);
} }
if (ab_B_marker_set()) if (ab_B_marker_set())
{ {
int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w); int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1);
ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT);
} }
} }

View file

@ -49,7 +49,7 @@ void ab_end_of_track_report(void);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "screen_access.h" #include "screen_access.h"
void ab_draw_markers(struct screen * screen, int capacity, void ab_draw_markers(struct screen * screen, int capacity,
int x, int y, int h); int x0, int x1, int y, int h);
#endif #endif
/* These functions really need to be inlined for speed */ /* These functions really need to be inlined for speed */

View file

@ -1840,7 +1840,8 @@ bool gui_wps_refresh(struct gui_wps *gwps, int ffwd_offset,
HORIZONTAL); HORIZONTAL);
#ifdef AB_REPEAT_ENABLE #ifdef AB_REPEAT_ENABLE
if ( ab_repeat_mode_enabled() ) if ( ab_repeat_mode_enabled() )
ab_draw_markers(display, state->id3->length, 0, sb_y, ab_draw_markers(display, state->id3->length,
data->progress_start, data->progress_end, sb_y,
data->progress_height); data->progress_height);
#endif #endif
update_line = true; update_line = true;