summaryrefslogtreecommitdiff
path: root/src/resources/dye.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-03 17:26:04 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-03 17:26:04 +0300
commit57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534 (patch)
tree4677cd003c75753536dd90b864959b0982ca42d7 /src/resources/dye.cpp
parenta1e8fc08282d11b0132670cf1bfde2b7fe989dc2 (diff)
downloadmanaplus-57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534.tar.gz
manaplus-57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534.tar.bz2
manaplus-57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534.tar.xz
manaplus-57a81ed6cf1c02d7ec8bfe1e6f0a1d3232309534.zip
Improve dye speed.
Diffstat (limited to 'src/resources/dye.cpp')
-rw-r--r--src/resources/dye.cpp12
1 files changed, 3 insertions, 9 deletions
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<int>(rest * b1 + intensity * b2);
}
-void DyePalette::replaceColor(int color[3]) const
+void DyePalette::replaceColor(Uint8 *color) const
{
std::vector<Color>::const_iterator it = mColors.begin();
std::vector<Color>::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;