diff layer/Colour3DPlotRenderer.cpp @ 1116:e7a07cd63d21 spectrogram-minor-refactor

Wire up invertVertical
author Chris Cannam
date Tue, 19 Jul 2016 15:08:22 +0100
parents ee8e73dc5c8b
children 64709d4d09ef
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Tue Jul 19 15:02:44 2016 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Tue Jul 19 15:08:22 2016 +0100
@@ -365,6 +365,12 @@
 
             int ry0 = m_sources.verticalBinLayer->getIYForBin(v, sy);
             int ry1 = m_sources.verticalBinLayer->getIYForBin(v, sy + 1);
+
+            if (m_params.invertVertical) {
+                ry0 = h - ry0 - 1;
+                ry1 = h - ry1 - 1;
+            }
+                    
             QRect r(rx0, ry1, rw, ry0 - ry1);
 
             float value = preparedColumn[sy - minbin];
@@ -769,9 +775,15 @@
 
         if (!pixelPeakColumn.empty()) {
             for (int y = 0; y < h; ++y) {
+                int py;
+                if (m_params.invertVertical) {
+                    py = y;
+                } else {
+                    py = h - y - 1;
+                }
                 m_drawBuffer.setPixel
                     (x,
-                     h-y-1,
+                     py,
                      m_params.colourScale.getPixel(pixelPeakColumn[y]));
             }
         }