diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-13 12:20:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-13 12:20:19 +0300 |
commit | f0b7627b7d88c1d5bb484961377114b210c8dd53 (patch) | |
tree | a978c3b8eca88759fa71b5fc34112f4bea9bbcec /src/resources/dye.cpp | |
parent | d9be27bba8941260500066cdd43ebb016356bc67 (diff) | |
download | manaplus-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.gz manaplus-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.bz2 manaplus-f0b7627b7d88c1d5bb484961377114b210c8dd53.tar.xz manaplus-f0b7627b7d88c1d5bb484961377114b210c8dd53.zip |
Fix code style.
Diffstat (limited to 'src/resources/dye.cpp')
-rw-r--r-- | src/resources/dye.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index ea66b2b6b..3b83780c5 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -162,23 +162,25 @@ void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const #endif if (!alpha) continue; - int color[3]; + unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - color[0] = (p) & 255; - color[1] = (p >> 8) & 255; - color[2] = (p >> 16) & 255; + color[0] = (p) & 255U; + color[1] = (p >> 8U) & 255U; + color[2] = (p >> 16U) & 255U; #else - color[0] = (p >> 24) & 255; - color[1] = (p >> 16) & 255; - color[2] = (p >> 8) & 255; + color[0] = (p >> 24U) & 255U; + color[1] = (p >> 16U) & 255U; + color[2] = (p >> 8U) & 255U; #endif - const int cmax = std::max(color[0], std::max(color[1], color[2])); + const unsigned int cmax = std::max( + color[0], std::max(color[1], color[2])); if (cmax == 0) continue; - const int cmin = std::min(color[0], std::min(color[1], color[2])); - const int intensity = color[0] + color[1] + color[2]; + const unsigned int cmin = std::min( + color[0], std::min(color[1], color[2])); + const unsigned int intensity = color[0] + color[1] + color[2]; if (cmin != cmax && (cmin != 0 || (intensity != cmax && intensity != 2 * cmax))) @@ -187,7 +189,7 @@ void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const continue; } - const int i = (color[0] != 0) | ((color[1] != 0) << 1) + const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) | ((color[2] != 0) << 2); if (mDyePalettes[i - 1]) @@ -217,23 +219,25 @@ void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const #endif if (!alpha) continue; - int color[3]; + unsigned int color[3]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - color[0] = (p >> 24) & 255; - color[1] = (p >> 16) & 255; - color[2] = (p >> 8) & 255; + color[0] = (p >> 24U) & 255U; + color[1] = (p >> 16U) & 255U; + color[2] = (p >> 8U) & 255U; #else - color[0] = (p) & 255; - color[1] = (p >> 8) & 255; - color[2] = (p >> 16) & 255; + color[0] = (p) & 255U; + color[1] = (p >> 8U) & 255U; + color[2] = (p >> 16U) & 255U; #endif - const int cmax = std::max(color[0], std::max(color[1], color[2])); + const unsigned int cmax = std::max( + color[0], std::max(color[1], color[2])); if (cmax == 0) continue; - const int cmin = std::min(color[0], std::min(color[1], color[2])); - const int intensity = color[0] + color[1] + color[2]; + const unsigned int cmin = std::min( + color[0], std::min(color[1], color[2])); + const unsigned int intensity = color[0] + color[1] + color[2]; if (cmin != cmax && (cmin != 0 || (intensity != cmax && intensity != 2 * cmax))) @@ -242,7 +246,7 @@ void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const continue; } - const int i = (color[0] != 0) | ((color[1] != 0) << 1) + const unsigned int i = (color[0] != 0) | ((color[1] != 0) << 1) | ((color[2] != 0) << 2); if (mDyePalettes[i - 1]) |