diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-17 11:35:13 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-17 11:35:13 -0400 |
commit | 47efeb9f21c936cf2767ea3099e3fe711ff80334 (patch) | |
tree | a4093e86d18f2e464fa8b2e292604a582ce183c9 /libs/canvas | |
parent | 93bc93b6f614123536cd03f1b5c8bc0c64873034 (diff) | |
parent | b31608f64eead818f9f965030ea4cd28e5ccf707 (diff) |
Merge branch 'cache_fixes' of https://github.com/nmains/ardour into cairocanvas
Diffstat (limited to 'libs/canvas')
-rw-r--r-- | libs/canvas/canvas/wave_view.h | 11 | ||||
-rw-r--r-- | libs/canvas/wave_view.cc | 30 |
2 files changed, 33 insertions, 8 deletions
diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h index 674df969a5..c98c62c7a3 100644 --- a/libs/canvas/canvas/wave_view.h +++ b/libs/canvas/canvas/wave_view.h @@ -58,13 +58,18 @@ public: int channel; Coord height; float amplitude; + Color fill_color; + Color outline_color; framepos_t start; framepos_t end; Cairo::RefPtr<Cairo::ImageSurface> image; CacheEntry() : - channel (0), height (0), amplitude(0), start (0), end (0), image (0) {} - CacheEntry(int chan, Coord hght, float amp, framepos_t strt, framepos_t ed, Cairo::RefPtr<Cairo::ImageSurface> img) : - channel (chan), height (hght), amplitude (amp), start (strt), end (ed), image (img) {} + channel (0), height (0), amplitude(0), fill_color (0), + outline_color (0), start (0), end (0), image (0) {} + CacheEntry(int chan, Coord hght, float amp, Color fcol, Color ocol, + framepos_t strt, framepos_t ed, Cairo::RefPtr<Cairo::ImageSurface> img) : + channel (chan), height (hght), amplitude (amp), fill_color (fcol), + outline_color (ocol), start (strt), end (ed), image (img) {} }; /* Displays a single channel of waveform data for the given Region. diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index 2d24e38969..631be6254a 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -223,7 +223,12 @@ WaveView::invalidate_image_cache () for (uint32_t i = 0; i < caches.size (); ++i) { - if (_channel != caches[i].channel || _height != caches[i].height || _region_amplitude != caches[i].amplitude) { + if (_channel != caches[i].channel + || _height != caches[i].height + || _region_amplitude != caches[i].amplitude + || _fill_color != caches[i].fill_color + || _outline_color != caches[i].outline_color) { + continue; } @@ -258,7 +263,12 @@ WaveView::consolidate_image_cache () const for (uint32_t i = 0; i < caches.size (); ++i) { - if (_channel != caches[i].channel || _height != caches[i].height || _region_amplitude != caches[i].amplitude) { + if (_channel != caches[i].channel + || _height != caches[i].height + || _region_amplitude != caches[i].amplitude + || _fill_color != caches[i].fill_color + || _outline_color != caches[i].outline_color) { + other_entries++; continue; } @@ -268,7 +278,12 @@ WaveView::consolidate_image_cache () const for (uint32_t j = i; j < caches.size (); ++j) { - if (i == j || _channel != caches[j].channel || _height != caches[i].height || _region_amplitude != caches[i].amplitude) { + if (i == j || _channel != caches[j].channel + || _height != caches[i].height + || _region_amplitude != caches[i].amplitude + || _fill_color != caches[i].fill_color + || _outline_color != caches[i].outline_color) { + continue; } @@ -546,7 +561,12 @@ WaveView::get_image (Cairo::RefPtr<Cairo::ImageSurface>& image, framepos_t start */ for (uint32_t i = 0; i < caches.size (); ++i) { - if (_channel != caches[i].channel || _height != caches[i].height || _region_amplitude != caches[i].amplitude) { + if (_channel != caches[i].channel + || _height != caches[i].height + || _region_amplitude != caches[i].amplitude + || _fill_color != caches[i].fill_color + || _outline_color != caches[i].outline_color) { + continue; } @@ -589,7 +609,7 @@ WaveView::get_image (Cairo::RefPtr<Cairo::ImageSurface>& image, framepos_t start draw_image (image, peaks.get(), n_peaks); - _image_cache[_region->audio_source ()].push_back (CacheEntry (_channel, _height, _region_amplitude, sample_start, sample_end, image)); + _image_cache[_region->audio_source ()].push_back (CacheEntry (_channel, _height, _region_amplitude, _fill_color, _outline_color, sample_start, sample_end, image)); image_offset = (sample_start - _region->start()) / _samples_per_pixel; |