From 57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Jun 2012 17:26:04 +0300 Subject: Improve dye speed. --- src/resources/dye.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/resources/dye.cpp') diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index a4e101ff8..50972c6d6 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -205,7 +205,7 @@ void DyePalette::getColor(double intensity, int color[3]) const color[2] = static_cast(rest * b1 + intensity * b2); } -void DyePalette::replaceColor(int color[3]) const +void DyePalette::replaceColor(Uint8 *color) const { std::vector::const_iterator it = mColors.begin(); std::vector::const_iterator it_end = mColors.end(); @@ -219,9 +219,9 @@ void DyePalette::replaceColor(int color[3]) const if (color[0] == col.value[0] && color[1] == col.value[1] && color[2] == col.value[2]) { - color[0] = col2.value[0]; + color[2] = col2.value[0]; color[1] = col2.value[1]; - color[2] = col2.value[2]; + color[0] = col2.value[2]; return; } ++ it; @@ -285,12 +285,6 @@ Dye::~Dye() void Dye::update(int color[3]) const { - if (mDyePalettes[dyePalateSize - 1]) - { - mDyePalettes[dyePalateSize - 1]->replaceColor(color); - return; - } - int cmax = std::max(color[0], std::max(color[1], color[2])); if (cmax == 0) return; -- cgit v1.2.3-60-g2f50