comparison layer/SpectrogramLayer.cpp @ 90:7d06e7cf5d5a

* adjustments to facilitate debugging on win32, and some minor fixes
author Chris Cannam
date Fri, 05 May 2006 14:10:12 +0000
parents 803830f186ef
children ed01c1261b55
comparison
equal deleted inserted replaced
89:803830f186ef 90:7d06e7cf5d5a
713 if (r < 0) r = 0; 713 if (r < 0) r = 0;
714 if (r > 256) r = 256; 714 if (r > 256) r = 256;
715 int distance = r - m_colourRotation; 715 int distance = r - m_colourRotation;
716 716
717 if (distance != 0) { 717 if (distance != 0) {
718 rotateCacheColourmap(-distance); 718 rotateColourmap(-distance);
719 m_colourRotation = r; 719 m_colourRotation = r;
720 } 720 }
721 721
722 m_mutex.unlock(); 722 m_mutex.unlock();
723 723
753 753
754 m_mutex.lock(); 754 m_mutex.lock();
755 m_pixmapCacheInvalid = true; 755 m_pixmapCacheInvalid = true;
756 756
757 m_colourScheme = scheme; 757 m_colourScheme = scheme;
758 setCacheColourmap(); 758 setColourmap();
759 759
760 m_mutex.unlock(); 760 m_mutex.unlock();
761 761
762 emit layerParametersChanged(); 762 emit layerParametersChanged();
763 } 763 }
940 } 940 }
941 } 941 }
942 } 942 }
943 943
944 void 944 void
945 SpectrogramLayer::setCacheColourmap() 945 SpectrogramLayer::setColourmap()
946 { 946 {
947 if (m_cacheInvalid || !m_cache) return;
948
949 int formerRotation = m_colourRotation; 947 int formerRotation = m_colourRotation;
950 948
951 if (m_colourScheme == BlackOnWhite) { 949 if (m_colourScheme == BlackOnWhite) {
952 m_colourMap.setColour(NO_VALUE, Qt::white); 950 m_colourMap.setColour(NO_VALUE, Qt::white);
953 } else { 951 } else {
1013 1011
1014 m_colourMap.setColour(pixel, colour); 1012 m_colourMap.setColour(pixel, colour);
1015 } 1013 }
1016 1014
1017 m_colourRotation = 0; 1015 m_colourRotation = 0;
1018 rotateCacheColourmap(m_colourRotation - formerRotation); 1016 rotateColourmap(m_colourRotation - formerRotation);
1019 m_colourRotation = formerRotation; 1017 m_colourRotation = formerRotation;
1020 } 1018 }
1021 1019
1022 void 1020 void
1023 SpectrogramLayer::rotateCacheColourmap(int distance) 1021 SpectrogramLayer::rotateColourmap(int distance)
1024 { 1022 {
1025 if (!m_cache) return; 1023 if (!m_cache) return;
1026 1024
1027 QColor newPixels[256]; 1025 QColor newPixels[256];
1028 1026
1309 if (m_layer.m_cache) delete m_layer.m_cache; 1307 if (m_layer.m_cache) delete m_layer.m_cache;
1310 m_layer.m_cache = new FFTFileCache 1308 m_layer.m_cache = new FFTFileCache
1311 (QString("%1").arg(getObjectExportId(&m_layer)), 1309 (QString("%1").arg(getObjectExportId(&m_layer)),
1312 MatrixFile::ReadOnly); 1310 MatrixFile::ReadOnly);
1313 1311
1314 m_layer.setCacheColourmap(); 1312 m_layer.setColourmap();
1315 //!!! m_layer.m_writeCache->reset(); 1313 //!!! m_layer.m_writeCache->reset();
1316 1314
1317 // We don't need a lock when writing to or reading from 1315 // We don't need a lock when writing to or reading from
1318 // the pixels in the cache. We do need to ensure we have 1316 // the pixels in the cache. We do need to ensure we have
1319 // the width and height of the cache and the FFT 1317 // the width and height of the cache and the FFT