diff layer/Colour3DPlotLayer.cpp @ 12:484e7320f59f

* Add more icons and rationalise menu options to the usual set (on the File menu) * Fixes to import/export of dense 3-D data sets and imported models
author Chris Cannam
date Thu, 19 Jan 2006 17:59:11 +0000
parents 37b110168acf
children 1deb5f87a18c
line wrap: on
line diff
--- a/layer/Colour3DPlotLayer.cpp	Thu Jan 19 12:54:38 2006 +0000
+++ b/layer/Colour3DPlotLayer.cpp	Thu Jan 19 17:59:11 2006 +0000
@@ -99,11 +99,20 @@
     size_t modelEnd = m_model->getEndFrame();
     size_t modelWindow = m_model->getWindowSize();
 
+    size_t cacheWidth = (modelEnd - modelStart) / modelWindow + 1;
+    size_t cacheHeight = m_model->getYBinCount();
+
+    if (m_cache &&
+	(m_cache->width() != cacheWidth ||
+	 m_cache->height() != cacheHeight)) {
+
+	delete m_cache;
+	m_cache = 0;
+    }
+
     if (!m_cache) {
 
-	m_cache = new QImage((modelEnd - modelStart) / modelWindow + 1,
-			     m_model->getYBinCount(),
-			     QImage::Format_Indexed8);
+	m_cache = new QImage(cacheWidth, cacheHeight, QImage::Format_Indexed8);
 
 	m_cache->setNumColors(256);
 	DenseThreeDimensionalModel::BinValueSet values;