comparison layer/Colour3DPlotRenderer.cpp @ 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 886c1cd48f9d
children e4c9d38d304d
comparison
equal deleted inserted replaced
1493:c5589d94b731 1494:78d9282519b0
306 QRect pr = rect & m_cache.getValidArea(); 306 QRect pr = rect & m_cache.getValidArea();
307 paint.drawImage(pr.x(), pr.y(), m_cache.getImage(), 307 paint.drawImage(pr.x(), pr.y(), m_cache.getImage(),
308 pr.x(), pr.y(), pr.width(), pr.height()); 308 pr.x(), pr.y(), pr.width(), pr.height());
309 309
310 if (!timeConstrained && (pr != rect)) { 310 if (!timeConstrained && (pr != rect)) {
311 QRect cva = m_cache.getValidArea();
311 SVCERR << "WARNING: failed to render entire requested rect " 312 SVCERR << "WARNING: failed to render entire requested rect "
312 << "even when not time-constrained: wanted " 313 << "even when not time-constrained: wanted "
313 << rect.x() << "," << rect.y() << " " 314 << rect.x() << "," << rect.y() << " "
314 << rect.width() << "x" << rect.height() << ", got " 315 << rect.width() << "x" << rect.height() << ", got "
315 << pr.x() << "," << pr.y() << " " 316 << pr.x() << "," << pr.y() << " "
316 << pr.width() << "x" << pr.height() 317 << pr.width() << "x" << pr.height()
317 << ", after request of width " << (x1 - x0) 318 << ", after request of width " << (x1 - x0)
319 << endl
320 << "(cache valid area is "
321 << cva.x() << "," << cva.y() << " "
322 << cva.width() << "x" << cva.height() << ")"
318 << endl; 323 << endl;
319 } 324 }
320 325
321 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0); 326 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0);
322 327
847 } 852 }
848 853
849 for (int x = x0 + repaintWidth; ; ++x) { 854 for (int x = x0 + repaintWidth; ; ++x) {
850 sv_frame_t f = v->getFrameForX(x); 855 sv_frame_t f = v->getFrameForX(x);
851 if ((f / binResolution) * binResolution == f) { 856 if ((f / binResolution) * binResolution == f) {
857 if (v->getXForFrame(f) < x0 + repaintWidth) {
858 continue;
859 }
852 if (rightCropFrame == -1) rightCropFrame = f; 860 if (rightCropFrame == -1) rightCropFrame = f;
853 else if (x > x0 + repaintWidth + 2) { 861 else if (x > x0 + repaintWidth + 2) {
854 rightBoundaryFrame = f; 862 rightBoundaryFrame = f;
855 break; 863 break;
856 } 864 }
895 int scaledLeft = v->getXForFrame(leftBoundaryFrame); 903 int scaledLeft = v->getXForFrame(leftBoundaryFrame);
896 int scaledRight = v->getXForFrame(rightBoundaryFrame); 904 int scaledRight = v->getXForFrame(rightBoundaryFrame);
897 905
898 #ifdef DEBUG_COLOUR_PLOT_REPAINT 906 #ifdef DEBUG_COLOUR_PLOT_REPAINT
899 SVDEBUG << "scaling draw buffer from width " << m_drawBuffer.width() 907 SVDEBUG << "scaling draw buffer from width " << m_drawBuffer.width()
900 << " to " << (scaledRight - scaledLeft) << " (nb drawBufferWidth = " 908 << " to " << (scaledRight - scaledLeft)
901 << drawBufferWidth << ")" << endl; 909 << " (nb drawBufferWidth = "
910 << drawBufferWidth << ", attainedWidth = "
911 << attainedWidth << ")" << endl;
902 #endif 912 #endif
903 913
904 QImage scaled = scaleDrawBufferImage 914 QImage scaled = scaleDrawBufferImage
905 (m_drawBuffer, scaledRight - scaledLeft, h); 915 (m_drawBuffer, scaledRight - scaledLeft, h);
906 916
919 929
920 int sourceLeft = targetLeft - scaledLeft; 930 int sourceLeft = targetLeft - scaledLeft;
921 if (sourceLeft < 0) { 931 if (sourceLeft < 0) {
922 sourceLeft = 0; 932 sourceLeft = 0;
923 } 933 }
924 934
925 #ifdef DEBUG_COLOUR_PLOT_REPAINT 935 #ifdef DEBUG_COLOUR_PLOT_REPAINT
926 SVDEBUG << "repaintWidth = " << repaintWidth 936 SVDEBUG << "leftBoundaryFrame = " << leftBoundaryFrame
937 << ", leftCropFrame = " << leftCropFrame
938 << ", scaledLeft = " << scaledLeft
939 << ", scaledLeftCrop = " << scaledLeftCrop
940 << endl;
941 SVDEBUG << "rightBoundaryFrame = " << rightBoundaryFrame
942 << ", rightCropFrame = " << rightCropFrame
943 << ", scaledRight = " << scaledRight
944 << ", scaledRightCrop = " << scaledRightCrop
945 << endl;
946 #endif
947
948 #ifdef DEBUG_COLOUR_PLOT_REPAINT
949 SVDEBUG << "x0 = " << x0
950 << ", repaintWidth = " << repaintWidth
951 << ", targetLeft = " << targetLeft
927 << ", targetWidth = " << targetWidth << endl; 952 << ", targetWidth = " << targetWidth << endl;
928 #endif 953 #endif
929 954
930 if (targetWidth > 0) { 955 if (targetWidth > 0) {
931 // we are copying from an image that has already been scaled, 956 // we are copying from an image that has already been scaled,