Mercurial > hg > svgui
diff layer/WaveformLayer.cpp @ 214:8520b7918104
* Fix overzealous cacheing in waveform layer that was leading to inaccurate
positioning of view rects & playback pointer on overview widget sometimes
author | Chris Cannam |
---|---|
date | Thu, 01 Mar 2007 17:12:50 +0000 |
parents | 17f8d9cf60d7 |
children | 34bbbcb3c01f |
line wrap: on
line diff
--- a/layer/WaveformLayer.cpp Thu Mar 01 15:35:27 2007 +0000 +++ b/layer/WaveformLayer.cpp Thu Mar 01 17:12:50 2007 +0000 @@ -466,20 +466,30 @@ if (m_aggressive) { +#ifdef DEBUG_WAVEFORM_PAINT + std::cerr << "WaveformLayer::paint: aggressive is true" << std::endl; +#endif + if (m_cacheValid && (zoomLevel != m_cacheZoomLevel)) { m_cacheValid = false; } + if (!m_cache || m_cache->width() != w || m_cache->height() != h) { +#ifdef DEBUG_WAVEFORM_PAINT + if (m_cache) { + std::cerr << "WaveformLayer::paint: cache size " << m_cache->width() << "x" << m_cache->height() << " differs from view size " << w << "x" << h << ": regenerating aggressive cache" << std::endl; + } +#endif + delete m_cache; + m_cache = new QPixmap(w, h); + m_cacheValid = false; + } + if (m_cacheValid) { viewPainter.drawPixmap(rect, *m_cache, rect); return; } - if (!m_cache || m_cache->width() != w || m_cache->height() != h) { - delete m_cache; - m_cache = new QPixmap(w, h); - } - paint = new QPainter(m_cache); paint->setPen(Qt::NoPen);