diff view/View.cpp @ 1329:344f29e46258 zoom

Responding to a hang due to mismatching zoom and block sizes
author Chris Cannam
date Thu, 20 Sep 2018 15:42:12 +0100
parents 646e713a4632
children c1f719094c25
line wrap: on
line diff
--- a/view/View.cpp	Thu Sep 20 13:14:15 2018 +0100
+++ b/view/View.cpp	Thu Sep 20 15:42:12 2018 +0100
@@ -47,7 +47,7 @@
 #include <cassert>
 #include <cmath>
 
-//#define DEBUG_VIEW 1
+#define DEBUG_VIEW 1
 //#define DEBUG_VIEW_WIDGET_PAINT 1
 
 View::View(QWidget *w, bool showProgress) :
@@ -328,6 +328,11 @@
 {
     bool changeVisible = false;
 
+#ifdef DEBUG_VIEW
+    SVCERR << "View::setCentreFrame: from " << m_centreFrame
+           << " to " << f << endl;
+#endif
+
     if (m_centreFrame != f) {
 
         sv_frame_t formerCentre = m_centreFrame;
@@ -351,6 +356,9 @@
 #ifdef DEBUG_VIEW_WIDGET_PAINT
                 SVCERR << "View(" << this << ")::setCentreFrame: newPixel " << newPixel << ", formerPixel " << formerPixel << endl;
 #endif
+                // ensure the centre frame is a multiple of the zoom level
+                m_centreFrame = sv_frame_t(newPixel) * m_zoomLevel.level;
+                
                 update();
                 changeVisible = true;
             }