diff options
author | Robin Gareus <robin@gareus.org> | 2015-08-20 03:01:51 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2015-08-20 03:01:51 +0200 |
commit | 63e3f326e9f61498a03a62a57d2e0787c19bf5c9 (patch) | |
tree | d766d8dc14f9efe20730209f30c70866e5bbbece /libs/canvas | |
parent | aa3eb11fb31c443d3220104c9b3a8de84402aa22 (diff) |
clear waveform cache when shape changes - fixes #6525
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/canvas/wave_view.h | 1 | ||||
-rw-r--r-- | libs/canvas/wave_view.cc | 18 |
2 files changed, 18 insertions, 1 deletions
diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h index c4e19ec7bb..e9df823a9c 100644 --- a/libs/canvas/canvas/wave_view.h +++ b/libs/canvas/canvas/wave_view.h @@ -126,6 +126,7 @@ class LIBCANVAS_API WaveViewCache uint64_t image_cache_threshold () const { return _image_cache_threshold; } void set_image_cache_threshold (uint64_t); + void clear_cache (); void add (boost::shared_ptr<ARDOUR::AudioSource>, boost::shared_ptr<Entry>); void use (boost::shared_ptr<ARDOUR::AudioSource>, boost::shared_ptr<Entry>); diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index e8db7d8c6a..a0b9e48fda 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -1351,6 +1351,9 @@ WaveView::set_global_shape (Shape s) { if (_global_shape != s) { _global_shape = s; + if (images) { + images->clear_cache (); + } VisualPropertiesChanged (); /* EMIT SIGNAL */ } } @@ -1360,6 +1363,9 @@ WaveView::set_global_logscaled (bool yn) { if (_global_logscaled != yn) { _global_logscaled = yn; + if (images) { + images->clear_cache (); + } VisualPropertiesChanged (); /* EMIT SIGNAL */ } } @@ -1828,9 +1834,19 @@ WaveViewCache::cache_flush () } void +WaveViewCache::clear_cache () +{ + DEBUG_TRACE (DEBUG::WaveView, "clear cache\n"); + const uint64_t image_cache_threshold = _image_cache_threshold; + _image_cache_threshold = 0; + cache_flush (); + _image_cache_threshold = image_cache_threshold; +} + +void WaveViewCache::set_image_cache_threshold (uint64_t sz) { - DEBUG_TRACE (DEBUG::WaveView, string_compose ("new image cache size \n", sz)); + DEBUG_TRACE (DEBUG::WaveView, string_compose ("new image cache size %1\n", sz)); _image_cache_threshold = sz; cache_flush (); } |