summaryrefslogtreecommitdiff
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
parent1e9789879ff620c78b594801bf37abc256bdcc2b (diff)
downloadrockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.zip
rockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.tar.gz
rockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.tar.bz2
rockbox-f50885534ec6fa78c2c89e275c5ffd592be5cd2e.tar.xz
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
-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
-rw-r--r--utils/wpseditor/libwps/src/dummies.c4
6 files changed, 17 insertions, 19 deletions
diff --git a/apps/abrepeat.c b/apps/abrepeat.c
index 5fbd880..aa37577 100644
--- a/apps/abrepeat.c
+++ b/apps/abrepeat.c
@@ -165,8 +165,7 @@ void ab_set_B_marker(unsigned int song_position)
static inline int ab_calc_mark_x_pos(int mark, int capacity,
int offset, int size)
{
- int w = size - offset;
- return offset + ( (w * mark) / capacity );
+ return offset + ( (size * mark) / capacity );
}
static inline void ab_draw_vertical_line_mark(struct screen * screen,
@@ -195,14 +194,14 @@ static inline void ab_draw_arrow_mark(struct screen * screen,
}
void ab_draw_markers(struct screen * screen, int capacity,
- int x0, int x1, int y, int h)
+ int x, int y, int w, int h)
{
/* if both markers are set, determine if they're far enough apart
to draw arrows */
if ( ab_A_marker_set() && ab_B_marker_set() )
{
- int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1);
- int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1);
+ 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;
if ( (xb-xa) < (arrow_width*2) )
{
@@ -219,12 +218,12 @@ void ab_draw_markers(struct screen * screen, int capacity,
{
if (ab_A_marker_set())
{
- int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x0, x1);
+ int xa = ab_calc_mark_x_pos(ab_A_marker, capacity, x, w);
ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT);
}
if (ab_B_marker_set())
{
- int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x0, x1);
+ int xb = ab_calc_mark_x_pos(ab_B_marker, capacity, x, w);
ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT);
}
}
diff --git a/apps/abrepeat.h b/apps/abrepeat.h
index 3bed566..3c9853f 100644
--- a/apps/abrepeat.h
+++ b/apps/abrepeat.h
@@ -49,7 +49,7 @@ void ab_end_of_track_report(void);
#ifdef HAVE_LCD_BITMAP
#include "screen_access.h"
void ab_draw_markers(struct screen * screen, int capacity,
- int x0, int x1, int y, int h);
+ int x, int y, int w, int h);
#endif
/* These functions really need to be inlined for speed */
diff --git a/apps/cuesheet.c b/apps/cuesheet.c
index ef1eff8..cb3ba65 100644
--- a/apps/cuesheet.c
+++ b/apps/cuesheet.c
@@ -381,16 +381,15 @@ static inline void draw_veritcal_line_mark(struct screen * screen,
}
/* draw the cuesheet markers for a track of length "tracklen",
- between (x1,y) and (x2,y) */
+ between (x,y) and (x+w,y) */
void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
unsigned long tracklen,
- int x1, int x2, int y, int h)
+ int x, int y, int w, int h)
{
int i,xi;
- int w = x2 - x1;
for (i=1; i < cue->track_count; i++)
{
- xi = x1 + (w * cue->tracks[i].offset)/tracklen;
+ xi = x + (w * cue->tracks[i].offset)/tracklen;
draw_veritcal_line_mark(screen, xi, y, h);
}
}
diff --git a/apps/cuesheet.h b/apps/cuesheet.h
index c5d7365..8e92664 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_
/* draw track markers on the progressbar */
void cue_draw_markers(struct screen *screen, struct cuesheet *cue,
unsigned long tracklen,
- int x1, int x2, int y, int h);
+ int x, int y, int w, int h);
#endif
/* 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 97f9ee3..845ea18 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,
int y = pb->y, height = pb->height;
unsigned long length, elapsed;
- if (pb->height < 0 && !pb->have_bitmap_pb)
+ if (height < 0)
height = font_get(wps_vp->vp.font)->height;
if (y < 0)
{
int line_height = font_get(wps_vp->vp.font)->height;
/* center the pb in the line, but only if the line is higher than the pb */
- int center = (line_height-pb->height)/2;
+ int center = (line_height-height)/2;
/* if Y was not set calculate by font height,Y is -line_number-1 */
y = (-y -1)*line_height + (0 > center ? 0 : center);
}
@@ -160,12 +160,12 @@ static void draw_progressbar(struct gui_wps *gwps,
#ifdef AB_REPEAT_ENABLE
if (ab_repeat_mode_enabled())
ab_draw_markers(display, id3->length,
- pb->x, pb->x + pb->width, y, height);
+ pb->x, y, pb->width, height);
#endif
if (id3->cuesheet)
cue_draw_markers(display, id3->cuesheet, id3->length,
- pb->x, pb->x + pb->width, y+1, height-2);
+ pb->x, y+1, pb->width, height-2);
}
}
diff --git a/utils/wpseditor/libwps/src/dummies.c b/utils/wpseditor/libwps/src/dummies.c
index 96c30ee..faeba63 100644
--- a/utils/wpseditor/libwps/src/dummies.c
+++ b/utils/wpseditor/libwps/src/dummies.c
@@ -194,7 +194,7 @@ bool curr_cuesheet_skip(int direction, unsigned long curr_pos){return false;}
#ifdef HAVE_LCD_BITMAP
/* draw track markers on the progressbar */
void cue_draw_markers(struct screen *screen, unsigned long tracklen,
-int x1, int x2, int y, int h){}
+int x, int y, int w, int h){}
#endif
#ifdef HAVE_ALBUMART
@@ -383,7 +383,7 @@ long default_event_handler(long event)
}
void ab_draw_markers(struct screen * screen, int capacity,
- int x0, int x1, int y, int h)
+ int x, int y, int w, int h)
{
}
void pcmbuf_beep(unsigned int frequency, size_t duration, int amplitude){}