diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-24 14:12:13 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-24 14:12:13 -0400 |
commit | fe672c827cb2c08c94b1fa7e527d884c522a1af7 (patch) | |
tree | f967f5b903e79bf0e4e7c5b08fd1cc8a8ff93130 | |
parent | 2ea5962af2a389277703c6eebc2160cf52302468 (diff) |
show zero line when a DC offset moves waveform so that it doesn't intersect with the zero line (from Nimal Ratnayake <nimalr@pdn.ac.lk>)4.1
-rw-r--r-- | libs/canvas/wave_view.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index 1a969d60e3..809ea4ec6b 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -575,7 +575,7 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak outline_context->stroke (); } else { - const double height_2 = _height * .5; + const int height_zero = floor( _height * .5); for (int i = 0; i < n_peaks; ++i) { @@ -601,10 +601,11 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak } } - /* zero line, show only if there is enough spread */ + /* zero line, show only if there is enough spread + or the waveform line does not cross zero line */ - if (tips[i].spread >= 5.0 && show_zero_line()) { - zero_context->move_to (i, floor(height_2)); + if (show_zero_line() && ((tips[i].spread >= 5.0) || (tips[i].top > height_zero ) || (tips[i].bot < height_zero)) ) { + zero_context->move_to (i, height_zero); zero_context->rel_line_to (1.0, 0); } |