diff layer/Colour3DPlotLayer.cpp @ 1053:38a53c7b81f6 3.0-integration

Don't paint if model has zero width
author Chris Cannam
date Thu, 26 May 2016 11:21:55 +0100
parents 40480e4bab6a
children 5144d7185fb5
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Thu Apr 21 15:06:05 2016 +0100
+++ b/layer/Colour3DPlotLayer.cpp	Thu May 26 11:21:55 2016 +0100
@@ -849,8 +849,12 @@
         paint.save();
 
         QFont font = paint.font();
-        font.setPixelSize(int(font.pixelSize() * 0.65));
-        paint.setFont(font);
+        if (font.pixelSize() > 0) {
+            int newSize = int(font.pixelSize() * 0.65);
+            if (newSize < 6) newSize = 6;
+            font.setPixelSize(newSize);
+            paint.setFont(font);
+        }
 
         int msw = paint.fontMetrics().width(maxstr);
 
@@ -1295,6 +1299,14 @@
 	return;
     }
 
+    if (m_model->getWidth() == 0) {
+#ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
+        cerr << "Colour3DPlotLayer::paint(): model width == 0, "
+             << "nothing to paint (yet)" << endl;
+#endif
+        return;
+    }
+    
     if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->getPaintRect();
 
     sv_frame_t modelStart = m_model->getStartFrame();