changeset 1552:045063dcd2bc

Merge
author Chris Cannam
date Thu, 21 Nov 2019 14:03:19 +0000
parents e79731086b0f (current diff) e95cefd4aa81 (diff)
children 76e4302a3fc2
files layer/NoteLayer.cpp
diffstat 7 files changed, 56 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/layer/BoxLayer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/BoxLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -540,7 +540,8 @@
 
 //    Profiler profiler("BoxLayer::paint", true);
 
-    int x0 = rect.left() - 40, x1 = rect.right();
+    int x0 = rect.left() - 40;
+    int x1 = x0 + rect.width() + 80;
 
     sv_frame_t wholeFrame0 = v->getFrameForX(0);
     sv_frame_t wholeFrame1 = v->getFrameForX(v->getPaintWidth());
--- a/layer/Colour3DPlotRenderer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/Colour3DPlotRenderer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -480,7 +480,7 @@
     if (!model) return magRange;
     
     int x0 = rect.left();
-    int x1 = rect.right() + 1;
+    int x1 = x0 + rect.width();
 
     int h = v->getPaintHeight();
 
--- a/layer/NoteLayer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/NoteLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -714,7 +714,9 @@
 
 //    Profiler profiler("NoteLayer::paint", true);
 
-    int x0 = rect.left(), x1 = rect.right();
+    int x0 = rect.left();
+    int x1 = x0 + rect.width();
+    
     sv_frame_t frame0 = v->getFrameForX(x0);
     sv_frame_t frame1 = v->getFrameForX(x1);
 
--- a/layer/RegionLayer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/RegionLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -849,7 +849,8 @@
 
 //    Profiler profiler("RegionLayer::paint", true);
 
-    int x0 = rect.left() - 40, x1 = rect.right();
+    int x0 = rect.left() - 40;
+    int x1 = x0 + rect.width() + 80;
 
     sv_frame_t wholeFrame0 = v->getFrameForX(0);
     sv_frame_t wholeFrame1 = v->getFrameForX(v->getPaintWidth());
--- a/layer/TextLayer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/TextLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -299,7 +299,9 @@
 
 //    Profiler profiler("TextLayer::paint", true);
 
-    int x0 = rect.left(), x1 = rect.right();
+    int x0 = rect.left();
+    int x1 = x0 + rect.width();
+    
     int overlap = ViewManager::scalePixelSize(150);
     sv_frame_t frame0 = v->getFrameForX(x0 - overlap);
     sv_frame_t frame1 = v->getFrameForX(x1 + overlap);
--- a/layer/TimeInstantLayer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/TimeInstantLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -321,11 +321,20 @@
 
 //    Profiler profiler("TimeInstantLayer::paint", true);
 
-    int x0 = rect.left(), x1 = rect.right();
+    int x0 = rect.left();
+    int x1 = x0 + rect.width();
 
-    sv_frame_t frame0 = v->getFrameForX(x0);
+    sv_frame_t resolution = model->getResolution();
+    
+    sv_frame_t frame0 = v->getFrameForX(x0) - resolution;
     sv_frame_t frame1 = v->getFrameForX(x1);
 
+#ifdef DEBUG_TIME_INSTANT_LAYER
+    SVCERR << "TimeInstantLayer[" << this << "]::paint: x0 = "
+           << x0 << ", x1 = " << x1 << ", frame0 = " << frame0
+           << ", frame1 = " << frame1 << endl;
+#endif
+    
     int overspill = 0;
     if (m_plotStyle == PlotSegmentation) {
         // We need to start painting at the prior point, so we can
@@ -334,7 +343,13 @@
     }
     
     EventVector points(model->getEventsWithin(frame0, frame1 - frame0,
-                                                overspill));
+                                              overspill));
+
+#ifdef DEBUG_TIME_INSTANT_LAYER
+    SVCERR << "TimeInstantLayer[" << this << "]::paint: have " << points.size()
+           << " point(s) with overspill = " << overspill << " from model "
+           << getModel() << endl;
+#endif
 
     bool odd = false;
     if (m_plotStyle == PlotSegmentation && !points.empty()) {
@@ -364,9 +379,6 @@
         oddBrushColour.setAlpha(100);
     }
 
-//    SVDEBUG << "TimeInstantLayer::paint: resolution is "
-//              << model->getResolution() << " frames" << endl;
-
     QPoint localPos;
     sv_frame_t illuminateFrame = -1;
 
@@ -388,8 +400,18 @@
         ++j;
 
         int x = v->getXForFrame(p.getFrame());
+
+#ifdef DEBUG_TIME_INSTANT_LAYER
+        SVCERR << "point frame = " << p.getFrame() << " -> x = " << x << endl;
+#endif
+        
         if (x == prevX && m_plotStyle == PlotInstants &&
-            p.getFrame() != illuminateFrame) continue;
+            p.getFrame() != illuminateFrame) {
+#ifdef DEBUG_TIME_INSTANT_LAYER
+            SVCERR << "(skipping)" << endl;
+#endif
+            continue;
+        }
 
         int iw = v->getXForFrame(p.getFrame() + model->getResolution()) - x;
         if (iw < 2) {
@@ -410,6 +432,10 @@
             paint.setPen(brushColour);
         }
 
+#ifdef DEBUG_TIME_INSTANT_LAYER
+        SVCERR << "m_plotStyle = " << m_plotStyle << ", iw = " << iw << endl;
+#endif
+        
         if (m_plotStyle == PlotInstants) {
             if (iw > 1) {
                 paint.drawRect(x, 0, iw - 1, v->getPaintHeight() - 1);
@@ -516,7 +542,11 @@
 }
 
 void
-TimeInstantLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *)
+TimeInstantLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *
+#ifdef DEBUG_TIME_INSTANT_LAYER
+                          e
+#endif
+    )
 {
 #ifdef DEBUG_TIME_INSTANT_LAYER
     cerr << "TimeInstantLayer::drawEnd(" << e->x() << ")" << endl;
@@ -623,7 +653,11 @@
 }
 
 void
-TimeInstantLayer::editEnd(LayerGeometryProvider *, QMouseEvent *)
+TimeInstantLayer::editEnd(LayerGeometryProvider *, QMouseEvent *
+#ifdef DEBUG_TIME_INSTANT_LAYER
+                          e
+#endif
+    )
 {
 #ifdef DEBUG_TIME_INSTANT_LAYER
     cerr << "TimeInstantLayer::editEnd(" << e->x() << ")" << endl;
--- a/layer/TimeValueLayer.cpp	Thu Nov 21 14:02:57 2019 +0000
+++ b/layer/TimeValueLayer.cpp	Thu Nov 21 14:03:19 2019 +0000
@@ -915,7 +915,8 @@
 
 //    Profiler profiler("TimeValueLayer::paint", true);
 
-    int x0 = rect.left(), x1 = rect.right();
+    int x0 = rect.left();
+    int x1 = x0 + rect.width();
     sv_frame_t frame0 = v->getFrameForX(x0);
     sv_frame_t frame1 = v->getFrameForX(x1);
     if (m_derivative) --frame0;