Mercurial > hg > svgui
diff layer/Colour3DPlotRenderer.cpp @ 1330:c1f719094c25 zoom
Ensure getFrameForX returns value on zoom blocksize boundary; take advantage of that (this is essentially reverting to the same behaviour as in the default branch, which we should probably have done all along)
author | Chris Cannam |
---|---|
date | Fri, 21 Sep 2018 11:50:05 +0100 |
parents | 344f29e46258 |
children | d79e21855aef |
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp Thu Sep 20 15:42:12 2018 +0100 +++ b/layer/Colour3DPlotRenderer.cpp Fri Sep 21 11:50:05 2018 +0100 @@ -764,14 +764,14 @@ int drawBufferWidth; int binResolution = model->getResolution(); - int limitOverrun = 100; // overrun from edge before we decide this - // isn't going to work out - int leftLimit = -limitOverrun; - int rightLimit = v->getPaintWidth() + limitOverrun; + // These loops should eventually terminate provided that + // getFrameForX always returns a multiple of the zoom level, + // i.e. there is some x for which getFrameForX(x) == 0 and + // subsequent return values are equally spaced - for (int x = x0; x > leftLimit; --x) { + for (int x = x0; ; --x) { sv_frame_t f = v->getFrameForX(x); - if ((f / binResolution) * binResolution == f || x-1 == leftLimit) { + if ((f / binResolution) * binResolution == f) { if (leftCropFrame == -1) leftCropFrame = f; else if (x < x0 - 2) { leftBoundaryFrame = f; @@ -780,9 +780,9 @@ } } - for (int x = x0 + repaintWidth; x < rightLimit; ++x) { + for (int x = x0 + repaintWidth; ; ++x) { sv_frame_t f = v->getFrameForX(x); - if ((f / binResolution) * binResolution == f || x+1 == rightLimit) { + if ((f / binResolution) * binResolution == f) { if (rightCropFrame == -1) rightCropFrame = f; else if (x > x0 + repaintWidth + 2) { rightBoundaryFrame = f; @@ -791,11 +791,6 @@ } } - 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);