changeset 1352:4949061fcb8c zoom

Debug tweaks
author Chris Cannam
date Fri, 05 Oct 2018 09:59:41 +0100
parents 615eb28768ca
children 86429ff00f05 e848ea0850fe
files layer/WaveformLayer.cpp view/Pane.cpp view/View.cpp
diffstat 3 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/layer/WaveformLayer.cpp	Mon Oct 01 15:48:20 2018 +0100
+++ b/layer/WaveformLayer.cpp	Fri Oct 05 09:59:41 2018 +0100
@@ -33,7 +33,7 @@
 #include <iostream>
 #include <cmath>
 
-#define DEBUG_WAVEFORM_PAINT 1
+//#define DEBUG_WAVEFORM_PAINT 1
 //#define DEBUG_WAVEFORM_PAINT_BY_PIXEL 1
 
 using std::vector;
@@ -733,7 +733,8 @@
                             QRect rect, int ch,
                             const RangeVec &ranges,
                             int blockSize,
-                            sv_frame_t frame0, sv_frame_t frame1)
+                            sv_frame_t frame0,
+                            sv_frame_t frame1)
     const
 {
     int x0 = rect.left();
@@ -792,6 +793,8 @@
 
 #ifdef DEBUG_WAVEFORM_PAINT
     SVCERR << "paint channel " << ch << ": frame0 = " << frame0 << ", frame1 = " << frame1 << ", blockSize = " << blockSize << ", have " << ranges.size() << " range blocks of which ours is index " << rangeix << " with " << ranges[rangeix].size() << " ranges in it" << endl;
+#else
+    (void)frame1; // not actually used
 #endif
 
     for (int x = x0; x <= x1; ++x) {
--- a/view/Pane.cpp	Mon Oct 01 15:48:20 2018 +0100
+++ b/view/Pane.cpp	Fri Oct 05 09:59:41 2018 +0100
@@ -213,12 +213,15 @@
         }
     }
 
+    SVCERR << "haveConstraint = " << haveConstraint << endl;
+            
     if (haveConstraint) {
         while (true) {
             //!!! this won't terminate if level is in the PixelsPerFrame zone
             if (getZoomLevel() == level) current = count;
             ZoomLevel newLevel = getZoomConstraintLevel(level.incremented(),
                                                         ZoomConstraint::RoundUp);
+            SVCERR << "newLevel = " << newLevel << endl;
             if (newLevel == level) break;
             level = newLevel;
             if (++count == 50) break;
@@ -240,7 +243,7 @@
                 step *= 2;
                 --pwr;
             }
-//            cerr << level << endl;
+            cerr << level.level << ", step " << step << endl;
             level.level += step;
             if (++count == 100 || level.level > 262144) break;
         }
--- a/view/View.cpp	Mon Oct 01 15:48:20 2018 +0100
+++ b/view/View.cpp	Fri Oct 05 09:59:41 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) :
@@ -427,6 +427,7 @@
         result = fdiff + m_centreFrame;
     }
 
+#ifdef DEBUG_VIEW
     if (x == 0) {
         SVCERR << "getFrameForX(" << x << "): diff = " << diff << ", fdiff = "
                << fdiff << ", m_centreFrame = " << m_centreFrame
@@ -436,7 +437,8 @@
                << ", will return " << result
                << endl;
     }
-
+#endif
+    
     return result;
 }