changeset 1532:14a162f6870f

Further light streamlining
author Chris Cannam
date Wed, 09 Oct 2019 11:33:33 +0100
parents 084c591622c5
children 37df1530519d
files layer/Colour3DPlotRenderer.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Wed Oct 09 11:17:26 2019 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Wed Oct 09 11:33:33 2019 +0100
@@ -791,13 +791,21 @@
 
         // The source image is 8-bit indexed
         const uchar *sourceLine = image.constScanLine(sy);
+
+        int psx = -1;
+        QRgb colour = {};
         
         for (int x = 0; x < targetWidth; ++x) {
 
             int sx = int((uint64_t(x) * sourceWidth) / targetWidth);
             if (sx == sourceWidth) --sx;
 
-            targetLine[x] = image.color(sourceLine[sx]);
+            if (sx > psx) {
+                colour = image.color(sourceLine[sx]);
+            }
+            
+            targetLine[x] = colour;
+            psx = sx;
         }
     }