diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-06-07 00:31:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-06-07 00:31:46 +0300 |
commit | 4c057739d0538d01481643848a6cb558e0ef4e51 (patch) | |
tree | fd09c3a5e5ddccd4d133ecdbe232f8490ba732a0 /src/resources/dye.cpp | |
parent | 5f434dba57bd80ab370dba5a9a425e86acbe800f (diff) | |
download | manaverse-4c057739d0538d01481643848a6cb558e0ef4e51.tar.gz manaverse-4c057739d0538d01481643848a6cb558e0ef4e51.tar.bz2 manaverse-4c057739d0538d01481643848a6cb558e0ef4e51.tar.xz manaverse-4c057739d0538d01481643848a6cb558e0ef4e51.zip |
More improve load image speed in opengl mode.
Diffstat (limited to 'src/resources/dye.cpp')
-rw-r--r-- | src/resources/dye.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index 50972c6d6..78ad8137a 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -228,6 +228,29 @@ void DyePalette::replaceColor(Uint8 *color) const } } +void DyePalette::replaceOGLColor(Uint8 *color) const +{ + std::vector<Color>::const_iterator it = mColors.begin(); + std::vector<Color>::const_iterator it_end = mColors.end(); + while (it != it_end) + { + const Color &col = *it; + ++ it; + if (it == it_end) + return; + const Color &col2 = *it; + if (color[2] == col.value[0] && color[1] == col.value[1] + && color[0] == col.value[2]) + { + color[0] = col2.value[0]; + color[1] = col2.value[1]; + color[2] = col2.value[2]; + return; + } + ++ it; + } +} + Dye::Dye(const std::string &description) { for (int i = 0; i < dyePalateSize; ++i) |