diff view/View.cpp @ 244:5105be027d8e

* Fix #1707650 refreshes not happening
author Chris Cannam
date Fri, 27 Apr 2007 14:35:04 +0000
parents 90122740323f
children 28c8e8e3c537
line wrap: on
line diff
--- a/view/View.cpp	Fri Apr 27 13:46:00 2007 +0000
+++ b/view/View.cpp	Fri Apr 27 14:35:04 2007 +0000
@@ -415,7 +415,7 @@
 View::getZoomLevel() const
 {
 #ifdef DEBUG_VIEW_WIDGET_PAINT
-	std::cout << "zoom level: " << m_zoomLevel << std::endl;
+//	std::cout << "zoom level: " << m_zoomLevel << std::endl;
 #endif
     return m_zoomLevel;
 }
@@ -888,6 +888,9 @@
 void
 View::viewZoomLevelChanged(View *p, unsigned long z, bool locked)
 {
+#ifdef DEBUG_VIEW_WIDGET_PAINT
+    std::cerr  << "View[" << this << "]: viewZoomLevelChanged(" << p << ", " << z << ", " << locked << ")" << std::endl;
+#endif
     if (m_followZoom && p != this && locked) {
         setZoomLevel(z);
     }
@@ -1272,6 +1275,12 @@
     }
 
     if (!scrollables.empty()) {
+
+#ifdef DEBUG_VIEW_WIDGET_PAINT
+        std::cerr << "View(" << this << "): cache " << m_cache << ", cache zoom "
+                  << m_cacheZoomLevel << ", zoom " << m_zoomLevel << std::endl;
+#endif
+
 	if (!m_cache ||
 	    m_cacheZoomLevel != m_zoomLevel ||
 	    width() != m_cache->width() ||
@@ -1280,6 +1289,8 @@
 	    // cache is not valid
 
 	    if (cacheRect.width() < width()/10) {
+		delete m_cache;
+                m_cache = 0;
 #ifdef DEBUG_VIEW_WIDGET_PAINT
 		std::cerr << "View(" << this << ")::paintEvent: small repaint, not bothering to recreate cache" << std::endl;
 #endif