diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-12-05 21:45:05 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-12-05 21:47:10 +0300 |
commit | 2d452dd8faf2529fda01913b0ab26f4a1f22ef3d (patch) | |
tree | 818e1d9aa3088deca6cdcd5df72858b3dec56a0c /src/gui/palette.cpp | |
parent | 940161d95ee7c9e9ef4c6941d3d464d4264a94ad (diff) | |
download | mv-2d452dd8faf2529fda01913b0ab26f4a1f22ef3d.tar.gz mv-2d452dd8faf2529fda01913b0ab26f4a1f22ef3d.tar.bz2 mv-2d452dd8faf2529fda01913b0ab26f4a1f22ef3d.tar.xz mv-2d452dd8faf2529fda01913b0ab26f4a1f22ef3d.zip |
A bit improve speed in getting color from theme.
Diffstat (limited to 'src/gui/palette.cpp')
-rw-r--r-- | src/gui/palette.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
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; } |