mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
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>)
This commit is contained in:
parent
2ea5962af2
commit
fe672c827c
1 changed files with 5 additions and 4 deletions
|
|
@ -575,7 +575,7 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
|
||||||
outline_context->stroke ();
|
outline_context->stroke ();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const double height_2 = _height * .5;
|
const int height_zero = floor( _height * .5);
|
||||||
|
|
||||||
for (int i = 0; i < n_peaks; ++i) {
|
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()) {
|
if (show_zero_line() && ((tips[i].spread >= 5.0) || (tips[i].top > height_zero ) || (tips[i].bot < height_zero)) ) {
|
||||||
zero_context->move_to (i, floor(height_2));
|
zero_context->move_to (i, height_zero);
|
||||||
zero_context->rel_line_to (1.0, 0);
|
zero_context->rel_line_to (1.0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue