From 3c404128c4669a1f4f190e20a89553677717fc50 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 23 Sep 2016 22:01:44 +0300 Subject: Add missing comments into defines. --- src/utils/sdlpixel.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/utils/sdlpixel.h') 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 +#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: -- cgit v1.2.3-70-g09d2