mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
abrepeat: drop some inline's and rearrange code to save some size since this stuff is hardly speed critical.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29086 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a3591827ad
commit
30918b8d52
2 changed files with 24 additions and 48 deletions
|
@ -27,6 +27,16 @@
|
||||||
unsigned int ab_A_marker IDATA_ATTR = AB_MARKER_NONE;
|
unsigned int ab_A_marker IDATA_ATTR = AB_MARKER_NONE;
|
||||||
unsigned int ab_B_marker IDATA_ATTR = AB_MARKER_NONE;
|
unsigned int ab_B_marker IDATA_ATTR = AB_MARKER_NONE;
|
||||||
|
|
||||||
|
static inline bool ab_A_marker_set(void)
|
||||||
|
{
|
||||||
|
return ab_A_marker != AB_MARKER_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool ab_B_marker_set(void)
|
||||||
|
{
|
||||||
|
return ab_B_marker != AB_MARKER_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
#if (CONFIG_CODEC == SWCODEC)
|
#if (CONFIG_CODEC == SWCODEC)
|
||||||
void ab_end_of_track_report(void)
|
void ab_end_of_track_report(void)
|
||||||
{
|
{
|
||||||
|
@ -81,18 +91,6 @@ void ab_repeat_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* Currently unused */
|
|
||||||
unsigned int ab_get_A_marker(void)
|
|
||||||
{
|
|
||||||
return ab_A_marker;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int ab_get_B_marker(void)
|
|
||||||
{
|
|
||||||
return ab_B_marker;
|
|
||||||
}
|
|
||||||
#endif /* if 0 */
|
|
||||||
|
|
||||||
/* determines if the given song position is earlier than the A mark;
|
/* determines if the given song position is earlier than the A mark;
|
||||||
intended for use in handling the jump NEXT and PREV commands */
|
intended for use in handling the jump NEXT and PREV commands */
|
||||||
bool ab_before_A_marker(unsigned int song_position)
|
bool ab_before_A_marker(unsigned int song_position)
|
||||||
|
@ -162,13 +160,13 @@ void ab_set_B_marker(unsigned int song_position)
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
static inline int ab_calc_mark_x_pos(int mark, int capacity,
|
static int ab_calc_mark_x_pos(int mark, int capacity,
|
||||||
int offset, int size)
|
int offset, int size)
|
||||||
{
|
{
|
||||||
return offset + ( (size * mark) / capacity );
|
return offset + ( (size * mark) / capacity );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void ab_draw_vertical_line_mark(struct screen * screen,
|
static 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);
|
||||||
|
@ -178,7 +176,7 @@ static inline void ab_draw_vertical_line_mark(struct screen * screen,
|
||||||
#define DIRECTION_RIGHT 1
|
#define DIRECTION_RIGHT 1
|
||||||
#define DIRECTION_LEFT -1
|
#define DIRECTION_LEFT -1
|
||||||
|
|
||||||
static inline void ab_draw_arrow_mark(struct screen * screen,
|
static void ab_draw_arrow_mark(struct screen * screen,
|
||||||
int x, int y, int h, int direction)
|
int x, int y, int h, int direction)
|
||||||
{
|
{
|
||||||
/* draw lines in decreasing size until a height of zero is reached */
|
/* draw lines in decreasing size until a height of zero is reached */
|
||||||
|
@ -196,36 +194,28 @@ 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 w, int h)
|
int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
/* 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 xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w);
|
|
||||||
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_vertical_line_mark(screen, xa, y, h);
|
ab_draw_vertical_line_mark(screen, xa, y, h);
|
||||||
ab_draw_vertical_line_mark(screen, xb, y, h);
|
ab_draw_vertical_line_mark(screen, xb, y, h);
|
||||||
}
|
return;
|
||||||
else
|
|
||||||
{
|
|
||||||
ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT);
|
|
||||||
ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (ab_A_marker_set())
|
||||||
{
|
{
|
||||||
if (ab_A_marker_set())
|
ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT);
|
||||||
{
|
}
|
||||||
int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w);
|
if (ab_B_marker_set())
|
||||||
ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT);
|
{
|
||||||
}
|
ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT);
|
||||||
if (ab_B_marker_set())
|
|
||||||
{
|
|
||||||
int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w);
|
|
||||||
ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,11 +30,7 @@
|
||||||
|
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
|
||||||
void ab_repeat_init(void);
|
void ab_repeat_init(void);
|
||||||
#if 0 /* Currently unused */
|
|
||||||
unsigned int ab_get_A_marker(void);
|
|
||||||
unsigned int ab_get_B_marker(void);
|
|
||||||
#endif /* if 0 */
|
|
||||||
bool ab_before_A_marker(unsigned int song_position);
|
bool ab_before_A_marker(unsigned int song_position);
|
||||||
bool ab_after_A_marker(unsigned int song_position);
|
bool ab_after_A_marker(unsigned int song_position);
|
||||||
void ab_jump_to_A_marker(void);
|
void ab_jump_to_A_marker(void);
|
||||||
|
@ -54,16 +50,6 @@ void ab_draw_markers(struct screen * screen, int capacity,
|
||||||
extern unsigned int ab_A_marker;
|
extern unsigned int ab_A_marker;
|
||||||
extern unsigned int ab_B_marker;
|
extern unsigned int ab_B_marker;
|
||||||
|
|
||||||
static inline bool ab_A_marker_set(void)
|
|
||||||
{
|
|
||||||
return ab_A_marker != AB_MARKER_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool ab_B_marker_set(void)
|
|
||||||
{
|
|
||||||
return ab_B_marker != AB_MARKER_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool ab_repeat_mode_enabled(void)
|
static inline bool ab_repeat_mode_enabled(void)
|
||||||
{
|
{
|
||||||
return global_settings.repeat_mode == REPEAT_AB;
|
return global_settings.repeat_mode == REPEAT_AB;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue