changeset 1233:1a7c2ca31579

Scale pen, place line ends in centres of bins, default to line mode
author Chris Cannam
date Thu, 26 Jan 2017 21:19:49 +0000
parents de1792daae07
children 81dfe06a45c9
files layer/SliceLayer.cpp
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/layer/SliceLayer.cpp	Thu Jan 26 21:18:55 2017 +0000
+++ b/layer/SliceLayer.cpp	Thu Jan 26 21:19:49 2017 +0000
@@ -34,7 +34,7 @@
     m_colourMap(0),
     m_energyScale(dBScale),
     m_samplingMode(SampleMean),
-    m_plotStyle(PlotSteps),
+    m_plotStyle(PlotLines),
     m_binScale(LinearBins),
     m_normalize(false),
     m_threshold(0.0),
@@ -331,7 +331,12 @@
         }
     }
 
-    paint.setPen(getBaseQColor());
+    if (m_plotStyle == PlotBlocks) {
+        // Must use actual zero-width pen, too slow otherwise
+        paint.setPen(QPen(getBaseQColor(), 0));
+    } else {
+        paint.setPen(PaintAssistant::scalePen(getBaseQColor()));
+    }
 
     int xorigin = getVerticalScaleWidth(v, true, paint) + 1;
     int w = v->getPaintWidth() - xorigin - 1;
@@ -423,9 +428,9 @@
         if (m_plotStyle == PlotLines) {
 
             if (bin == 0) {
-                path.moveTo(x, y);
+                path.moveTo((x + nx) / 2, y);
             } else {
-                path.lineTo(x, y);
+                path.lineTo((x + nx) / 2, y);
             }
 
         } else if (m_plotStyle == PlotSteps) {