summaryrefslogtreecommitdiff
path: root/src/resources/imagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
commit3c404128c4669a1f4f190e20a89553677717fc50 (patch)
tree2db4e5031089c800c4e00fd6244e578f44a7c910 /src/resources/imagehelper.cpp
parent89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff)
downloadplus-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz
plus-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2
plus-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz
plus-3c404128c4669a1f4f190e20a89553677717fc50.zip
Add missing comments into defines.
Diffstat (limited to 'src/resources/imagehelper.cpp')
-rw-r--r--src/resources/imagehelper.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp
index 737e43aaa..78afafcd7 100644
--- a/src/resources/imagehelper.cpp
+++ b/src/resources/imagehelper.cpp
@@ -35,7 +35,7 @@
#ifndef SDL_BYTEORDER
#error missing SDL_endian.h
-#endif
+#endif // SDL_BYTEORDER
ImageHelper *imageHelper = nullptr;
ImageHelper *surfaceImageHelper = nullptr;
@@ -79,12 +79,13 @@ Image *ImageHelper::load(SDL_RWops *const rw, Dye const &dye)
rgba.Gmask = 0x0000FF00;
rgba.Bmask = 0x00FF0000;
rgba.Amask = 0xFF000000;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
rgba.Rmask = 0xFF000000;
rgba.Gmask = 0x00FF0000;
rgba.Bmask = 0x0000FF00;
rgba.Amask = 0x000000FF;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_Surface *const surf = MSDL_ConvertSurface(
tmpImage, &rgba, SDL_SWSURFACE);
@@ -135,7 +136,8 @@ SDL_Surface* ImageHelper::convertTo32Bit(SDL_Surface *const tmpImage)
#ifndef USE_SDL2
RGBAFormat.colorkey = 0;
RGBAFormat.alpha = 0;
-#endif
+#endif // USE_SDL2
+
RGBAFormat.BitsPerPixel = 32;
RGBAFormat.BytesPerPixel = 4;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
@@ -151,7 +153,8 @@ SDL_Surface* ImageHelper::convertTo32Bit(SDL_Surface *const tmpImage)
RGBAFormat.Amask = 0x000000FF;
RGBAFormat.Ashift = 24;
RGBAFormat.Aloss = 0;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
RGBAFormat.Rmask = 0x000000FF;
RGBAFormat.Rshift = 24;
RGBAFormat.Rloss = 0;
@@ -164,7 +167,8 @@ SDL_Surface* ImageHelper::convertTo32Bit(SDL_Surface *const tmpImage)
RGBAFormat.Amask = 0xFF000000;
RGBAFormat.Ashift = 0;
RGBAFormat.Aloss = 0;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
return MSDL_ConvertSurface(tmpImage, &RGBAFormat, SDL_SWSURFACE);
}
@@ -178,7 +182,8 @@ void ImageHelper::dumpSurfaceFormat(const SDL_Surface *const image)
logger->log("Bytes per pixel: %d", format->BytesPerPixel);
#ifndef USE_SDL2
logger->log("Alpha: %d", format->alpha);
-#endif
+#endif // USE_SDL2
+
logger->log("Loss: %02x, %02x, %02x, %02x",
CAST_U32(format->Rloss),
CAST_U32(format->Gloss),
@@ -226,12 +231,13 @@ SDL_Surface *ImageHelper::create32BitSurface(int width,
const int gmask = 0x00ff0000;
const int bmask = 0x0000ff00;
const int amask = 0x000000ff;
-#else
+#else // SDL_BYTEORDER == SDL_BIG_ENDIAN
+
const int rmask = 0x000000ff;
const int gmask = 0x0000ff00;
const int bmask = 0x00ff0000;
const int amask = 0xff000000;
-#endif
+#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN
return MSDL_CreateRGBSurface(SDL_SWSURFACE,
width, height, 32, rmask, gmask, bmask, amask);