From 4c057739d0538d01481643848a6cb558e0ef4e51 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 7 Jun 2012 00:31:46 +0300 Subject: More improve load image speed in opengl mode. --- src/resources/dye.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/resources/dye.cpp') 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::const_iterator it = mColors.begin(); + std::vector::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) -- cgit v1.2.3-60-g2f50