diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-06-21 21:29:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-06-21 21:29:51 +0300 |
commit | f3a89322713a379678abc420d75230a9b17aa18f (patch) | |
tree | 1fa4318ba77eeef61272eb6cd982c7bf37b82800 /src/guichan | |
parent | 552867509d2a29d806d2ba416b24fbf7ac711803 (diff) | |
download | manaplus-f3a89322713a379678abc420d75230a9b17aa18f.tar.gz manaplus-f3a89322713a379678abc420d75230a9b17aa18f.tar.bz2 manaplus-f3a89322713a379678abc420d75230a9b17aa18f.tar.xz manaplus-f3a89322713a379678abc420d75230a9b17aa18f.zip |
fix code style.
Diffstat (limited to 'src/guichan')
-rw-r--r-- | src/guichan/include/guichan/sdl/sdlpixel.hpp | 59 | ||||
-rw-r--r-- | src/guichan/sdl/sdlgraphics.cpp | 58 |
2 files changed, 53 insertions, 64 deletions
diff --git a/src/guichan/include/guichan/sdl/sdlpixel.hpp b/src/guichan/include/guichan/sdl/sdlpixel.hpp index c068aa290..4ec6b2386 100644 --- a/src/guichan/include/guichan/sdl/sdlpixel.hpp +++ b/src/guichan/include/guichan/sdl/sdlpixel.hpp @@ -84,10 +84,11 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if SDL_BYTEORDER == SDL_BIG_ENDIAN color = p[0] << 16 | p[1] << 8 | p[2]; - else +#else color = p[0] | p[1] << 8 | p[2] << 16; +#endif break; case 4: @@ -142,18 +143,15 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel) & 0xff); - } - else - { - p[0] = static_cast<uint8_t>((pixel) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); - } +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel) & 0xff); +#else + p[0] = static_cast<uint8_t>((pixel) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); +#endif break; case 4: @@ -256,24 +254,21 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - { - p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) - + color.b * color.a) >> 8); - p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) - + color.g * color.a) >> 8); - p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) - + color.r * color.a) >> 8); - } - else - { - p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) - + color.b * color.a) >> 8); - p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) - + color.g * color.a) >> 8); - p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) - + color.r * color.a) >> 8); - } +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) + + color.b * color.a) >> 8); + p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) + + color.g * color.a) >> 8); + p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) + + color.r * color.a) >> 8); +#else + p[0] = static_cast<uint8_t>((p[0] * (255 - color.a) + + color.b * color.a) >> 8); + p[1] = static_cast<uint8_t>((p[1] * (255 - color.a) + + color.g * color.a) >> 8); + p[2] = static_cast<uint8_t>((p[2] * (255 - color.a) + + color.r * color.a) >> 8); +#endif break; case 4: diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 6fd7a15dc..b36b5e565 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -232,26 +232,23 @@ namespace gcn } case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + for (; x1 <= x2; ++x1) { - for (; x1 <= x2; ++x1) - { - p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>(pixel & 0xff); - p += 3; - } + p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>(pixel & 0xff); + p += 3; } - else +#else + for (; x1 <= x2; ++x1) { - for (; x1 <= x2; ++x1) - { - p[0] = static_cast<uint8_t>(pixel & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p += 3; - } + p[0] = static_cast<uint8_t>(pixel & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p += 3; } +#endif break; case 4: @@ -351,26 +348,23 @@ namespace gcn break; case 3: - if (SDL_BYTEORDER == SDL_BIG_ENDIAN) +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + for (; y1 <= y2; ++y1) { - for (; y1 <= y2; ++y1) - { - p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>(pixel & 0xff); - p += mTarget->pitch; - } + p[0] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>(pixel & 0xff); + p += mTarget->pitch; } - else +#else + for (; y1 <= y2; ++y1) { - for (; y1 <= y2; ++y1) - { - p[0] = static_cast<uint8_t>(pixel & 0xff); - p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); - p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); - p += mTarget->pitch; - } + p[0] = static_cast<uint8_t>(pixel & 0xff); + p[1] = static_cast<uint8_t>((pixel >> 8) & 0xff); + p[2] = static_cast<uint8_t>((pixel >> 16) & 0xff); + p += mTarget->pitch; } +#endif break; case 4: |