From aa480b833800ad943ede17c26df3d7103f5da28d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 28 Jun 2013 17:09:39 -0400 Subject: [PATCH] make clip indicators more visible (the smaller of 7 pixels or 5% of track height) --- libs/canvas/wave_view.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index b6d3a1c1dd..ce5c87ccfd 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -330,6 +330,11 @@ WaveView::draw_image (PeakData* _peaks, int n_peaks) const context->set_source_rgba (0, 0, 0, 1.0); + /* the height of the clip-indicator should be at most 7 pixels, + or 5% of the height of the waveview item. + */ + const double clip_height = min (7.0, ceil (_height * 0.05)); + for (int i = 0; i < n_peaks; ++i) { context->move_to (i, tips[i].top); @@ -338,7 +343,7 @@ WaveView::draw_image (PeakData* _peaks, int n_peaks) const if (show_top_clip) { context->set_source_rgba (1.0, 0, 0, 1.0); - context->rel_line_to (0, 2.0); + context->rel_line_to (0, clip_height); context->stroke (); context->set_source_rgba (0.0, 0, 0, 1.0); } else { @@ -350,7 +355,7 @@ WaveView::draw_image (PeakData* _peaks, int n_peaks) const context->move_to (i, tips[i].bot); if (tips[i].clip_min) { context->set_source_rgba (1.0, 0, 0, 1.0); - context->rel_line_to (0, -2.0); + context->rel_line_to (0, -clip_height); context->stroke (); context->set_source_rgba (0.0, 0, 0, 1.0); } else {