comparison 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
comparison
equal deleted inserted replaced
1329:344f29e46258 1330:c1f719094c25
762 sv_frame_t rightBoundaryFrame = -1, rightCropFrame = -1; 762 sv_frame_t rightBoundaryFrame = -1, rightCropFrame = -1;
763 763
764 int drawBufferWidth; 764 int drawBufferWidth;
765 int binResolution = model->getResolution(); 765 int binResolution = model->getResolution();
766 766
767 int limitOverrun = 100; // overrun from edge before we decide this 767 // These loops should eventually terminate provided that
768 // isn't going to work out 768 // getFrameForX always returns a multiple of the zoom level,
769 int leftLimit = -limitOverrun; 769 // i.e. there is some x for which getFrameForX(x) == 0 and
770 int rightLimit = v->getPaintWidth() + limitOverrun; 770 // subsequent return values are equally spaced
771 771
772 for (int x = x0; x > leftLimit; --x) { 772 for (int x = x0; ; --x) {
773 sv_frame_t f = v->getFrameForX(x); 773 sv_frame_t f = v->getFrameForX(x);
774 if ((f / binResolution) * binResolution == f || x-1 == leftLimit) { 774 if ((f / binResolution) * binResolution == f) {
775 if (leftCropFrame == -1) leftCropFrame = f; 775 if (leftCropFrame == -1) leftCropFrame = f;
776 else if (x < x0 - 2) { 776 else if (x < x0 - 2) {
777 leftBoundaryFrame = f; 777 leftBoundaryFrame = f;
778 break; 778 break;
779 } 779 }
780 } 780 }
781 } 781 }
782 782
783 for (int x = x0 + repaintWidth; x < rightLimit; ++x) { 783 for (int x = x0 + repaintWidth; ; ++x) {
784 sv_frame_t f = v->getFrameForX(x); 784 sv_frame_t f = v->getFrameForX(x);
785 if ((f / binResolution) * binResolution == f || x+1 == rightLimit) { 785 if ((f / binResolution) * binResolution == f) {
786 if (rightCropFrame == -1) rightCropFrame = f; 786 if (rightCropFrame == -1) rightCropFrame = f;
787 else if (x > x0 + repaintWidth + 2) { 787 else if (x > x0 + repaintWidth + 2) {
788 rightBoundaryFrame = f; 788 rightBoundaryFrame = f;
789 break; 789 break;
790 } 790 }
791 } 791 }
792 } 792 }
793 793
794 if (leftBoundaryFrame == -1 || rightBoundaryFrame == -1) {
795 SVCERR << "WARNING: failed to set left or right boundary frame (values are " << leftBoundaryFrame << " and " << rightBoundaryFrame << " respectively)" << endl;
796 return;
797 }
798
799 drawBufferWidth = int 794 drawBufferWidth = int
800 ((rightBoundaryFrame - leftBoundaryFrame) / binResolution); 795 ((rightBoundaryFrame - leftBoundaryFrame) / binResolution);
801 796
802 int h = v->getPaintHeight(); 797 int h = v->getPaintHeight();
803 798