diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-12-07 04:35:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-12-07 18:50:36 +0300 |
commit | 514878dd29b52fcbdc3ec63833d528070d502880 (patch) | |
tree | 8d4abe6e8a5146630f9d66908f8ccdf860f1b8d2 /src/resources | |
parent | 48ea9be889ecc77ae0ee7e952f1970771a92e5c9 (diff) | |
download | mv-514878dd29b52fcbdc3ec63833d528070d502880.tar.gz mv-514878dd29b52fcbdc3ec63833d528070d502880.tar.bz2 mv-514878dd29b52fcbdc3ec63833d528070d502880.tar.xz mv-514878dd29b52fcbdc3ec63833d528070d502880.zip |
Fix code style.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/atlas/atlasmanager.cpp | 16 | ||||
-rw-r--r-- | src/resources/dye/dye.cpp | 4 | ||||
-rw-r--r-- | src/resources/dye/dyepalette_replacescolor.cpp | 16 | ||||
-rw-r--r-- | src/resources/dye/dyepalette_replacesoglcolor.cpp | 2 | ||||
-rw-r--r-- | src/resources/imagehelper.cpp | 48 | ||||
-rw-r--r-- | src/resources/mobileopenglscreenshothelper.cpp | 2 | ||||
-rw-r--r-- | src/resources/openglimagehelper.cpp | 48 | ||||
-rw-r--r-- | src/resources/safeopenglimagehelper.cpp | 48 | ||||
-rw-r--r-- | src/resources/sdlgfxblitfunc.cpp | 8 | ||||
-rw-r--r-- | src/resources/sdlimagehelper.cpp | 16 |
10 files changed, 104 insertions, 104 deletions
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp index e1c847909..513f87976 100644 --- a/src/resources/atlas/atlasmanager.cpp +++ b/src/resources/atlas/atlasmanager.cpp @@ -314,16 +314,16 @@ void AtlasManager::createSDLAtlas(TextureAtlas *const atlas) { BLOCK_START("AtlasManager::createSDLAtlas") #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int rmask = 0xff000000; - const unsigned int gmask = 0x00ff0000; - const unsigned int bmask = 0x0000ff00; - const unsigned int amask = 0x000000ff; + const uint32_t rmask = 0xff000000U; + const uint32_t gmask = 0x00ff0000U; + const uint32_t bmask = 0x0000ff00U; + const uint32_t amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int rmask = 0x000000ff; - const unsigned int gmask = 0x0000ff00; - const unsigned int bmask = 0x00ff0000; - const unsigned int amask = 0xff000000; + const uint32_t rmask = 0x000000ffU; + const uint32_t gmask = 0x0000ff00U; + const uint32_t bmask = 0x00ff0000U; + const uint32_t amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN // do not create atlas based on only one image diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index df4d165cc..d9c766af3 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -232,10 +232,10 @@ void Dye::normalOGLDye(uint32_t *restrict pixels, { const uint32_t p = *pixels; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int alpha = p & 255; + const uint32_t alpha = p & 255U; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const int alpha = p & 0xff000000; + const uint32_t alpha = p & 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (alpha == 0) diff --git a/src/resources/dye/dyepalette_replacescolor.cpp b/src/resources/dye/dyepalette_replacescolor.cpp index 4c987aa9d..6f0cb7d30 100644 --- a/src/resources/dye/dyepalette_replacescolor.cpp +++ b/src/resources/dye/dyepalette_replacescolor.cpp @@ -52,10 +52,10 @@ void DyePalette::replaceSColorDefault(uint32_t *restrict pixels, { uint8_t *const p = reinterpret_cast<uint8_t *>(pixels); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = (*pixels) & 0x00ffffff; + const unsigned int data = (*pixels) & 0x00ffffffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = (*pixels) & 0xffffff00; + const unsigned int data = (*pixels) & 0xffffff00U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); @@ -111,7 +111,7 @@ void DyePalette::replaceSColorSse2(uint32_t *restrict pixels, for (int ptr = 0; ptr < bufEnd; ptr += 4) { - __m128i mask = _mm_set1_epi32(0xffffff00); + __m128i mask = _mm_set1_epi32(0xffffff00U); // __m128i base = _mm_load_si128(reinterpret_cast<__m128i*>(pixels)); __m128i base = _mm_loadu_si128(reinterpret_cast<__m128i*>( &pixels[ptr])); @@ -142,10 +142,10 @@ void DyePalette::replaceSColorSse2(uint32_t *restrict pixels, { uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = pixels[ptr] & 0x00ffffff; + const unsigned int data = pixels[ptr] & 0x00ffffffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = pixels[ptr] & 0xffffff00; + const unsigned int data = pixels[ptr] & 0xffffff00U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); @@ -192,7 +192,7 @@ void DyePalette::replaceSColorAvx2(uint32_t *restrict pixels, for (int ptr = 0; ptr < bufEnd; ptr += 8) { - __m256i mask = _mm256_set1_epi32(0xffffff00); + __m256i mask = _mm256_set1_epi32(0xffffff00U); // __m256i base = _mm256_load_si256(reinterpret_cast<__m256i*>(pixels)); __m256i base = _mm256_loadu_si256(reinterpret_cast<__m256i*>( &pixels[ptr])); @@ -223,10 +223,10 @@ void DyePalette::replaceSColorAvx2(uint32_t *restrict pixels, { uint8_t *const p = reinterpret_cast<uint8_t *>(&pixels[ptr]); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = pixels[ptr] & 0x00ffffff; + const unsigned int data = pixels[ptr] & 0x00ffffffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const unsigned int data = pixels[ptr] & 0xffffff00; + const unsigned int data = pixels[ptr] & 0xffffff00U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); diff --git a/src/resources/dye/dyepalette_replacesoglcolor.cpp b/src/resources/dye/dyepalette_replacesoglcolor.cpp index a23c64f1f..f4bd31dd0 100644 --- a/src/resources/dye/dyepalette_replacesoglcolor.cpp +++ b/src/resources/dye/dyepalette_replacesoglcolor.cpp @@ -238,7 +238,7 @@ void DyePalette::replaceSOGLColorAvx2(uint32_t *restrict pixels, STD_VECTOR<DyeColor>::const_iterator it = mColors.begin(); while (it != it_end) { - const DyeColor &col = *it; + const DyeColor &col = *it; ++ it; const DyeColor &col2 = *it; diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index 3585e99bf..cc787f46d 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -78,16 +78,16 @@ Image *ImageHelper::load(SDL_RWops *const rw, Dye const &dye) rgba.BytesPerPixel = 4; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rgba.Rmask = 0x000000FF; - rgba.Gmask = 0x0000FF00; - rgba.Bmask = 0x00FF0000; - rgba.Amask = 0xFF000000; + rgba.Rmask = 0x000000FFU; + rgba.Gmask = 0x0000FF00U; + rgba.Bmask = 0x00FF0000U; + rgba.Amask = 0xFF000000U; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - rgba.Rmask = 0xFF000000; - rgba.Gmask = 0x00FF0000; - rgba.Bmask = 0x0000FF00; - rgba.Amask = 0x000000FF; + rgba.Rmask = 0xFF000000U; + rgba.Gmask = 0x00FF0000U; + rgba.Bmask = 0x0000FF00U; + rgba.Amask = 0x000000FFU; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN SDL_Surface *const surf = MSDL_ConvertSurface( @@ -144,30 +144,30 @@ SDL_Surface* ImageHelper::convertTo32Bit(SDL_Surface *const tmpImage) RGBAFormat.BitsPerPixel = 32; RGBAFormat.BytesPerPixel = 4; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - RGBAFormat.Rmask = 0xFF000000; + RGBAFormat.Rmask = 0xFF000000U; RGBAFormat.Rshift = 0; RGBAFormat.Rloss = 0; - RGBAFormat.Gmask = 0x00FF0000; + RGBAFormat.Gmask = 0x00FF0000U; RGBAFormat.Gshift = 8; RGBAFormat.Gloss = 0; - RGBAFormat.Bmask = 0x0000FF00; + RGBAFormat.Bmask = 0x0000FF00U; RGBAFormat.Bshift = 16; RGBAFormat.Bloss = 0; - RGBAFormat.Amask = 0x000000FF; + RGBAFormat.Amask = 0x000000FFU; RGBAFormat.Ashift = 24; RGBAFormat.Aloss = 0; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - RGBAFormat.Rmask = 0x000000FF; + RGBAFormat.Rmask = 0x000000FFU; RGBAFormat.Rshift = 24; RGBAFormat.Rloss = 0; - RGBAFormat.Gmask = 0x0000FF00; + RGBAFormat.Gmask = 0x0000FF00U; RGBAFormat.Gshift = 16; RGBAFormat.Gloss = 0; - RGBAFormat.Bmask = 0x00FF0000; + RGBAFormat.Bmask = 0x00FF0000U; RGBAFormat.Bshift = 8; RGBAFormat.Bloss = 0; - RGBAFormat.Amask = 0xFF000000; + RGBAFormat.Amask = 0xFF000000U; RGBAFormat.Ashift = 0; RGBAFormat.Aloss = 0; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN @@ -239,16 +239,16 @@ SDL_Surface *ImageHelper::create32BitSurface(int width, int height) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0xff000000; - const int gmask = 0x00ff0000; - const int bmask = 0x0000ff00; - const int amask = 0x000000ff; + const uint32_t rmask = 0xff000000U; + const uint32_t gmask = 0x00ff0000U; + const uint32_t bmask = 0x0000ff00U; + const uint32_t amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0x000000ff; - const int gmask = 0x0000ff00; - const int bmask = 0x00ff0000; - const int amask = 0xff000000; + const uint32_t rmask = 0x000000ffU; + const uint32_t gmask = 0x0000ff00U; + const uint32_t bmask = 0x00ff0000U; + const uint32_t amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN return MSDL_CreateRGBSurface(SDL_SWSURFACE, diff --git a/src/resources/mobileopenglscreenshothelper.cpp b/src/resources/mobileopenglscreenshothelper.cpp index e726a723b..76a41c949 100644 --- a/src/resources/mobileopenglscreenshothelper.cpp +++ b/src/resources/mobileopenglscreenshothelper.cpp @@ -62,7 +62,7 @@ SDL_Surface *MobileOpenGLScreenshotHelper::getScreenshot() SDL_Surface *const tmpImage = MSDL_CreateRGBSurface( SDL_SWSURFACE, w, h, 32, - 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + 0x00ff0000U, 0x0000ff00U, 0x000000ffU, 0xff000000U); if (tmpImage == nullptr) return nullptr; diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp index ff3a2e4f3..81ef529fd 100644 --- a/src/resources/openglimagehelper.cpp +++ b/src/resources/openglimagehelper.cpp @@ -162,16 +162,16 @@ SDL_Surface *OpenGLImageHelper::convertSurfaceNormalize(SDL_Surface *tmpImage, // Determine 32-bit masks based on byte order uint32_t rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xff000000; - gmask = 0x00ff0000; - bmask = 0x0000ff00; - amask = 0x000000ff; + rmask = 0xff000000U; + gmask = 0x00ff0000U; + bmask = 0x0000ff00U; + amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x000000ff; - gmask = 0x0000ff00; - bmask = 0x00ff0000; - amask = 0xff000000; + rmask = 0x000000ffU; + gmask = 0x0000ff00U; + bmask = 0x00ff0000U; + amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (tmpImage->format->BitsPerPixel != 32 @@ -215,16 +215,16 @@ SDL_Surface *OpenGLImageHelper::convertSurface(SDL_Surface *tmpImage, // Determine 32-bit masks based on byte order uint32_t rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xff000000; - gmask = 0x00ff0000; - bmask = 0x0000ff00; - amask = 0x000000ff; + rmask = 0xff000000U; + gmask = 0x00ff0000U; + bmask = 0x0000ff00U; + amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x000000ff; - gmask = 0x0000ff00; - bmask = 0x00ff0000; - amask = 0xff000000; + rmask = 0x000000ffU; + gmask = 0x0000ff00U; + bmask = 0x00ff0000U; + amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (tmpImage->format->BitsPerPixel != 32 @@ -442,16 +442,16 @@ SDL_Surface *OpenGLImageHelper::create32BitSurface(int width, int height) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0xff000000; - const int gmask = 0x00ff0000; - const int bmask = 0x0000ff00; - const int amask = 0x000000ff; + const uint32_t rmask = 0xff000000U; + const uint32_t gmask = 0x00ff0000U; + const uint32_t bmask = 0x0000ff00U; + const uint32_t amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0x000000ff; - const int gmask = 0x0000ff00; - const int bmask = 0x00ff0000; - const int amask = 0xff000000; + const uint32_t rmask = 0x000000ffU; + const uint32_t gmask = 0x0000ff00U; + const uint32_t bmask = 0x00ff0000U; + const uint32_t amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN width = powerOfTwo(width); diff --git a/src/resources/safeopenglimagehelper.cpp b/src/resources/safeopenglimagehelper.cpp index 70b2c31a1..e80f4de9c 100644 --- a/src/resources/safeopenglimagehelper.cpp +++ b/src/resources/safeopenglimagehelper.cpp @@ -162,16 +162,16 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurfaceNormalize(SDL_Surface // Determine 32-bit masks based on byte order uint32_t rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xff000000; - gmask = 0x00ff0000; - bmask = 0x0000ff00; - amask = 0x000000ff; + rmask = 0xff000000U; + gmask = 0x00ff0000U; + bmask = 0x0000ff00U; + amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x000000ff; - gmask = 0x0000ff00; - bmask = 0x00ff0000; - amask = 0xff000000; + rmask = 0x000000ffU; + gmask = 0x0000ff00U; + bmask = 0x00ff0000U; + amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (tmpImage->format->BitsPerPixel != 32 @@ -216,16 +216,16 @@ SDL_Surface *SafeOpenGLImageHelper::convertSurface(SDL_Surface *tmpImage, // Determine 32-bit masks based on byte order uint32_t rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0xff000000; - gmask = 0x00ff0000; - bmask = 0x0000ff00; - amask = 0x000000ff; + rmask = 0xff000000U; + gmask = 0x00ff0000U; + bmask = 0x0000ff00U; + amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x000000ff; - gmask = 0x0000ff00; - bmask = 0x00ff0000; - amask = 0xff000000; + rmask = 0x000000ffU; + gmask = 0x0000ff00U; + bmask = 0x00ff0000U; + amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN if (tmpImage->format->BitsPerPixel != 32 @@ -417,16 +417,16 @@ SDL_Surface *SafeOpenGLImageHelper::create32BitSurface(int width, int height) const { #if SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0xff000000; - const int gmask = 0x00ff0000; - const int bmask = 0x0000ff00; - const int amask = 0x000000ff; + const uint32_t rmask = 0xff000000U; + const uint32_t gmask = 0x00ff0000U; + const uint32_t bmask = 0x0000ff00U; + const uint32_t amask = 0x000000ffU; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - const int rmask = 0x000000ff; - const int gmask = 0x0000ff00; - const int bmask = 0x00ff0000; - const int amask = 0xff000000; + const uint32_t rmask = 0x000000ffU; + const uint32_t gmask = 0x0000ff00U; + const uint32_t bmask = 0x00ff0000U; + const uint32_t amask = 0xff000000U; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN width = powerOfTwo(width); diff --git a/src/resources/sdlgfxblitfunc.cpp b/src/resources/sdlgfxblitfunc.cpp index fa74c82c3..7151d21bf 100644 --- a/src/resources/sdlgfxblitfunc.cpp +++ b/src/resources/sdlgfxblitfunc.cpp @@ -365,10 +365,10 @@ static void _SDL_gfxBlitBlitterRGBA(const SDL_gfxBlitInfo *const info) sA = ((pixel & srcfmt->Amask) >> srcfmt->Ashift); pixel = *(reinterpret_cast<uint32_t *>(dst)); - dR = pixel & 0xff; - dG = ((pixel & 0xff00) >> 8); - dB = ((pixel & 0xff0000) >> 16); - dA = ((pixel & 0xff000000) >> 24); + dR = pixel & 0xffU; + dG = ((pixel & 0xff00U) >> 8); + dB = ((pixel & 0xff0000U) >> 16); + dA = ((pixel & 0xff000000U) >> 24); sAA = GFX_ALPHA_ADJUST_ARRAY[sA & 255]; dR = (((sR - dR) * (sAA)) / 255) + dR; diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index 0ed5c9f52..e9db78e9e 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -73,23 +73,23 @@ Image *SDLImageHelper::load(SDL_RWops *const rw, Dye const &dye) rgba.Aloss = 0; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rgba.Rmask = 0x000000FF; + rgba.Rmask = 0x000000FFU; rgba.Rshift = 24; - rgba.Gmask = 0x0000FF00; + rgba.Gmask = 0x0000FF00U; rgba.Gshift = 16; - rgba.Bmask = 0x00FF0000; + rgba.Bmask = 0x00FF0000U; rgba.Bshift = 8; - rgba.Amask = 0xFF000000; + rgba.Amask = 0xFF000000U; rgba.Ashift = 0; #else // SDL_BYTEORDER == SDL_BIG_ENDIAN - rgba.Rmask = 0xFF000000; + rgba.Rmask = 0xFF000000U; rgba.Rshift = 0; - rgba.Gmask = 0x00FF0000; + rgba.Gmask = 0x00FF0000U; rgba.Gshift = 8; - rgba.Bmask = 0x0000FF00; + rgba.Bmask = 0x0000FF00U; rgba.Bshift = 16; - rgba.Amask = 0x000000FF; + rgba.Amask = 0x000000FFU; rgba.Ashift = 24; #endif // SDL_BYTEORDER == SDL_BIG_ENDIAN |