forked from len0rd/rockbox
Made all local functions static, saving ~500 bytes of binsize on coldfire and SH1, and ~150 bytes on ARM. * Removed an unused static inline function.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20228 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
44c15ee923
commit
c99446dd89
1 changed files with 40 additions and 51 deletions
|
@ -289,7 +289,7 @@ static int track_count;
|
||||||
static int track_index;
|
static int track_index;
|
||||||
static int selected_track;
|
static int selected_track;
|
||||||
static int selected_track_pulse;
|
static int selected_track_pulse;
|
||||||
void reset_track_list(void);
|
static void reset_track_list(void);
|
||||||
|
|
||||||
void * buf;
|
void * buf;
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
|
@ -340,9 +340,8 @@ static int pf_state;
|
||||||
|
|
||||||
/** code */
|
/** code */
|
||||||
static inline unsigned fade_color(pix_t c, unsigned a);
|
static inline unsigned fade_color(pix_t c, unsigned a);
|
||||||
bool save_pfraw(char* filename, struct bitmap *bm);
|
static bool save_pfraw(char* filename, struct bitmap *bm);
|
||||||
bool load_new_slide(void);
|
static bool load_new_slide(void);
|
||||||
int load_surface(int);
|
|
||||||
|
|
||||||
static inline PFreal fmul(PFreal a, PFreal b)
|
static inline PFreal fmul(PFreal a, PFreal b)
|
||||||
{
|
{
|
||||||
|
@ -563,7 +562,7 @@ const struct custom_format format_transposed = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Create the lookup table with the scaling values for the reflections */
|
/* Create the lookup table with the scaling values for the reflections */
|
||||||
void init_reflect_table(void)
|
static void init_reflect_table(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < REFLECT_HEIGHT; i++)
|
for (i = 0; i < REFLECT_HEIGHT; i++)
|
||||||
|
@ -576,7 +575,7 @@ void init_reflect_table(void)
|
||||||
Create an index of all albums from the database.
|
Create an index of all albums from the database.
|
||||||
Also store the album names so we can access them later.
|
Also store the album names so we can access them later.
|
||||||
*/
|
*/
|
||||||
int create_album_index(void)
|
static int create_album_index(void)
|
||||||
{
|
{
|
||||||
buf_size -= UNIQBUF_SIZE * sizeof(long);
|
buf_size -= UNIQBUF_SIZE * sizeof(long);
|
||||||
long *uniqbuf = (long *)(buf_size + (char *)buf);
|
long *uniqbuf = (long *)(buf_size + (char *)buf);
|
||||||
|
@ -621,7 +620,7 @@ int create_album_index(void)
|
||||||
/**
|
/**
|
||||||
Return a pointer to the album name of the given slide_index
|
Return a pointer to the album name of the given slide_index
|
||||||
*/
|
*/
|
||||||
char* get_album_name(const int slide_index)
|
static char* get_album_name(const int slide_index)
|
||||||
{
|
{
|
||||||
return album_names + album[slide_index].name_idx;
|
return album_names + album[slide_index].name_idx;
|
||||||
}
|
}
|
||||||
|
@ -630,7 +629,7 @@ char* get_album_name(const int slide_index)
|
||||||
Return a pointer to the track name of the active album
|
Return a pointer to the track name of the active album
|
||||||
create_track_index has to be called first.
|
create_track_index has to be called first.
|
||||||
*/
|
*/
|
||||||
char* get_track_name(const int track_index)
|
static char* get_track_name(const int track_index)
|
||||||
{
|
{
|
||||||
if ( track_index < track_count )
|
if ( track_index < track_count )
|
||||||
return track_names + tracks[track_index].name_idx;
|
return track_names + tracks[track_index].name_idx;
|
||||||
|
@ -640,7 +639,7 @@ char* get_track_name(const int track_index)
|
||||||
/**
|
/**
|
||||||
Create the track index of the given slide_index.
|
Create the track index of the given slide_index.
|
||||||
*/
|
*/
|
||||||
int create_track_index(const int slide_index)
|
static int create_track_index(const int slide_index)
|
||||||
{
|
{
|
||||||
if ( slide_index == track_index ) {
|
if ( slide_index == track_index ) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -713,8 +712,8 @@ int create_track_index(const int slide_index)
|
||||||
The algorithm looks for the first track of the given album uses
|
The algorithm looks for the first track of the given album uses
|
||||||
find_albumart to find the filename.
|
find_albumart to find the filename.
|
||||||
*/
|
*/
|
||||||
bool get_albumart_for_index_from_db(const int slide_index, char *buf,
|
static bool get_albumart_for_index_from_db(const int slide_index, char *buf,
|
||||||
int buflen)
|
int buflen)
|
||||||
{
|
{
|
||||||
if ( slide_index == -1 )
|
if ( slide_index == -1 )
|
||||||
{
|
{
|
||||||
|
@ -751,7 +750,7 @@ bool get_albumart_for_index_from_db(const int slide_index, char *buf,
|
||||||
/**
|
/**
|
||||||
Draw the PictureFlow logo
|
Draw the PictureFlow logo
|
||||||
*/
|
*/
|
||||||
void draw_splashscreen(void)
|
static void draw_splashscreen(void)
|
||||||
{
|
{
|
||||||
struct screen* display = rb->screens[0];
|
struct screen* display = rb->screens[0];
|
||||||
const struct picture* logo = &(logos[display->screen_type]);
|
const struct picture* logo = &(logos[display->screen_type]);
|
||||||
|
@ -779,7 +778,7 @@ void draw_splashscreen(void)
|
||||||
/**
|
/**
|
||||||
Draw a simple progress bar
|
Draw a simple progress bar
|
||||||
*/
|
*/
|
||||||
void draw_progressbar(int step)
|
static void draw_progressbar(int step)
|
||||||
{
|
{
|
||||||
int txt_w, txt_h;
|
int txt_w, txt_h;
|
||||||
const int bar_height = 22;
|
const int bar_height = 22;
|
||||||
|
@ -812,7 +811,7 @@ void draw_progressbar(int step)
|
||||||
/**
|
/**
|
||||||
Precomupte the album art images and store them in CACHE_PREFIX.
|
Precomupte the album art images and store them in CACHE_PREFIX.
|
||||||
*/
|
*/
|
||||||
bool create_albumart_cache(void)
|
static bool create_albumart_cache(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -864,7 +863,7 @@ bool create_albumart_cache(void)
|
||||||
/**
|
/**
|
||||||
Thread used for loading and preparing bitmaps in the background
|
Thread used for loading and preparing bitmaps in the background
|
||||||
*/
|
*/
|
||||||
void thread(void)
|
static void thread(void)
|
||||||
{
|
{
|
||||||
long sleep_time = 5 * HZ;
|
long sleep_time = 5 * HZ;
|
||||||
struct queue_event ev;
|
struct queue_event ev;
|
||||||
|
@ -891,7 +890,7 @@ void thread(void)
|
||||||
/**
|
/**
|
||||||
End the thread by posting the EV_EXIT event
|
End the thread by posting the EV_EXIT event
|
||||||
*/
|
*/
|
||||||
void end_pf_thread(void)
|
static void end_pf_thread(void)
|
||||||
{
|
{
|
||||||
if ( thread_is_running ) {
|
if ( thread_is_running ) {
|
||||||
rb->queue_post(&thread_q, EV_EXIT, 0);
|
rb->queue_post(&thread_q, EV_EXIT, 0);
|
||||||
|
@ -907,7 +906,7 @@ void end_pf_thread(void)
|
||||||
/**
|
/**
|
||||||
Create the thread an setup the event queue
|
Create the thread an setup the event queue
|
||||||
*/
|
*/
|
||||||
bool create_pf_thread(void)
|
static bool create_pf_thread(void)
|
||||||
{
|
{
|
||||||
/* put the thread's queue in the bcast list */
|
/* put the thread's queue in the bcast list */
|
||||||
rb->queue_init(&thread_q, true);
|
rb->queue_init(&thread_q, true);
|
||||||
|
@ -932,7 +931,7 @@ bool create_pf_thread(void)
|
||||||
/**
|
/**
|
||||||
Safe the given bitmap as filename in the pfraw format
|
Safe the given bitmap as filename in the pfraw format
|
||||||
*/
|
*/
|
||||||
bool save_pfraw(char* filename, struct bitmap *bm)
|
static bool save_pfraw(char* filename, struct bitmap *bm)
|
||||||
{
|
{
|
||||||
struct pfraw_header bmph;
|
struct pfraw_header bmph;
|
||||||
bmph.width = bm->width;
|
bmph.width = bm->width;
|
||||||
|
@ -1115,7 +1114,7 @@ static inline int free_slide_prio(int prio)
|
||||||
/**
|
/**
|
||||||
Read the pfraw image given as filename and return the hid of the buffer
|
Read the pfraw image given as filename and return the hid of the buffer
|
||||||
*/
|
*/
|
||||||
int read_pfraw(char* filename, int prio)
|
static int read_pfraw(char* filename, int prio)
|
||||||
{
|
{
|
||||||
struct pfraw_header bmph;
|
struct pfraw_header bmph;
|
||||||
int fh = rb->open(filename, O_RDONLY);
|
int fh = rb->open(filename, O_RDONLY);
|
||||||
|
@ -1181,7 +1180,7 @@ static inline bool load_and_prepare_surface(const int slide_index,
|
||||||
Load the "next" slide that we can load, freeing old slides if needed, provided
|
Load the "next" slide that we can load, freeing old slides if needed, provided
|
||||||
that they are further from center_index than the current slide
|
that they are further from center_index than the current slide
|
||||||
*/
|
*/
|
||||||
bool load_new_slide(void)
|
static bool load_new_slide(void)
|
||||||
{
|
{
|
||||||
int i = -1;
|
int i = -1;
|
||||||
if (cache_center_index != -1)
|
if (cache_center_index != -1)
|
||||||
|
@ -1330,7 +1329,7 @@ static inline struct dim *surface(const int slide_index)
|
||||||
/**
|
/**
|
||||||
adjust slides so that they are in "steady state" position
|
adjust slides so that they are in "steady state" position
|
||||||
*/
|
*/
|
||||||
void reset_slides(void)
|
static void reset_slides(void)
|
||||||
{
|
{
|
||||||
center_slide.angle = 0;
|
center_slide.angle = 0;
|
||||||
center_slide.cx = 0;
|
center_slide.cx = 0;
|
||||||
|
@ -1371,7 +1370,7 @@ void reset_slides(void)
|
||||||
* z
|
* z
|
||||||
* TODO: support moving the side slides toward or away from the camera
|
* TODO: support moving the side slides toward or away from the camera
|
||||||
*/
|
*/
|
||||||
void recalc_offsets(void)
|
static void recalc_offsets(void)
|
||||||
{
|
{
|
||||||
PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF;
|
PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF;
|
||||||
PFreal zo;
|
PFreal zo;
|
||||||
|
@ -1447,7 +1446,7 @@ static inline unsigned fade_color(pix_t c, unsigned a)
|
||||||
* optimized by saving the numerator and denominator of the fraction, which can
|
* optimized by saving the numerator and denominator of the fraction, which can
|
||||||
* then be incremented by (z + zo) and sin(r) respectively.
|
* then be incremented by (z + zo) and sin(r) respectively.
|
||||||
*/
|
*/
|
||||||
void render_slide(struct slide_data *slide, const int alpha)
|
static void render_slide(struct slide_data *slide, const int alpha)
|
||||||
{
|
{
|
||||||
struct dim *bmp = surface(slide->slide_index);
|
struct dim *bmp = surface(slide->slide_index);
|
||||||
if (!bmp) {
|
if (!bmp) {
|
||||||
|
@ -1594,7 +1593,7 @@ static inline void set_current_slide(const int slide_index)
|
||||||
/**
|
/**
|
||||||
Start the animation for changing slides
|
Start the animation for changing slides
|
||||||
*/
|
*/
|
||||||
void start_animation(void)
|
static void start_animation(void)
|
||||||
{
|
{
|
||||||
step = (target < center_slide.slide_index) ? -1 : 1;
|
step = (target < center_slide.slide_index) ? -1 : 1;
|
||||||
pf_state = pf_scrolling;
|
pf_state = pf_scrolling;
|
||||||
|
@ -1603,7 +1602,7 @@ void start_animation(void)
|
||||||
/**
|
/**
|
||||||
Go to the previous slide
|
Go to the previous slide
|
||||||
*/
|
*/
|
||||||
void show_previous_slide(void)
|
static void show_previous_slide(void)
|
||||||
{
|
{
|
||||||
if (step == 0) {
|
if (step == 0) {
|
||||||
if (center_index > 0) {
|
if (center_index > 0) {
|
||||||
|
@ -1622,7 +1621,7 @@ void show_previous_slide(void)
|
||||||
/**
|
/**
|
||||||
Go to the next slide
|
Go to the next slide
|
||||||
*/
|
*/
|
||||||
void show_next_slide(void)
|
static void show_next_slide(void)
|
||||||
{
|
{
|
||||||
if (step == 0) {
|
if (step == 0) {
|
||||||
if (center_index < number_of_slides - 1) {
|
if (center_index < number_of_slides - 1) {
|
||||||
|
@ -1638,20 +1637,10 @@ void show_next_slide(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Return true if the rect has size 0
|
|
||||||
*/
|
|
||||||
static inline bool is_empty_rect(struct rect *r)
|
|
||||||
{
|
|
||||||
return ((r->left == 0) && (r->right == 0) && (r->top == 0)
|
|
||||||
&& (r->bottom == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Render the slides. Updates only the offscreen buffer.
|
Render the slides. Updates only the offscreen buffer.
|
||||||
*/
|
*/
|
||||||
void render_all_slides(void)
|
static void render_all_slides(void)
|
||||||
{
|
{
|
||||||
MYLCD(set_background)(G_BRIGHT(0));
|
MYLCD(set_background)(G_BRIGHT(0));
|
||||||
/* TODO: Optimizes this by e.g. invalidating rects */
|
/* TODO: Optimizes this by e.g. invalidating rects */
|
||||||
|
@ -1705,7 +1694,7 @@ void render_all_slides(void)
|
||||||
/**
|
/**
|
||||||
Updates the animation effect. Call this periodically from a timer.
|
Updates the animation effect. Call this periodically from a timer.
|
||||||
*/
|
*/
|
||||||
void update_scroll_animation(void)
|
static void update_scroll_animation(void)
|
||||||
{
|
{
|
||||||
if (step == 0)
|
if (step == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1806,7 +1795,7 @@ void update_scroll_animation(void)
|
||||||
/**
|
/**
|
||||||
Cleanup the plugin
|
Cleanup the plugin
|
||||||
*/
|
*/
|
||||||
void cleanup(void *parameter)
|
static void cleanup(void *parameter)
|
||||||
{
|
{
|
||||||
(void) parameter;
|
(void) parameter;
|
||||||
/* Turn on backlight timeout (revert to settings) */
|
/* Turn on backlight timeout (revert to settings) */
|
||||||
|
@ -1822,7 +1811,7 @@ void cleanup(void *parameter)
|
||||||
Create the "?" slide, that is shown while loading
|
Create the "?" slide, that is shown while loading
|
||||||
or when no cover was found.
|
or when no cover was found.
|
||||||
*/
|
*/
|
||||||
int create_empty_slide(bool force)
|
static int create_empty_slide(bool force)
|
||||||
{
|
{
|
||||||
if ( force || ! rb->file_exists( EMPTY_SLIDE ) ) {
|
if ( force || ! rb->file_exists( EMPTY_SLIDE ) ) {
|
||||||
struct bitmap input_bmp;
|
struct bitmap input_bmp;
|
||||||
|
@ -1847,7 +1836,7 @@ int create_empty_slide(bool force)
|
||||||
/**
|
/**
|
||||||
Shows the album name setting menu
|
Shows the album name setting menu
|
||||||
*/
|
*/
|
||||||
int album_name_menu(void)
|
static int album_name_menu(void)
|
||||||
{
|
{
|
||||||
int selection = show_album_name;
|
int selection = show_album_name;
|
||||||
|
|
||||||
|
@ -1862,7 +1851,7 @@ int album_name_menu(void)
|
||||||
/**
|
/**
|
||||||
Shows the settings menu
|
Shows the settings menu
|
||||||
*/
|
*/
|
||||||
int settings_menu(void)
|
static int settings_menu(void)
|
||||||
{
|
{
|
||||||
int selection = 0;
|
int selection = 0;
|
||||||
bool old_val;
|
bool old_val;
|
||||||
|
@ -1937,7 +1926,7 @@ int settings_menu(void)
|
||||||
/**
|
/**
|
||||||
Show the main menu
|
Show the main menu
|
||||||
*/
|
*/
|
||||||
int main_menu(void)
|
static int main_menu(void)
|
||||||
{
|
{
|
||||||
int selection = 0;
|
int selection = 0;
|
||||||
int result;
|
int result;
|
||||||
|
@ -1973,7 +1962,7 @@ int main_menu(void)
|
||||||
/**
|
/**
|
||||||
Animation step for zooming into the current cover
|
Animation step for zooming into the current cover
|
||||||
*/
|
*/
|
||||||
void update_cover_in_animation(void)
|
static void update_cover_in_animation(void)
|
||||||
{
|
{
|
||||||
cover_animation_keyframe++;
|
cover_animation_keyframe++;
|
||||||
if( cover_animation_keyframe < 20 ) {
|
if( cover_animation_keyframe < 20 ) {
|
||||||
|
@ -1993,7 +1982,7 @@ void update_cover_in_animation(void)
|
||||||
/**
|
/**
|
||||||
Animation step for zooming out the current cover
|
Animation step for zooming out the current cover
|
||||||
*/
|
*/
|
||||||
void update_cover_out_animation(void)
|
static void update_cover_out_animation(void)
|
||||||
{
|
{
|
||||||
cover_animation_keyframe++;
|
cover_animation_keyframe++;
|
||||||
if( cover_animation_keyframe <= 15 ) {
|
if( cover_animation_keyframe <= 15 ) {
|
||||||
|
@ -2055,7 +2044,7 @@ static void track_list_yh(int char_height)
|
||||||
/**
|
/**
|
||||||
Reset the track list after a album change
|
Reset the track list after a album change
|
||||||
*/
|
*/
|
||||||
void reset_track_list(void)
|
static void reset_track_list(void)
|
||||||
{
|
{
|
||||||
int albumtxt_h = rb->screens[SCREEN_MAIN]->getcharheight();
|
int albumtxt_h = rb->screens[SCREEN_MAIN]->getcharheight();
|
||||||
track_list_yh(albumtxt_h);
|
track_list_yh(albumtxt_h);
|
||||||
|
@ -2077,7 +2066,7 @@ void reset_track_list(void)
|
||||||
/**
|
/**
|
||||||
Display the list of tracks
|
Display the list of tracks
|
||||||
*/
|
*/
|
||||||
void show_track_list(void)
|
static void show_track_list(void)
|
||||||
{
|
{
|
||||||
MYLCD(clear_display)();
|
MYLCD(clear_display)();
|
||||||
if ( center_slide.slide_index != track_index ) {
|
if ( center_slide.slide_index != track_index ) {
|
||||||
|
@ -2116,7 +2105,7 @@ void show_track_list(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void select_next_track(void)
|
static void select_next_track(void)
|
||||||
{
|
{
|
||||||
if ( selected_track < track_count - 1 ) {
|
if ( selected_track < track_count - 1 ) {
|
||||||
selected_track++;
|
selected_track++;
|
||||||
|
@ -2127,7 +2116,7 @@ void select_next_track(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void select_prev_track(void)
|
static void select_prev_track(void)
|
||||||
{
|
{
|
||||||
if (selected_track > 0 ) {
|
if (selected_track > 0 ) {
|
||||||
if (selected_track==start_index_track_list) start_index_track_list--;
|
if (selected_track==start_index_track_list) start_index_track_list--;
|
||||||
|
@ -2140,7 +2129,7 @@ void select_prev_track(void)
|
||||||
/**
|
/**
|
||||||
Draw the current album name
|
Draw the current album name
|
||||||
*/
|
*/
|
||||||
void draw_album_text(void)
|
static void draw_album_text(void)
|
||||||
{
|
{
|
||||||
if (0 == show_album_name)
|
if (0 == show_album_name)
|
||||||
return;
|
return;
|
||||||
|
@ -2201,7 +2190,7 @@ void draw_album_text(void)
|
||||||
Main function that also contain the main plasma
|
Main function that also contain the main plasma
|
||||||
algorithm.
|
algorithm.
|
||||||
*/
|
*/
|
||||||
int main(void)
|
static int main(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue