# HG changeset patch # User Chris Cannam # Date 1570617213 -3600 # Node ID 14a162f6870fa33228fff4b033cc9aa65a6d53d9 # Parent 084c591622c5c7492db29baa81508ebd73e9308c Further light streamlining diff -r 084c591622c5 -r 14a162f6870f layer/Colour3DPlotRenderer.cpp --- 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; } }