From 2d452dd8faf2529fda01913b0ab26f4a1f22ef3d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 5 Dec 2011 21:45:05 +0300 Subject: A bit improve speed in getting color from theme. --- src/gui/palette.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/gui/palette.cpp') diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index f3046264f..348f97de8 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -65,15 +65,13 @@ Palette::~Palette() const gcn::Color& Palette::getColor(char c, bool &valid) { - for (Colors::const_iterator col = mColors.begin(), - colEnd = mColors.end(); col != colEnd; ++col) + CharColors::const_iterator it = mCharColors.find(c); + if (it != mCharColors.end()) { - if (col->ch == c) - { - valid = true; - return col->color; - } + valid = true; + return mColors[(*it).second].color; } + valid = false; return BLACK; } -- cgit v1.2.3-60-g2f50