diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2008-06-28 16:59:56 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2008-06-28 16:59:56 +0000 |
commit | 90b616913b17e418987a0aa8eb8d8a050f619286 (patch) | |
tree | aff899052cad600e0e8f2344562f859430378cd5 | |
parent | d951e169f5f4e82590b36b1e703a09e71da1fdd1 (diff) | |
download | rockbox-90b616913b17e418987a0aa8eb8d8a050f619286.tar.gz rockbox-90b616913b17e418987a0aa8eb8d8a050f619286.zip |
Peakmeters: use screens[].getwidth() and not screens[].width as the latter one returns the LCD width (which really shouldn't be there) - the former returns the width of the viewport. Do some code police as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17841 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/recorder/peakmeter.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c index a55ce063dc..14a29b22ca 100644 --- a/apps/recorder/peakmeter.c +++ b/apps/recorder/peakmeter.c | |||
@@ -916,7 +916,7 @@ void peak_meter_screen(struct screen *display, int x, int y, int height) | |||
916 | { | 916 | { |
917 | peak_meter_draw(display, &scales[display->screen_type], x, y, | 917 | peak_meter_draw(display, &scales[display->screen_type], x, y, |
918 | display->getwidth() - x, height); | 918 | display->getwidth() - x, height); |
919 | } | 919 | } |
920 | /** | 920 | /** |
921 | * Draws a peak meter in the specified size at the specified position. | 921 | * Draws a peak meter in the specified size at the specified position. |
922 | * @param int x - The x coordinate. | 922 | * @param int x - The x coordinate. |
@@ -952,7 +952,7 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
952 | 952 | ||
953 | 953 | ||
954 | if (level_check){ | 954 | if (level_check){ |
955 | /* only read the volume info from MAS if peek since last read*/ | 955 | /* only read the volume info from MAS if peek since last read*/ |
956 | left_level = peak_meter_read_l(); | 956 | left_level = peak_meter_read_l(); |
957 | right_level = peak_meter_read_r(); | 957 | right_level = peak_meter_read_r(); |
958 | level_check = false; | 958 | level_check = false; |
@@ -960,7 +960,7 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
960 | 960 | ||
961 | /* scale the samples dBfs */ | 961 | /* scale the samples dBfs */ |
962 | left = peak_meter_scale_value(left_level, meterwidth); | 962 | left = peak_meter_scale_value(left_level, meterwidth); |
963 | right = peak_meter_scale_value(right_level, meterwidth); | 963 | right = peak_meter_scale_value(right_level, meterwidth); |
964 | 964 | ||
965 | /*if the scale has changed -> recalculate the scale | 965 | /*if the scale has changed -> recalculate the scale |
966 | (The scale becomes invalid when the range changed.) */ | 966 | (The scale becomes invalid when the range changed.) */ |
@@ -972,9 +972,9 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
972 | /* find the real x-coords for predefined interesting | 972 | /* find the real x-coords for predefined interesting |
973 | dBfs values. These only are recalculated when the | 973 | dBfs values. These only are recalculated when the |
974 | scaling of the meter changed. */ | 974 | scaling of the meter changed. */ |
975 | scales->db_scale_lcd_coord[i] = | 975 | scales->db_scale_lcd_coord[i] = |
976 | peak_meter_scale_value( | 976 | peak_meter_scale_value( |
977 | db_scale_src_values[i], | 977 | db_scale_src_values[i], |
978 | meterwidth - 1); | 978 | meterwidth - 1); |
979 | } | 979 | } |
980 | } | 980 | } |
@@ -983,7 +983,7 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
983 | else { | 983 | else { |
984 | db_scale_count = 10; | 984 | db_scale_count = 10; |
985 | for (i = 0; i < db_scale_count; i++) { | 985 | for (i = 0; i < db_scale_count; i++) { |
986 | scales->db_scale_lcd_coord[i] = | 986 | scales->db_scale_lcd_coord[i] = |
987 | (i * (MAX_PEAK / 10) - peak_meter_range_min) * | 987 | (i * (MAX_PEAK / 10) - peak_meter_range_min) * |
988 | meterwidth / pm_range; | 988 | meterwidth / pm_range; |
989 | } | 989 | } |
@@ -1111,7 +1111,8 @@ static void peak_meter_draw(struct screen *display, struct meter_scales *scales, | |||
1111 | start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth); | 1111 | start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth); |
1112 | display->vline(start_trigx, ycenter - 2, ycenter); | 1112 | display->vline(start_trigx, ycenter - 2, ycenter); |
1113 | start_trigx ++; | 1113 | start_trigx ++; |
1114 | if (start_trigx < display->getwidth() ) display->drawpixel(start_trigx, ycenter - 1); | 1114 | if (start_trigx < display->getwidth() ) display->drawpixel(start_trigx, |
1115 | ycenter - 1); | ||
1115 | 1116 | ||
1116 | stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); | 1117 | stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); |
1117 | display->vline(stop_trigx, ycenter - 2, ycenter); | 1118 | display->vline(stop_trigx, ycenter - 2, ycenter); |
@@ -1238,7 +1239,8 @@ int peak_meter_trigger_status(void) | |||
1238 | return trig_status; /* & TRIG_PIT_MASK;*/ | 1239 | return trig_status; /* & TRIG_PIT_MASK;*/ |
1239 | } | 1240 | } |
1240 | 1241 | ||
1241 | void peak_meter_draw_trig(int xpos[], int ypos[], int trig_width[], int nb_screens) | 1242 | void peak_meter_draw_trig(int xpos[], int ypos[], |
1243 | int trig_width[], int nb_screens) | ||
1242 | { | 1244 | { |
1243 | int barstart[NB_SCREENS]; | 1245 | int barstart[NB_SCREENS]; |
1244 | int barend[NB_SCREENS]; | 1246 | int barend[NB_SCREENS]; |
@@ -1354,7 +1356,8 @@ int peak_meter_draw_get_btn(int action_context, int x, int y[], | |||
1354 | { | 1356 | { |
1355 | peak_meter_screen(&screens[i], x, y[i], height); | 1357 | peak_meter_screen(&screens[i], x, y[i], height); |
1356 | screens[i].update_viewport_rect(x, y[i], | 1358 | screens[i].update_viewport_rect(x, y[i], |
1357 | screens[i].width - x, height); | 1359 | screens[i].getwidth() - x, |
1360 | height); | ||
1358 | } | 1361 | } |
1359 | next_refresh += HZ / PEAK_METER_FPS; | 1362 | next_refresh += HZ / PEAK_METER_FPS; |
1360 | dopeek = true; | 1363 | dopeek = true; |