summaryrefslogtreecommitdiff
path: root/apps/plugins/pictureflow.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pictureflow.c')
-rw-r--r--apps/plugins/pictureflow.c91
1 files changed, 40 insertions, 51 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index 148c5aa0a1..8ac6032701 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -289,7 +289,7 @@ static int track_count;
289static int track_index; 289static int track_index;
290static int selected_track; 290static int selected_track;
291static int selected_track_pulse; 291static int selected_track_pulse;
292void reset_track_list(void); 292static void reset_track_list(void);
293 293
294void * buf; 294void * buf;
295size_t buf_size; 295size_t buf_size;
@@ -340,9 +340,8 @@ static int pf_state;
340 340
341/** code */ 341/** code */
342static inline unsigned fade_color(pix_t c, unsigned a); 342static inline unsigned fade_color(pix_t c, unsigned a);
343bool save_pfraw(char* filename, struct bitmap *bm); 343static bool save_pfraw(char* filename, struct bitmap *bm);
344bool load_new_slide(void); 344static bool load_new_slide(void);
345int load_surface(int);
346 345
347static inline PFreal fmul(PFreal a, PFreal b) 346static inline PFreal fmul(PFreal a, PFreal b)
348{ 347{
@@ -563,7 +562,7 @@ const struct custom_format format_transposed = {
563}; 562};
564 563
565/* Create the lookup table with the scaling values for the reflections */ 564/* Create the lookup table with the scaling values for the reflections */
566void init_reflect_table(void) 565static void init_reflect_table(void)
567{ 566{
568 int i; 567 int i;
569 for (i = 0; i < REFLECT_HEIGHT; i++) 568 for (i = 0; i < REFLECT_HEIGHT; i++)
@@ -576,7 +575,7 @@ void init_reflect_table(void)
576 Create an index of all albums from the database. 575 Create an index of all albums from the database.
577 Also store the album names so we can access them later. 576 Also store the album names so we can access them later.
578 */ 577 */
579int create_album_index(void) 578static int create_album_index(void)
580{ 579{
581 buf_size -= UNIQBUF_SIZE * sizeof(long); 580 buf_size -= UNIQBUF_SIZE * sizeof(long);
582 long *uniqbuf = (long *)(buf_size + (char *)buf); 581 long *uniqbuf = (long *)(buf_size + (char *)buf);
@@ -621,7 +620,7 @@ int create_album_index(void)
621/** 620/**
622 Return a pointer to the album name of the given slide_index 621 Return a pointer to the album name of the given slide_index
623 */ 622 */
624char* get_album_name(const int slide_index) 623static char* get_album_name(const int slide_index)
625{ 624{
626 return album_names + album[slide_index].name_idx; 625 return album_names + album[slide_index].name_idx;
627} 626}
@@ -630,7 +629,7 @@ char* get_album_name(const int slide_index)
630 Return a pointer to the track name of the active album 629 Return a pointer to the track name of the active album
631 create_track_index has to be called first. 630 create_track_index has to be called first.
632 */ 631 */
633char* get_track_name(const int track_index) 632static char* get_track_name(const int track_index)
634{ 633{
635 if ( track_index < track_count ) 634 if ( track_index < track_count )
636 return track_names + tracks[track_index].name_idx; 635 return track_names + tracks[track_index].name_idx;
@@ -640,7 +639,7 @@ char* get_track_name(const int track_index)
640/** 639/**
641 Create the track index of the given slide_index. 640 Create the track index of the given slide_index.
642 */ 641 */
643int create_track_index(const int slide_index) 642static int create_track_index(const int slide_index)
644{ 643{
645 if ( slide_index == track_index ) { 644 if ( slide_index == track_index ) {
646 return -1; 645 return -1;
@@ -713,8 +712,8 @@ int create_track_index(const int slide_index)
713 The algorithm looks for the first track of the given album uses 712 The algorithm looks for the first track of the given album uses
714 find_albumart to find the filename. 713 find_albumart to find the filename.
715 */ 714 */
716bool get_albumart_for_index_from_db(const int slide_index, char *buf, 715static bool get_albumart_for_index_from_db(const int slide_index, char *buf,
717 int buflen) 716 int buflen)
718{ 717{
719 if ( slide_index == -1 ) 718 if ( slide_index == -1 )
720 { 719 {
@@ -751,7 +750,7 @@ bool get_albumart_for_index_from_db(const int slide_index, char *buf,
751/** 750/**
752 Draw the PictureFlow logo 751 Draw the PictureFlow logo
753 */ 752 */
754void draw_splashscreen(void) 753static void draw_splashscreen(void)
755{ 754{
756 struct screen* display = rb->screens[0]; 755 struct screen* display = rb->screens[0];
757 const struct picture* logo = &(logos[display->screen_type]); 756 const struct picture* logo = &(logos[display->screen_type]);
@@ -779,7 +778,7 @@ void draw_splashscreen(void)
779/** 778/**
780 Draw a simple progress bar 779 Draw a simple progress bar
781 */ 780 */
782void draw_progressbar(int step) 781static void draw_progressbar(int step)
783{ 782{
784 int txt_w, txt_h; 783 int txt_w, txt_h;
785 const int bar_height = 22; 784 const int bar_height = 22;
@@ -812,7 +811,7 @@ void draw_progressbar(int step)
812/** 811/**
813 Precomupte the album art images and store them in CACHE_PREFIX. 812 Precomupte the album art images and store them in CACHE_PREFIX.
814 */ 813 */
815bool create_albumart_cache(void) 814static bool create_albumart_cache(void)
816{ 815{
817 int ret; 816 int ret;
818 817
@@ -864,7 +863,7 @@ bool create_albumart_cache(void)
864/** 863/**
865 Thread used for loading and preparing bitmaps in the background 864 Thread used for loading and preparing bitmaps in the background
866 */ 865 */
867void thread(void) 866static void thread(void)
868{ 867{
869 long sleep_time = 5 * HZ; 868 long sleep_time = 5 * HZ;
870 struct queue_event ev; 869 struct queue_event ev;
@@ -891,7 +890,7 @@ void thread(void)
891/** 890/**
892 End the thread by posting the EV_EXIT event 891 End the thread by posting the EV_EXIT event
893 */ 892 */
894void end_pf_thread(void) 893static void end_pf_thread(void)
895{ 894{
896 if ( thread_is_running ) { 895 if ( thread_is_running ) {
897 rb->queue_post(&thread_q, EV_EXIT, 0); 896 rb->queue_post(&thread_q, EV_EXIT, 0);
@@ -907,7 +906,7 @@ void end_pf_thread(void)
907/** 906/**
908 Create the thread an setup the event queue 907 Create the thread an setup the event queue
909 */ 908 */
910bool create_pf_thread(void) 909static bool create_pf_thread(void)
911{ 910{
912 /* put the thread's queue in the bcast list */ 911 /* put the thread's queue in the bcast list */
913 rb->queue_init(&thread_q, true); 912 rb->queue_init(&thread_q, true);
@@ -932,7 +931,7 @@ bool create_pf_thread(void)
932/** 931/**
933 Safe the given bitmap as filename in the pfraw format 932 Safe the given bitmap as filename in the pfraw format
934 */ 933 */
935bool save_pfraw(char* filename, struct bitmap *bm) 934static bool save_pfraw(char* filename, struct bitmap *bm)
936{ 935{
937 struct pfraw_header bmph; 936 struct pfraw_header bmph;
938 bmph.width = bm->width; 937 bmph.width = bm->width;
@@ -1115,7 +1114,7 @@ static inline int free_slide_prio(int prio)
1115/** 1114/**
1116 Read the pfraw image given as filename and return the hid of the buffer 1115 Read the pfraw image given as filename and return the hid of the buffer
1117 */ 1116 */
1118int read_pfraw(char* filename, int prio) 1117static int read_pfraw(char* filename, int prio)
1119{ 1118{
1120 struct pfraw_header bmph; 1119 struct pfraw_header bmph;
1121 int fh = rb->open(filename, O_RDONLY); 1120 int fh = rb->open(filename, O_RDONLY);
@@ -1181,7 +1180,7 @@ static inline bool load_and_prepare_surface(const int slide_index,
1181 Load the "next" slide that we can load, freeing old slides if needed, provided 1180 Load the "next" slide that we can load, freeing old slides if needed, provided
1182 that they are further from center_index than the current slide 1181 that they are further from center_index than the current slide
1183*/ 1182*/
1184bool load_new_slide(void) 1183static bool load_new_slide(void)
1185{ 1184{
1186 int i = -1; 1185 int i = -1;
1187 if (cache_center_index != -1) 1186 if (cache_center_index != -1)
@@ -1330,7 +1329,7 @@ static inline struct dim *surface(const int slide_index)
1330/** 1329/**
1331 adjust slides so that they are in "steady state" position 1330 adjust slides so that they are in "steady state" position
1332 */ 1331 */
1333void reset_slides(void) 1332static void reset_slides(void)
1334{ 1333{
1335 center_slide.angle = 0; 1334 center_slide.angle = 0;
1336 center_slide.cx = 0; 1335 center_slide.cx = 0;
@@ -1371,7 +1370,7 @@ void reset_slides(void)
1371 * z 1370 * z
1372 * TODO: support moving the side slides toward or away from the camera 1371 * TODO: support moving the side slides toward or away from the camera
1373 */ 1372 */
1374void recalc_offsets(void) 1373static void recalc_offsets(void)
1375{ 1374{
1376 PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF; 1375 PFreal xs = PFREAL_HALF - DISPLAY_WIDTH * PFREAL_HALF;
1377 PFreal zo; 1376 PFreal zo;
@@ -1447,7 +1446,7 @@ static inline unsigned fade_color(pix_t c, unsigned a)
1447 * optimized by saving the numerator and denominator of the fraction, which can 1446 * optimized by saving the numerator and denominator of the fraction, which can
1448 * then be incremented by (z + zo) and sin(r) respectively. 1447 * then be incremented by (z + zo) and sin(r) respectively.
1449 */ 1448 */
1450void render_slide(struct slide_data *slide, const int alpha) 1449static void render_slide(struct slide_data *slide, const int alpha)
1451{ 1450{
1452 struct dim *bmp = surface(slide->slide_index); 1451 struct dim *bmp = surface(slide->slide_index);
1453 if (!bmp) { 1452 if (!bmp) {
@@ -1594,7 +1593,7 @@ static inline void set_current_slide(const int slide_index)
1594/** 1593/**
1595 Start the animation for changing slides 1594 Start the animation for changing slides
1596 */ 1595 */
1597void start_animation(void) 1596static void start_animation(void)
1598{ 1597{
1599 step = (target < center_slide.slide_index) ? -1 : 1; 1598 step = (target < center_slide.slide_index) ? -1 : 1;
1600 pf_state = pf_scrolling; 1599 pf_state = pf_scrolling;
@@ -1603,7 +1602,7 @@ void start_animation(void)
1603/** 1602/**
1604 Go to the previous slide 1603 Go to the previous slide
1605 */ 1604 */
1606void show_previous_slide(void) 1605static void show_previous_slide(void)
1607{ 1606{
1608 if (step == 0) { 1607 if (step == 0) {
1609 if (center_index > 0) { 1608 if (center_index > 0) {
@@ -1622,7 +1621,7 @@ void show_previous_slide(void)
1622/** 1621/**
1623 Go to the next slide 1622 Go to the next slide
1624 */ 1623 */
1625void show_next_slide(void) 1624static void show_next_slide(void)
1626{ 1625{
1627 if (step == 0) { 1626 if (step == 0) {
1628 if (center_index < number_of_slides - 1) { 1627 if (center_index < number_of_slides - 1) {
@@ -1639,19 +1638,9 @@ void show_next_slide(void)
1639 1638
1640 1639
1641/** 1640/**
1642 Return true if the rect has size 0
1643*/
1644static inline bool is_empty_rect(struct rect *r)
1645{
1646 return ((r->left == 0) && (r->right == 0) && (r->top == 0)
1647 && (r->bottom == 0));
1648}
1649
1650
1651/**
1652 Render the slides. Updates only the offscreen buffer. 1641 Render the slides. Updates only the offscreen buffer.
1653*/ 1642*/
1654void render_all_slides(void) 1643static void render_all_slides(void)
1655{ 1644{
1656 MYLCD(set_background)(G_BRIGHT(0)); 1645 MYLCD(set_background)(G_BRIGHT(0));
1657 /* TODO: Optimizes this by e.g. invalidating rects */ 1646 /* TODO: Optimizes this by e.g. invalidating rects */
@@ -1705,7 +1694,7 @@ void render_all_slides(void)
1705/** 1694/**
1706 Updates the animation effect. Call this periodically from a timer. 1695 Updates the animation effect. Call this periodically from a timer.
1707*/ 1696*/
1708void update_scroll_animation(void) 1697static void update_scroll_animation(void)
1709{ 1698{
1710 if (step == 0) 1699 if (step == 0)
1711 return; 1700 return;
@@ -1806,7 +1795,7 @@ void update_scroll_animation(void)
1806/** 1795/**
1807 Cleanup the plugin 1796 Cleanup the plugin
1808*/ 1797*/
1809void cleanup(void *parameter) 1798static void cleanup(void *parameter)
1810{ 1799{
1811 (void) parameter; 1800 (void) parameter;
1812 /* Turn on backlight timeout (revert to settings) */ 1801 /* Turn on backlight timeout (revert to settings) */
@@ -1822,7 +1811,7 @@ void cleanup(void *parameter)
1822 Create the "?" slide, that is shown while loading 1811 Create the "?" slide, that is shown while loading
1823 or when no cover was found. 1812 or when no cover was found.
1824 */ 1813 */
1825int create_empty_slide(bool force) 1814static int create_empty_slide(bool force)
1826{ 1815{
1827 if ( force || ! rb->file_exists( EMPTY_SLIDE ) ) { 1816 if ( force || ! rb->file_exists( EMPTY_SLIDE ) ) {
1828 struct bitmap input_bmp; 1817 struct bitmap input_bmp;
@@ -1847,7 +1836,7 @@ int create_empty_slide(bool force)
1847/** 1836/**
1848 Shows the album name setting menu 1837 Shows the album name setting menu
1849*/ 1838*/
1850int album_name_menu(void) 1839static int album_name_menu(void)
1851{ 1840{
1852 int selection = show_album_name; 1841 int selection = show_album_name;
1853 1842
@@ -1862,7 +1851,7 @@ int album_name_menu(void)
1862/** 1851/**
1863 Shows the settings menu 1852 Shows the settings menu
1864 */ 1853 */
1865int settings_menu(void) 1854static int settings_menu(void)
1866{ 1855{
1867 int selection = 0; 1856 int selection = 0;
1868 bool old_val; 1857 bool old_val;
@@ -1937,7 +1926,7 @@ int settings_menu(void)
1937/** 1926/**
1938 Show the main menu 1927 Show the main menu
1939 */ 1928 */
1940int main_menu(void) 1929static int main_menu(void)
1941{ 1930{
1942 int selection = 0; 1931 int selection = 0;
1943 int result; 1932 int result;
@@ -1973,7 +1962,7 @@ int main_menu(void)
1973/** 1962/**
1974 Animation step for zooming into the current cover 1963 Animation step for zooming into the current cover
1975 */ 1964 */
1976void update_cover_in_animation(void) 1965static void update_cover_in_animation(void)
1977{ 1966{
1978 cover_animation_keyframe++; 1967 cover_animation_keyframe++;
1979 if( cover_animation_keyframe < 20 ) { 1968 if( cover_animation_keyframe < 20 ) {
@@ -1993,7 +1982,7 @@ void update_cover_in_animation(void)
1993/** 1982/**
1994 Animation step for zooming out the current cover 1983 Animation step for zooming out the current cover
1995 */ 1984 */
1996void update_cover_out_animation(void) 1985static void update_cover_out_animation(void)
1997{ 1986{
1998 cover_animation_keyframe++; 1987 cover_animation_keyframe++;
1999 if( cover_animation_keyframe <= 15 ) { 1988 if( cover_animation_keyframe <= 15 ) {
@@ -2055,7 +2044,7 @@ static void track_list_yh(int char_height)
2055/** 2044/**
2056 Reset the track list after a album change 2045 Reset the track list after a album change
2057 */ 2046 */
2058void reset_track_list(void) 2047static void reset_track_list(void)
2059{ 2048{
2060 int albumtxt_h = rb->screens[SCREEN_MAIN]->getcharheight(); 2049 int albumtxt_h = rb->screens[SCREEN_MAIN]->getcharheight();
2061 track_list_yh(albumtxt_h); 2050 track_list_yh(albumtxt_h);
@@ -2077,7 +2066,7 @@ void reset_track_list(void)
2077/** 2066/**
2078 Display the list of tracks 2067 Display the list of tracks
2079 */ 2068 */
2080void show_track_list(void) 2069static void show_track_list(void)
2081{ 2070{
2082 MYLCD(clear_display)(); 2071 MYLCD(clear_display)();
2083 if ( center_slide.slide_index != track_index ) { 2072 if ( center_slide.slide_index != track_index ) {
@@ -2116,7 +2105,7 @@ void show_track_list(void)
2116 } 2105 }
2117} 2106}
2118 2107
2119void select_next_track(void) 2108static void select_next_track(void)
2120{ 2109{
2121 if ( selected_track < track_count - 1 ) { 2110 if ( selected_track < track_count - 1 ) {
2122 selected_track++; 2111 selected_track++;
@@ -2127,7 +2116,7 @@ void select_next_track(void)
2127 } 2116 }
2128} 2117}
2129 2118
2130void select_prev_track(void) 2119static void select_prev_track(void)
2131{ 2120{
2132 if (selected_track > 0 ) { 2121 if (selected_track > 0 ) {
2133 if (selected_track==start_index_track_list) start_index_track_list--; 2122 if (selected_track==start_index_track_list) start_index_track_list--;
@@ -2140,7 +2129,7 @@ void select_prev_track(void)
2140/** 2129/**
2141 Draw the current album name 2130 Draw the current album name
2142 */ 2131 */
2143void draw_album_text(void) 2132static void draw_album_text(void)
2144{ 2133{
2145 if (0 == show_album_name) 2134 if (0 == show_album_name)
2146 return; 2135 return;
@@ -2201,7 +2190,7 @@ void draw_album_text(void)
2201 Main function that also contain the main plasma 2190 Main function that also contain the main plasma
2202 algorithm. 2191 algorithm.
2203 */ 2192 */
2204int main(void) 2193static int main(void)
2205{ 2194{
2206 int ret; 2195 int ret;
2207 2196