# HG changeset patch # User Chris Cannam # Date 1202733999 0 # Node ID 06360ed99cd1c4d16a0b06d4d6166fe51a875d17 # Parent a55affd7ab6c35d7695aaa1404c303767d11d16d * Further fixes to the handling of playback frame and buffered frame counts diff -r a55affd7ab6c -r 06360ed99cd1 layer/SingleColourLayer.cpp --- 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 #include +//#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) {