# HG changeset patch # User Chris Cannam # Date 1202727977 0 # Node ID a55affd7ab6c35d7695aaa1404c303767d11d16d # Parent 26ce2fb7bcbf10358132c805a3147fe79b42f508 * Avoid setting a new colour on layer when adding the same layer more than once diff -r 26ce2fb7bcbf -r a55affd7ab6c layer/SingleColourLayer.cpp --- a/layer/SingleColourLayer.cpp Thu Feb 07 15:25:05 2008 +0000 +++ b/layer/SingleColourLayer.cpp Mon Feb 11 11:06:17 2008 +0000 @@ -27,7 +27,8 @@ SingleColourLayer::SingleColourLayer() : m_colour(0), - m_colourExplicitlySet(false) + m_colourExplicitlySet(false), + m_defaultColourSet(false) { setDefaultColourFor(0); } @@ -125,7 +126,9 @@ void SingleColourLayer::setDefaultColourFor(View *v) { - if (m_colourExplicitlySet) return; + std::cerr << "SingleColourLayer::setDefaultColourFor: m_colourExplicitlySet = " << m_colourExplicitlySet << ", m_defaultColourSet " << m_defaultColourSet << std::endl; + + if (m_colourExplicitlySet || m_defaultColourSet) return; bool dark = false; if (v) { @@ -155,6 +158,7 @@ if (hint >= 0 && impose) { setBaseColour(hint); + m_defaultColourSet = true; return; } @@ -190,6 +194,8 @@ } else { m_colourRefCount[m_colour]++; } + + m_defaultColourSet = true; } void diff -r 26ce2fb7bcbf -r a55affd7ab6c layer/SingleColourLayer.h --- a/layer/SingleColourLayer.h Thu Feb 07 15:25:05 2008 +0000 +++ b/layer/SingleColourLayer.h Mon Feb 11 11:06:17 2008 +0000 @@ -70,6 +70,7 @@ int m_colour; bool m_colourExplicitlySet; + bool m_defaultColourSet; }; #endif