fix logic error that meant one side of the waveform outline is not drawn; draw zero line before outline, for better effects with low amplitude waves
This commit is contained in:
parent
07fafac36e
commit
71c417948e
@ -491,8 +491,20 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
|
|||||||
|
|
||||||
context->stroke ();
|
context->stroke ();
|
||||||
|
|
||||||
|
/* zero line goes next, so that the outline/clip is on top of it
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (show_zero_line()) {
|
||||||
|
set_source_rgba (context, _zero_color);
|
||||||
|
context->set_line_width (1.0);
|
||||||
|
context->move_to (0, y_extent (0.0) + 0.5);
|
||||||
|
context->line_to (n_peaks, y_extent (0.0) + 0.5);
|
||||||
|
context->stroke ();
|
||||||
|
}
|
||||||
|
|
||||||
/* now add dots to the top and bottom of each line (this is
|
/* now add dots to the top and bottom of each line (this is
|
||||||
* modelled on pyramix, except that we add clipping indicators.
|
* modelled on pyramix, except that we also visual indicate
|
||||||
|
* clipping if it occurs).
|
||||||
*
|
*
|
||||||
* the height of the clip-indicator should be at most 7 pixels,
|
* the height of the clip-indicator should be at most 7 pixels,
|
||||||
* or 5% of the height of the waveview item.
|
* or 5% of the height of the waveview item.
|
||||||
@ -501,15 +513,11 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
|
|||||||
const double clip_height = min (7.0, ceil (_height * 0.05));
|
const double clip_height = min (7.0, ceil (_height * 0.05));
|
||||||
|
|
||||||
set_source_rgba (context, _outline_color);
|
set_source_rgba (context, _outline_color);
|
||||||
|
|
||||||
for (int i = 0; i < n_peaks; ++i) {
|
for (int i = 0; i < n_peaks; ++i) {
|
||||||
|
|
||||||
context->move_to (i, tips[i].top);
|
context->move_to (i, tips[i].top);
|
||||||
|
if (_global_show_waveform_clipping && ((_shape == WaveView::Rectified && (tips[i].clip_max || tips[i].clip_min)) || tips[i].clip_max)) {
|
||||||
bool show_top_clip = _global_show_waveform_clipping &&
|
|
||||||
((_shape == WaveView::Rectified && (tips[i].clip_max || tips[i].clip_min)) ||
|
|
||||||
tips[i].clip_max);
|
|
||||||
|
|
||||||
if (show_top_clip) {
|
|
||||||
/* clip-indicating upper terminal line */
|
/* clip-indicating upper terminal line */
|
||||||
set_source_rgba (context, _clip_color);
|
set_source_rgba (context, _clip_color);
|
||||||
context->rel_line_to (0, clip_height);
|
context->rel_line_to (0, clip_height);
|
||||||
@ -521,30 +529,20 @@ WaveView::draw_image (Cairo::RefPtr<Cairo::ImageSurface>& image, PeakData* _peak
|
|||||||
context->stroke ();
|
context->stroke ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context->move_to (i, tips[i].bot);
|
||||||
if (_global_show_waveform_clipping && _shape != WaveView::Rectified) {
|
if (_global_show_waveform_clipping && _shape != WaveView::Rectified && tips[i].clip_min) {
|
||||||
context->move_to (i, tips[i].bot);
|
/* clip-indicating lower terminal line */
|
||||||
if (tips[i].clip_min) {
|
set_source_rgba (context, _clip_color);
|
||||||
/* clip-indicating lower terminal line */
|
context->rel_line_to (0, -clip_height);
|
||||||
set_source_rgba (context, _clip_color);
|
context->stroke ();
|
||||||
context->rel_line_to (0, -clip_height);
|
set_source_rgba (context, _outline_color);
|
||||||
context->stroke ();
|
} else {
|
||||||
set_source_rgba (context, _outline_color);
|
/* normal lower terminal dot */
|
||||||
} else {
|
context->rel_line_to (0, -1.0);
|
||||||
/* normal lower terminal dot */
|
context->stroke ();
|
||||||
context->rel_line_to (0, -1.0);
|
|
||||||
context->stroke ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show_zero_line()) {
|
|
||||||
set_source_rgba (context, _zero_color);
|
|
||||||
context->set_line_width (1.0);
|
|
||||||
context->move_to (0, y_extent (0.0) + 0.5);
|
|
||||||
context->line_to (n_peaks, y_extent (0.0) + 0.5);
|
|
||||||
context->stroke ();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user