Mercurial > hg > svgui
diff layer/Colour3DPlotRenderer.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 | bc2cb82050a0 |
children | c1f719094c25 |
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp Thu Sep 20 13:14:15 2018 +0100 +++ b/layer/Colour3DPlotRenderer.cpp Thu Sep 20 15:42:12 2018 +0100 @@ -764,9 +764,14 @@ int drawBufferWidth; int binResolution = model->getResolution(); - for (int x = x0; ; --x) { + int limitOverrun = 100; // overrun from edge before we decide this + // isn't going to work out + int leftLimit = -limitOverrun; + int rightLimit = v->getPaintWidth() + limitOverrun; + + for (int x = x0; x > leftLimit; --x) { sv_frame_t f = v->getFrameForX(x); - if ((f / binResolution) * binResolution == f) { + if ((f / binResolution) * binResolution == f || x-1 == leftLimit) { if (leftCropFrame == -1) leftCropFrame = f; else if (x < x0 - 2) { leftBoundaryFrame = f; @@ -774,9 +779,10 @@ } } } - for (int x = x0 + repaintWidth; ; ++x) { + + for (int x = x0 + repaintWidth; x < rightLimit; ++x) { sv_frame_t f = v->getFrameForX(x); - if ((f / binResolution) * binResolution == f) { + if ((f / binResolution) * binResolution == f || x+1 == rightLimit) { if (rightCropFrame == -1) rightCropFrame = f; else if (x > x0 + repaintWidth + 2) { rightBoundaryFrame = f; @@ -784,6 +790,12 @@ } } } + + if (leftBoundaryFrame == -1 || rightBoundaryFrame == -1) { + SVCERR << "WARNING: failed to set left or right boundary frame (values are " << leftBoundaryFrame << " and " << rightBoundaryFrame << " respectively)" << endl; + return; + } + drawBufferWidth = int ((rightBoundaryFrame - leftBoundaryFrame) / binResolution);