add a sort-of hack to allow us to avoid drawing the first pixel of a waveview when necessary
This commit is contained in:
parent
99054ea415
commit
34779ee81e
|
@ -103,6 +103,15 @@ public:
|
|||
void set_channel (int);
|
||||
void set_region_start (ARDOUR::frameoffset_t);
|
||||
|
||||
/** Change the first position drawn by @param pixels.
|
||||
* @param pixels must be positive. This is used by
|
||||
* AudioRegionViews in Ardour to avoid drawing the
|
||||
* first pixel of a waveform, and exists in case
|
||||
* there are uses for WaveView where we do not
|
||||
* want this behaviour.
|
||||
*/
|
||||
void set_start_shift (double pixels);
|
||||
|
||||
void set_fill_color (Color);
|
||||
void set_outline_color (Color);
|
||||
|
||||
|
@ -171,7 +180,8 @@ private:
|
|||
bool _gradient_depth_independent;
|
||||
double _amplitude_above_axis;
|
||||
float _region_amplitude;
|
||||
|
||||
double _start_shift;
|
||||
|
||||
/** The `start' value to use for the region; we can't use the region's
|
||||
* value as the crossfade editor needs to alter it.
|
||||
*/
|
||||
|
|
|
@ -71,6 +71,7 @@ WaveView::WaveView (Canvas* c, boost::shared_ptr<ARDOUR::AudioRegion> region)
|
|||
, _gradient_depth_independent (false)
|
||||
, _amplitude_above_axis (1.0)
|
||||
, _region_amplitude (_region->scale_amplitude ())
|
||||
, _start_shift (0.0)
|
||||
, _region_start (region->start())
|
||||
{
|
||||
VisualPropertiesChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_visual_property_change, this));
|
||||
|
@ -804,7 +805,7 @@ WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
|
|||
* draw "between" pixels at the start and/or end.
|
||||
*/
|
||||
|
||||
const double draw_start = floor (draw.x0);
|
||||
const double draw_start = floor (draw.x0) + _start_shift;
|
||||
const double draw_end = floor (draw.x1);
|
||||
|
||||
// cerr << "Need to draw " << draw_start << " .. " << draw_end << endl;
|
||||
|
@ -1034,3 +1035,16 @@ WaveView::set_global_show_waveform_clipping (bool yn)
|
|||
ClipLevelChanged ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WaveView::set_start_shift (double pixels)
|
||||
{
|
||||
if (pixels < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
begin_visual_change ();
|
||||
_start_shift = pixels;
|
||||
end_visual_change ();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user