summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-09-12 16:42:55 +0200
committerRobin Gareus <robin@gareus.org>2014-09-12 16:42:55 +0200
commit98249a25630495df94209d33362ae9eecaaca271 (patch)
treef4a646518fab79a0f6972111240074ab236f12af
parentf3f80900f14ae8f8d577f3eb098b5064d4aa0859 (diff)
update waveform drawing for zoomed-in, non-overlapping min/max peaks
-rw-r--r--libs/canvas/wave_view.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc
index 142867c5e2..dcbe9c9fae 100644
--- a/libs/canvas/wave_view.cc
+++ b/libs/canvas/wave_view.cc
@@ -466,9 +466,9 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
bot = 0.0;
}
- tips[i].spread = fabs (((1.0 - top) * (_height/2.0)) - ((1.0 - bot) * _height/2.0));
tips[i].top = y_extent (top, false);
tips[i].bot = y_extent (bot, true);
+ tips[i].spread = fabs (tips[i].top - tips[i].bot);
}
} else {
@@ -484,7 +484,7 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
tips[i].top = y_extent (_peaks[i].min, false);
tips[i].bot = y_extent (_peaks[i].max, true);
- tips[i].spread = fabs (((1.0 - _peaks[i].max) * (_height/2.0)) - ((1.0 - _peaks[i].min) * (_height/2.0)));
+ tips[i].spread = fabs (tips[i].top - tips[i].bot);
}
}
@@ -578,6 +578,17 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
wave_context->line_to (i, tips[i].bot);
}
+ if (i > 0) {
+ if (tips[i-1].top < tips[i].bot) {
+ wave_context->move_to (i-1, tips[i-1].top);
+ wave_context->line_to (i, tips[i].bot);
+ }
+ else if (tips[i-1].bot > tips[i].top) {
+ wave_context->move_to (i-1, tips[i-1].bot);
+ wave_context->line_to (i, tips[i].top);
+ }
+ }
+
/* zero line */
if (tips[i].spread >= 5.0 && show_zero_line()) {