Mercurial > hg > svgui
comparison layer/Colour3DPlotRenderer.cpp @ 1532:14a162f6870f
Further light streamlining
author | Chris Cannam |
---|---|
date | Wed, 09 Oct 2019 11:33:33 +0100 |
parents | 084c591622c5 |
children | bfd8b22fd67c |
comparison
equal
deleted
inserted
replaced
1531:084c591622c5 | 1532:14a162f6870f |
---|---|
789 int sy = int((uint64_t(y) * sourceHeight) / targetHeight); | 789 int sy = int((uint64_t(y) * sourceHeight) / targetHeight); |
790 if (sy == sourceHeight) --sy; | 790 if (sy == sourceHeight) --sy; |
791 | 791 |
792 // The source image is 8-bit indexed | 792 // The source image is 8-bit indexed |
793 const uchar *sourceLine = image.constScanLine(sy); | 793 const uchar *sourceLine = image.constScanLine(sy); |
794 | |
795 int psx = -1; | |
796 QRgb colour = {}; | |
794 | 797 |
795 for (int x = 0; x < targetWidth; ++x) { | 798 for (int x = 0; x < targetWidth; ++x) { |
796 | 799 |
797 int sx = int((uint64_t(x) * sourceWidth) / targetWidth); | 800 int sx = int((uint64_t(x) * sourceWidth) / targetWidth); |
798 if (sx == sourceWidth) --sx; | 801 if (sx == sourceWidth) --sx; |
799 | 802 |
800 targetLine[x] = image.color(sourceLine[sx]); | 803 if (sx > psx) { |
804 colour = image.color(sourceLine[sx]); | |
805 } | |
806 | |
807 targetLine[x] = colour; | |
808 psx = sx; | |
801 } | 809 } |
802 } | 810 } |
803 | 811 |
804 return target; | 812 return target; |
805 } | 813 } |