Mercurial > hg > svgui
diff layer/SingleColourLayer.cpp @ 367:06360ed99cd1
* Further fixes to the handling of playback frame and buffered frame counts
author | Chris Cannam |
---|---|
date | Mon, 11 Feb 2008 12:46:39 +0000 |
parents | a55affd7ab6c |
children | e1a9e478b7f2 |
line wrap: on
line diff
--- a/layer/SingleColourLayer.cpp Mon Feb 11 11:06:17 2008 +0000 +++ b/layer/SingleColourLayer.cpp Mon Feb 11 12:46:39 2008 +0000 @@ -22,6 +22,8 @@ #include <QTextStream> #include <QApplication> +//#define DEBUG_COLOUR_SELECTION 1 + SingleColourLayer::ColourRefCount SingleColourLayer::m_colourRefCount; @@ -126,10 +128,14 @@ void SingleColourLayer::setDefaultColourFor(View *v) { +#ifdef DEBUG_COLOUR_SELECTION std::cerr << "SingleColourLayer::setDefaultColourFor: m_colourExplicitlySet = " << m_colourExplicitlySet << ", m_defaultColourSet " << m_defaultColourSet << std::endl; +#endif if (m_colourExplicitlySet || m_defaultColourSet) return; + if (v) m_defaultColourSet = true; // v==0 case doesn't really count + bool dark = false; if (v) { dark = !v->hasLightBackground(); @@ -151,14 +157,17 @@ // means we're being called from the constructor, and this is // a virtual function hint = getDefaultColourHint(dark, impose); -// std::cerr << "hint = " << hint << ", impose = " << impose << std::endl; +#ifdef DEBUG_COLOUR_SELECTION + std::cerr << "hint = " << hint << ", impose = " << impose << std::endl; +#endif } else { -// std::cerr << "(from ctor)" << std::endl; +#ifdef DEBUG_COLOUR_SELECTION + std::cerr << "(from ctor)" << std::endl; +#endif } if (hint >= 0 && impose) { setBaseColour(hint); - m_defaultColourSet = true; return; } @@ -175,15 +184,21 @@ count = m_colourRefCount[index]; } -// std::cerr << "index = " << index << ", count = " << count; +#ifdef DEBUG_COLOUR_SELECTION + std::cerr << "index = " << index << ", count = " << count; +#endif if (bestColour < 0 || count < bestCount) { bestColour = index; bestCount = count; -// std::cerr << " *"; +#ifdef DEBUG_COLOUR_SELECTION + std::cerr << " *"; +#endif } -// std::cerr << std::endl; +#ifdef DEBUG_COLOUR_SELECTION + std::cerr << std::endl; +#endif } if (bestColour < 0) m_colour = 0; @@ -194,8 +209,6 @@ } else { m_colourRefCount[m_colour]++; } - - m_defaultColourSet = true; } void @@ -295,7 +308,9 @@ if (m_colour != colour) { +#ifdef DEBUG_COLOUR_SELECTION std::cerr << "SingleColourLayer::setProperties: changing colour from " << m_colour << " to " << colour << std::endl; +#endif if (m_colourRefCount.find(m_colour) != m_colourRefCount.end() && m_colourRefCount[m_colour] > 0) {