summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTeruaki Kawashima <teru@rockbox.org>2010-03-07 12:51:23 +0000
committerTeruaki Kawashima <teru@rockbox.org>2010-03-07 12:51:23 +0000
commitf50885534ec6fa78c2c89e275c5ffd592be5cd2e (patch)
treeb60a7d0f7a1c5124cddedeac585c0bb1c1a11d4f /apps
parent1e9789879ff620c78b594801bf37abc256bdcc2b (diff)
downloadrockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.tar.gz
rockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.zip
Pass width instead of x+width to ab_draw_markers()/cue_draw_markers() and don't recalculate the width in these functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25053 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/abrepeat.c13
-rw-r--r--apps/abrepeat.h2
-rw-r--r--apps/cuesheet.c7
-rw-r--r--apps/cuesheet.h2
-rw-r--r--apps/gui/skin_engine/skin_display.c8
5 files changed, 15 insertions, 17 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 }
diff --git a/apps/abrepeat.h b/apps/abrepeat.h
index 3bed56678d..3c9853f2c5 100644
--- a/apps/abrepeat.h
+++ b/apps/abrepeat.h
@@ -49,7 +49,7 @@ void ab_end_of_track_report(void);
49#ifdef HAVE_LCD_BITMAP 49#ifdef HAVE_LCD_BITMAP
50#include "screen_access.h" 50#include "screen_access.h"
51void ab_draw_markers(struct screen * screen, int capacity, 51void ab_draw_markers(struct screen * screen, int capacity,
52 int x0, int x1, int y, int h); 52 int x, int y, int w, int h);
53#endif 53#endif
54 54
55/* These functions really need to be inlined for speed */ 55/* These functions really need to be inlined for speed */
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index ef1eff8a85..cb3ba6569a 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -381,16 +381,15 @@ static inline void draw_veritcal_line_mark(struct screen * screen,
381} 381}
382 382
383/* draw the cuesheet markers for a track of length "tracklen", 383/* draw the cuesheet markers for a track of length "tracklen",
384 between (x1,y) and (x2,y) */ 384 between (x,y) and (x+w,y) */
385void cue_draw_markers(struct screen *screen, struct cuesheet *cue, 385void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
386 unsigned long tracklen, 386 unsigned long tracklen,
387 int x1, int x2, int y, int h) 387 int x, int y, int w, int h)
388{ 388{
389 int i,xi; 389 int i,xi;
390 int w = x2 - x1;
391 for (i=1; i < cue->track_count; i++) 390 for (i=1; i < cue->track_count; i++)
392 { 391 {
393 xi = x1 + (w * cue->tracks[i].offset)/tracklen; 392 xi = x + (w * cue->tracks[i].offset)/tracklen;
394 draw_veritcal_line_mark(screen, xi, y, h); 393 draw_veritcal_line_mark(screen, xi, y, h);
395 } 394 }
396} 395}
diff --git a/apps/cuesheet.h b/apps/cuesheet.h
index c5d736573b..8e9266416d 100644
--- a/apps/cuesheet.h
+++ b/apps/cuesheet.h
@@ -79,7 +79,7 @@ bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_
79/* draw track markers on the progressbar */ 79/* draw track markers on the progressbar */
80void cue_draw_markers(struct screen *screen, struct cuesheet *cue, 80void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
81 unsigned long tracklen, 81 unsigned long tracklen,
82 int x1, int x2, int y, int h); 82 int x, int y, int w, int h);
83#endif 83#endif
84 84
85/* check if the subtrack has changed */ 85/* check if the subtrack has changed */
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 97f9ee3748..845ea18608 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -124,14 +124,14 @@ static void draw_progressbar(struct gui_wps *gwps,
124 int y = pb->y, height = pb->height; 124 int y = pb->y, height = pb->height;
125 unsigned long length, elapsed; 125 unsigned long length, elapsed;
126 126
127 if (pb->height < 0 && !pb->have_bitmap_pb) 127 if (height < 0)
128 height = font_get(wps_vp->vp.font)->height; 128 height = font_get(wps_vp->vp.font)->height;
129 129
130 if (y < 0) 130 if (y < 0)
131 { 131 {
132 int line_height = font_get(wps_vp->vp.font)->height; 132 int line_height = font_get(wps_vp->vp.font)->height;
133 /* center the pb in the line, but only if the line is higher than the pb */ 133 /* center the pb in the line, but only if the line is higher than the pb */
134 int center = (line_height-pb->height)/2; 134 int center = (line_height-height)/2;
135 /* if Y was not set calculate by font height,Y is -line_number-1 */ 135 /* if Y was not set calculate by font height,Y is -line_number-1 */
136 y = (-y -1)*line_height + (0 > center ? 0 : center); 136 y = (-y -1)*line_height + (0 > center ? 0 : center);
137 } 137 }
@@ -160,12 +160,12 @@ static void draw_progressbar(struct gui_wps *gwps,
160#ifdef AB_REPEAT_ENABLE 160#ifdef AB_REPEAT_ENABLE
161 if (ab_repeat_mode_enabled()) 161 if (ab_repeat_mode_enabled())
162 ab_draw_markers(display, id3->length, 162 ab_draw_markers(display, id3->length,
163 pb->x, pb->x + pb->width, y, height); 163 pb->x, y, pb->width, height);
164#endif 164#endif
165 165
166 if (id3->cuesheet) 166 if (id3->cuesheet)
167 cue_draw_markers(display, id3->cuesheet, id3->length, 167 cue_draw_markers(display, id3->cuesheet, id3->length,
168 pb->x, pb->x + pb->width, y+1, height-2); 168 pb->x, y+1, pb->width, height-2);
169 } 169 }
170} 170}
171 171