Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 10:8f5b812baaee
* Hook up SV file i/o. You can now save and load sessions.
Some problems -- gain is not reloaded correctly for waveforms,
reloaded panes are not properly reconnected to the panner, and
no doubt plenty of others.
author | Chris Cannam |
---|---|
date | Tue, 17 Jan 2006 17:45:55 +0000 |
parents | 561be41ad083 |
children | 2d5005f2b3d9 |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Mon Jan 16 18:04:09 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Tue Jan 17 17:45:55 2006 +0000 @@ -142,6 +142,10 @@ { int deft = 0; + int throwaway; + if (!min) min = &throwaway; + if (!max) max = &throwaway; + if (name == tr("Gain")) { *min = -50; @@ -552,18 +556,9 @@ // don't need to invalidate main cache here m_pixmapCacheInvalid = true; - int formerColourRotation = m_colourRotation; - m_colourScheme = scheme; setCacheColourmap(); - int distance = formerColourRotation - m_colourRotation; - - if (distance != 0) { - rotateCacheColourmap(-distance); - m_colourRotation = formerColourRotation; - } - m_mutex.unlock(); emit layerParametersChanged(); @@ -685,6 +680,8 @@ { if (m_cacheInvalid || !m_cache) return; + int formerRotation = m_colourRotation; + m_cache->setNumColors(256); m_cache->setColor(0, qRgb(255, 255, 255)); @@ -735,11 +732,15 @@ } m_colourRotation = 0; + rotateCacheColourmap(m_colourRotation - formerRotation); + m_colourRotation = formerRotation; } void SpectrogramLayer::rotateCacheColourmap(int distance) { + if (!m_cache) return; + QRgb newPixels[256]; newPixels[0] = m_cache->color(0); @@ -914,7 +915,7 @@ MUNLOCK((void *)m_layer.m_cache, width * height); m_layer.setCacheColourmap(); - + m_layer.m_cache->fill(0); m_layer.m_mutex.unlock(); @@ -1441,13 +1442,13 @@ } if (divisor > 0.0) { - +/* int pixel = int(total / divisor); if (pixel > 255) pixel = 255; if (pixel < 1) pixel = 1; assert(x <= scaled.width()); scaled.setPixel(x, y, m_cache->color(pixel)); -/* +*/ float pixel = total / divisor; float lq = pixel - int(pixel); float hq = int(pixel) + 1 - pixel; @@ -1459,7 +1460,7 @@ qGreen(low) * lq + qGreen(high) * hq + 0.01, qBlue(low) * lq + qBlue(high) * hq + 0.01); scaled.setPixel(x, y, mixed); -*/ + } else { assert(x <= scaled.width()); scaled.setPixel(x, y, qRgb(0, 0, 0));