changeset 1494:78d9282519b0

Ensure rightCropFrame doesn't end up rounded to the left of the desired end pixel HG Enter commit message. Lines beginning with 'HG:' are removed.
author Chris Cannam
date Tue, 13 Aug 2019 14:35:29 +0100
parents c5589d94b731
children 6bb0afa607f5
files layer/Colour3DPlotRenderer.cpp
diffstat 1 files changed, 28 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Fri Aug 09 19:02:51 2019 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Tue Aug 13 14:35:29 2019 +0100
@@ -308,6 +308,7 @@
                     pr.x(), pr.y(), pr.width(), pr.height());
 
     if (!timeConstrained && (pr != rect)) {
+        QRect cva = m_cache.getValidArea();
         SVCERR << "WARNING: failed to render entire requested rect "
                << "even when not time-constrained: wanted "
                << rect.x() << "," << rect.y() << " "
@@ -315,6 +316,10 @@
                << pr.x() << "," << pr.y() << " "
                << pr.width() << "x" << pr.height()
                << ", after request of width " << (x1 - x0)
+               << endl
+               << "(cache valid area is "
+               << cva.x() << "," << cva.y() << " "
+               << cva.width() << "x" << cva.height() << ")"
                << endl;
     }
 
@@ -849,6 +854,9 @@
     for (int x = x0 + repaintWidth; ; ++x) {
         sv_frame_t f = v->getFrameForX(x);
         if ((f / binResolution) * binResolution == f) {
+            if (v->getXForFrame(f) < x0 + repaintWidth) {
+                continue;
+            }
             if (rightCropFrame == -1) rightCropFrame = f;
             else if (x > x0 + repaintWidth + 2) {
                 rightBoundaryFrame = f;
@@ -897,8 +905,10 @@
 
 #ifdef DEBUG_COLOUR_PLOT_REPAINT
     SVDEBUG << "scaling draw buffer from width " << m_drawBuffer.width()
-            << " to " << (scaledRight - scaledLeft) << " (nb drawBufferWidth = "
-            << drawBufferWidth << ")" << endl;
+            << " to " << (scaledRight - scaledLeft)
+            << " (nb drawBufferWidth = "
+            << drawBufferWidth << ", attainedWidth = "
+            << attainedWidth << ")" << endl;
 #endif
 
     QImage scaled = scaleDrawBufferImage
@@ -921,9 +931,24 @@
     if (sourceLeft < 0) {
         sourceLeft = 0;
     }
+
+#ifdef DEBUG_COLOUR_PLOT_REPAINT
+    SVDEBUG << "leftBoundaryFrame = " << leftBoundaryFrame
+            << ", leftCropFrame = " << leftCropFrame
+            << ", scaledLeft = " << scaledLeft
+            << ", scaledLeftCrop = " << scaledLeftCrop
+            << endl;
+    SVDEBUG << "rightBoundaryFrame = " << rightBoundaryFrame
+            << ", rightCropFrame = " << rightCropFrame
+            << ", scaledRight = " << scaledRight
+            << ", scaledRightCrop = " << scaledRightCrop
+            << endl;
+#endif
     
 #ifdef DEBUG_COLOUR_PLOT_REPAINT
-    SVDEBUG << "repaintWidth = " << repaintWidth
+    SVDEBUG << "x0 = " << x0
+            << ", repaintWidth = " << repaintWidth
+            << ", targetLeft = " << targetLeft 
             << ", targetWidth = " << targetWidth << endl;
 #endif