diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-15 11:54:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-15 11:54:49 +0300 |
commit | 6a396b89dba22004820fe1089705b2a182de8412 (patch) | |
tree | fa3515bfd295bef588b34170ed6cf14ec1d3f391 /src/resources | |
parent | 2906bc28196a1b60406f10cb0c4ceed2366041b4 (diff) | |
download | plus-6a396b89dba22004820fe1089705b2a182de8412.tar.gz plus-6a396b89dba22004820fe1089705b2a182de8412.tar.bz2 plus-6a396b89dba22004820fe1089705b2a182de8412.tar.xz plus-6a396b89dba22004820fe1089705b2a182de8412.zip |
improve dye file.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/dye.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index 13b635d45..bfe9145bc 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -94,12 +94,13 @@ void DyePalette::getColor(const int intensity, int color[3]) const return; } - int last = static_cast<int>(mColors.size()); + const int last = static_cast<int>(mColors.size()); if (last == 0) return; - const int i = intensity * last / 255; - const int t = intensity * last % 255; + const int intLast = intensity * last; + const int i = intLast / 255; + const int t = intLast % 255; int j = t != 0 ? i : i - 1; @@ -148,7 +149,7 @@ void DyePalette::getColor(double intensity, int color[3]) const intensity = 0.0; // Scale up - intensity = intensity * static_cast<double>(mColors.size() - 1); + intensity *= static_cast<double>(mColors.size() - 1); // Color indices const int i = static_cast<int>(floor(intensity)); |