diff layer/SliceLayer.cpp @ 1387:bca9870301b7 spectrogramparam

Small speedups
author Chris Cannam
date Mon, 12 Nov 2018 14:48:42 +0000
parents fc3d89f88690
children 1eb560b363e7
line wrap: on
line diff
--- a/layer/SliceLayer.cpp	Mon Nov 12 11:34:34 2018 +0000
+++ b/layer/SliceLayer.cpp	Mon Nov 12 14:48:42 2018 +0000
@@ -402,11 +402,19 @@
         }
     }
 
+    int mh = m_sliceableModel->getHeight();
+    
     if (m_plotStyle == PlotBlocks) {
         // Must use actual zero-width pen, too slow otherwise
         paint.setPen(QPen(getBaseQColor(), 0));
     } else {
-        paint.setPen(PaintAssistant::scalePen(getBaseQColor()));
+        // Similarly, if there are very many bins here, let's drop to
+        // a precise 1-pixel-width pen
+        if (mh > 10000) {
+            paint.setPen(QPen(getBaseQColor(), 1));
+        } else {
+            paint.setPen(PaintAssistant::scalePen(getBaseQColor()));
+        }
     }
 
     int xorigin = getVerticalScaleWidth(v, true, paint) + 1;
@@ -423,7 +431,6 @@
 
     QPainterPath path;
 
-    int mh = m_sliceableModel->getHeight();
     int bin0 = 0;
 
     if (m_maxbin > m_minbin) {