comparison 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
comparison
equal deleted inserted replaced
1328:b39cd8fb309f 1329:344f29e46258
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 for (int x = x0; ; --x) { 767 int limitOverrun = 100; // overrun from edge before we decide this
768 // isn't going to work out
769 int leftLimit = -limitOverrun;
770 int rightLimit = v->getPaintWidth() + limitOverrun;
771
772 for (int x = x0; x > leftLimit; --x) {
768 sv_frame_t f = v->getFrameForX(x); 773 sv_frame_t f = v->getFrameForX(x);
769 if ((f / binResolution) * binResolution == f) { 774 if ((f / binResolution) * binResolution == f || x-1 == leftLimit) {
770 if (leftCropFrame == -1) leftCropFrame = f; 775 if (leftCropFrame == -1) leftCropFrame = f;
771 else if (x < x0 - 2) { 776 else if (x < x0 - 2) {
772 leftBoundaryFrame = f; 777 leftBoundaryFrame = f;
773 break; 778 break;
774 } 779 }
775 } 780 }
776 } 781 }
777 for (int x = x0 + repaintWidth; ; ++x) { 782
783 for (int x = x0 + repaintWidth; x < rightLimit; ++x) {
778 sv_frame_t f = v->getFrameForX(x); 784 sv_frame_t f = v->getFrameForX(x);
779 if ((f / binResolution) * binResolution == f) { 785 if ((f / binResolution) * binResolution == f || x+1 == rightLimit) {
780 if (rightCropFrame == -1) rightCropFrame = f; 786 if (rightCropFrame == -1) rightCropFrame = f;
781 else if (x > x0 + repaintWidth + 2) { 787 else if (x > x0 + repaintWidth + 2) {
782 rightBoundaryFrame = f; 788 rightBoundaryFrame = f;
783 break; 789 break;
784 } 790 }
785 } 791 }
786 } 792 }
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
787 drawBufferWidth = int 799 drawBufferWidth = int
788 ((rightBoundaryFrame - leftBoundaryFrame) / binResolution); 800 ((rightBoundaryFrame - leftBoundaryFrame) / binResolution);
789 801
790 int h = v->getPaintHeight(); 802 int h = v->getPaintHeight();
791 803