comparison 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
comparison
equal deleted inserted replaced
1052:834e94eb1bca 1053:38a53c7b81f6
847 QString maxstr = QString("%1").arg(max); 847 QString maxstr = QString("%1").arg(max);
848 848
849 paint.save(); 849 paint.save();
850 850
851 QFont font = paint.font(); 851 QFont font = paint.font();
852 font.setPixelSize(int(font.pixelSize() * 0.65)); 852 if (font.pixelSize() > 0) {
853 paint.setFont(font); 853 int newSize = int(font.pixelSize() * 0.65);
854 if (newSize < 6) newSize = 6;
855 font.setPixelSize(newSize);
856 paint.setFont(font);
857 }
854 858
855 int msw = paint.fontMetrics().width(maxstr); 859 int msw = paint.fontMetrics().width(maxstr);
856 860
857 QMatrix m; 861 QMatrix m;
858 m.translate(cw - 6, ch + 10); 862 m.translate(cw - 6, ch + 10);
1293 10, QColor(120, 120, 120)); 1297 10, QColor(120, 120, 120));
1294 } 1298 }
1295 return; 1299 return;
1296 } 1300 }
1297 1301
1302 if (m_model->getWidth() == 0) {
1303 #ifdef DEBUG_COLOUR_3D_PLOT_LAYER_PAINT
1304 cerr << "Colour3DPlotLayer::paint(): model width == 0, "
1305 << "nothing to paint (yet)" << endl;
1306 #endif
1307 return;
1308 }
1309
1298 if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->getPaintRect(); 1310 if (m_normalizeVisibleArea && !m_normalizeColumns) rect = v->getPaintRect();
1299 1311
1300 sv_frame_t modelStart = m_model->getStartFrame(); 1312 sv_frame_t modelStart = m_model->getStartFrame();
1301 sv_frame_t modelEnd = m_model->getEndFrame(); 1313 sv_frame_t modelEnd = m_model->getEndFrame();
1302 int modelResolution = m_model->getResolution(); 1314 int modelResolution = m_model->getResolution();