Add Canvas::get_microseconds_since_render_start() method
Initial use is for the WaveView class to determine whether on not to draw the waveform in the GUI thread.
This commit is contained in:
@@ -163,6 +163,18 @@ Canvas::prepare_for_render (Rect const & area) const
|
||||
}
|
||||
}
|
||||
|
||||
gint64
|
||||
Canvas::get_microseconds_since_render_start () const
|
||||
{
|
||||
gint64 timestamp = g_get_monotonic_time();
|
||||
|
||||
if (_last_render_start_timestamp == 0 || timestamp <= _last_render_start_timestamp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return timestamp - _last_render_start_timestamp;
|
||||
}
|
||||
|
||||
ostream&
|
||||
operator<< (ostream& o, Canvas& c)
|
||||
{
|
||||
|
||||
@@ -91,6 +91,8 @@ public:
|
||||
|
||||
gint64 get_last_render_start_timestamp () const { return _last_render_start_timestamp; }
|
||||
|
||||
gint64 get_microseconds_since_render_start () const;
|
||||
|
||||
/** @return root group */
|
||||
Item* root () {
|
||||
return &_root;
|
||||
|
||||
Reference in New Issue
Block a user