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/resources/safeopenglimagehelper.cpp | |
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/resources/safeopenglimagehelper.cpp')
-rw-r--r-- | src/resources/safeopenglimagehelper.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp index f43351d7c..b1daf05e9 100644 --- a/src/resources/safeopenglimagehelper.cpp +++ b/src/resources/safeopenglimagehelper.cpp @@ -48,7 +48,7 @@ #ifndef SDL_BYTEORDER #error missing SDL_endian.h -#endif +#endif // SDL_BYTEORDER int SafeOpenGLImageHelper::mTextureType = 0; int SafeOpenGLImageHelper::mInternalTextureType = GL_RGBA8; @@ -163,10 +163,11 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurfaceNormalize(SDL_Surface #ifdef USE_SDL2 SDL_SetSurfaceAlphaMod(tmpImage, SDL_ALPHA_OPAQUE); -#else +#else // USE_SDL2 + // Make sure the alpha channel is not used, but copied to destination SDL_SetAlpha(tmpImage, 0, SDL_ALPHA_OPAQUE); -#endif +#endif // USE_SDL2 // Determine 32-bit masks based on byte order uint32_t rmask, gmask, bmask, amask; @@ -175,12 +176,13 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurfaceNormalize(SDL_Surface gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (tmpImage->format->BitsPerPixel != 32 || realWidth != width || realHeight != height @@ -191,7 +193,8 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurfaceNormalize(SDL_Surface SDL_Surface *oldImage = tmpImage; #ifdef USE_SDL2 SDL_SetSurfaceBlendMode(oldImage, SDL_BLENDMODE_NONE); -#endif +#endif // USE_SDL2 + tmpImage = MSDL_CreateRGBSurface(SDL_SWSURFACE, realWidth, realHeight, 32, rmask, gmask, bmask, amask); @@ -214,10 +217,11 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurface(SDL_Surface *tmpImage, #ifdef USE_SDL2 SDL_SetSurfaceAlphaMod(tmpImage, SDL_ALPHA_OPAQUE); -#else +#else // USE_SDL2 + // Make sure the alpha channel is not used, but copied to destination SDL_SetAlpha(tmpImage, 0, SDL_ALPHA_OPAQUE); -#endif +#endif // USE_SDL2 // Determine 32-bit masks based on byte order uint32_t rmask, gmask, bmask, amask; @@ -226,12 +230,13 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurface(SDL_Surface *tmpImage, gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; -#else +#else // SDL_BYTEORDER == SDL_BIG_ENDIAN + rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; -#endif +#endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (tmpImage->format->BitsPerPixel != 32 || rmask != tmpImage->format->Rmask @@ -241,7 +246,8 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurface(SDL_Surface *tmpImage, SDL_Surface *oldImage = tmpImage; #ifdef USE_SDL2 SDL_SetSurfaceBlendMode(oldImage, SDL_BLENDMODE_NONE); -#endif +#endif // USE_SDL2 + tmpImage = MSDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, rmask, gmask, bmask, amask); @@ -353,7 +359,7 @@ Image *SafeOpenGLImageHelper::glLoad(SDL_Surface *tmpImage, } #ifndef ANDROID glTexParameteri(mTextureType, GL_TEXTURE_MAX_LEVEL, 0); -#endif +#endif // ANDROID glTexImage2D(mTextureType, 0, mInternalTextureType, tmpImage->w, tmpImage->h, @@ -368,7 +374,7 @@ Image *SafeOpenGLImageHelper::glLoad(SDL_Surface *tmpImage, mglLabelObject(GL_TEXTURE, texture, strlen(text), text); } */ -#endif +#endif // DEBUG_OPENGL /* GLint compressed; @@ -382,7 +388,7 @@ Image *SafeOpenGLImageHelper::glLoad(SDL_Surface *tmpImage, #ifdef DEBUG_OPENGL_LEAKS textures_count ++; -#endif +#endif // DEBUG_OPENGL_LEAKS if (SDL_MUSTLOCK(tmpImage)) SDL_UnlockSurface(tmpImage); @@ -425,12 +431,13 @@ SDL_Surface *SafeOpenGLImageHelper::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 width = powerOfTwo(width); height = powerOfTwo(height); |