diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-23 22:01:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-23 22:01:44 +0300 |
commit | 3c404128c4669a1f4f190e20a89553677717fc50 (patch) | |
tree | 2db4e5031089c800c4e00fd6244e578f44a7c910 /src/utils/sdlpixel.h | |
parent | 89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff) | |
download | ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2 ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.zip |
Add missing comments into defines.
Diffstat (limited to 'src/utils/sdlpixel.h')
-rw-r--r-- | src/utils/sdlpixel.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/utils/sdlpixel.h b/src/utils/sdlpixel.h index 66f4c2862..231959c80 100644 --- a/src/utils/sdlpixel.h +++ b/src/utils/sdlpixel.h @@ -68,6 +68,10 @@ #include <SDL.h> +#ifndef SDL_BYTEORDER +#error missing SDL_endian.h +#endif // SDL_BYTEORDER + /** * Puts a pixel on an SDL_Surface. * @@ -107,11 +111,13 @@ inline void SDLputPixel(SDL_Surface* surface, int x, int y, p[0] = CAST_U8((pixel >> 16) & 0xff); p[1] = CAST_U8((pixel >> 8) & 0xff); p[2] = CAST_U8((pixel) & 0xff); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + p[0] = CAST_U8((pixel) & 0xff); p[1] = CAST_U8((pixel >> 8) & 0xff); p[2] = CAST_U8((pixel >> 16) & 0xff); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN + break; case 4: @@ -218,14 +224,16 @@ inline void SDLputPixelAlpha(SDL_Surface* surface, int x, int y, + color.g * color.a) >> 8); p[0] = CAST_U8((p[0] * (255 - color.a) + color.r * color.a) >> 8); -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + p[0] = CAST_U8((p[0] * (255 - color.a) + color.b * color.a) >> 8); p[1] = CAST_U8((p[1] * (255 - color.a) + color.g * color.a) >> 8); p[2] = CAST_U8((p[2] * (255 - color.a) + color.r * color.a) >> 8); -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN + break; case 4: |