Mercurial > hg > svgui
diff layer/SingleColourLayer.cpp @ 366:a55affd7ab6c
* Avoid setting a new colour on layer when adding the same layer more than
once
author | Chris Cannam |
---|---|
date | Mon, 11 Feb 2008 11:06:17 +0000 |
parents | c0b9eec70639 |
children | 06360ed99cd1 |
line wrap: on
line diff
--- 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