Mercurial > hg > svgui
comparison layer/SpectrogramLayer.cpp @ 161:dc2fe023a14f
* Improve output from Profiler class and make it incur less (no) overhead in
release builds with NO_TIMING defined
* Fix a lock contention issue in spectrogram
* Marginal optimisations elsewhere
author | Chris Cannam |
---|---|
date | Tue, 10 Oct 2006 14:51:17 +0000 |
parents | f4be20ebdfa4 |
children | f32212631b9c |
comparison
equal
deleted
inserted
replaced
160:f4be20ebdfa4 | 161:dc2fe023a14f |
---|---|
32 #include <iostream> | 32 #include <iostream> |
33 | 33 |
34 #include <cassert> | 34 #include <cassert> |
35 #include <cmath> | 35 #include <cmath> |
36 | 36 |
37 //#define DEBUG_SPECTROGRAM_REPAINT 1 | 37 #define DEBUG_SPECTROGRAM_REPAINT 1 |
38 | 38 |
39 SpectrogramLayer::SpectrogramLayer(Configuration config) : | 39 SpectrogramLayer::SpectrogramLayer(Configuration config) : |
40 Layer(), | 40 Layer(), |
41 m_model(0), | 41 m_model(0), |
42 m_channel(0), | 42 m_channel(0), |
1652 v->setLightBackground(true); | 1652 v->setLightBackground(true); |
1653 } else { | 1653 } else { |
1654 v->setLightBackground(false); | 1654 v->setLightBackground(false); |
1655 } | 1655 } |
1656 | 1656 |
1657 // Profiler profiler("SpectrogramLayer::paint", true); | 1657 Profiler profiler("SpectrogramLayer::paint", true); |
1658 #ifdef DEBUG_SPECTROGRAM_REPAINT | 1658 #ifdef DEBUG_SPECTROGRAM_REPAINT |
1659 std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << std::endl; | 1659 std::cerr << "SpectrogramLayer::paint(): m_model is " << m_model << ", zoom level is " << v->getZoomLevel() << ", m_updateTimer " << m_updateTimer << std::endl; |
1660 | 1660 |
1661 std::cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << std::endl; | 1661 std::cerr << "rect is " << rect.x() << "," << rect.y() << " " << rect.width() << "x" << rect.height() << std::endl; |
1662 #endif | 1662 #endif |
2094 std::cerr << "Overall mag is now [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "] - will be updating" << std::endl; | 2094 std::cerr << "Overall mag is now [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "] - will be updating" << std::endl; |
2095 } else { | 2095 } else { |
2096 std::cerr << "Overall mag unchanged at [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << std::endl; | 2096 std::cerr << "Overall mag unchanged at [" << m_viewMags[v].getMin() << "->" << m_viewMags[v].getMax() << "]" << std::endl; |
2097 } | 2097 } |
2098 | 2098 |
2099 // Profiler profiler2("SpectrogramLayer::paint: draw image", true); | 2099 Profiler profiler2("SpectrogramLayer::paint: draw image", true); |
2100 | 2100 |
2101 paint.drawImage(x0, y0, m_drawBuffer, 0, 0, w, h); | 2101 paint.drawImage(x0, y0, m_drawBuffer, 0, 0, w, h); |
2102 | 2102 |
2103 if (recreateWholePixmapCache) { | 2103 if (recreateWholePixmapCache) { |
2104 cache.pixmap = QPixmap(v->width(), v->height()); | 2104 cache.pixmap = QPixmap(v->width(), v->height()); |
2518 { | 2518 { |
2519 if (!m_model || !m_model->isOK()) { | 2519 if (!m_model || !m_model->isOK()) { |
2520 return; | 2520 return; |
2521 } | 2521 } |
2522 | 2522 |
2523 // Profiler profiler("SpectrogramLayer::paintVerticalScale", true); | 2523 Profiler profiler("SpectrogramLayer::paintVerticalScale", true); |
2524 | 2524 |
2525 //!!! cache this? | 2525 //!!! cache this? |
2526 | 2526 |
2527 int h = rect.height(), w = rect.width(); | 2527 int h = rect.height(), w = rect.width(); |
2528 | 2528 |