From c2efedab22275302f0a10cc197424d345a021d18 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Jun 2012 20:13:48 +0300 Subject: Replace SDL int types to C++ types. --- src/resources/sdlimagehelper.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/resources/sdlimagehelper.cpp') diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp index a416a35d2..6c281514e 100644 --- a/src/resources/sdlimagehelper.cpp +++ b/src/resources/sdlimagehelper.cpp @@ -65,15 +65,15 @@ Resource *SDLImageHelper::load(SDL_RWops *rw, Dye const &dye) surf = SDL_ConvertSurface(tmpImage, &rgba, SDL_SWSURFACE); SDL_FreeSurface(tmpImage); - Uint32 *pixels = static_cast(surf->pixels); + uint32_t *pixels = static_cast(surf->pixels); DyePalette *pal = dye.getSPalete(); if (pal) { - for (Uint32 *p_end = pixels + surf->w * surf->h; + for (uint32_t *p_end = pixels + surf->w * surf->h; pixels != p_end; ++pixels) { - Uint8 *p = reinterpret_cast(pixels); + uint8_t *p = reinterpret_cast(pixels); const int alpha = *p & 255; if (!alpha) continue; @@ -82,10 +82,10 @@ Resource *SDLImageHelper::load(SDL_RWops *rw, Dye const &dye) } else { - for (Uint32 *p_end = pixels + surf->w * surf->h; + for (uint32_t *p_end = pixels + surf->w * surf->h; pixels != p_end; ++pixels) { - const Uint32 p = *pixels; + const uint32_t p = *pixels; const int alpha = p & 255; if (!alpha) continue; @@ -121,23 +121,23 @@ Image *SDLImageHelper::createTextSurface(SDL_Surface *tmpImage, float alpha) const int sz = tmpImage->w * tmpImage->h; // The alpha channel to be filled with alpha values - Uint8 *alphaChannel = new Uint8[sz]; + uint8_t *alphaChannel = new uint8_t[sz]; const SDL_PixelFormat * const fmt = tmpImage->format; if (fmt->Amask) { for (int i = 0; i < sz; ++ i) { - Uint32 c = (static_cast(tmpImage->pixels))[i]; + uint32_t c = (static_cast(tmpImage->pixels))[i]; unsigned v = (c & fmt->Amask) >> fmt->Ashift; - Uint8 a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1))); + uint8_t a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1))); - Uint8 a2 = static_cast(static_cast(a) * alpha); + uint8_t a2 = static_cast(static_cast(a) * alpha); c &= ~fmt->Amask; c |= ((a2 >> fmt->Aloss) << fmt->Ashift & fmt->Amask); - (static_cast(tmpImage->pixels))[i] = c; + (static_cast(tmpImage->pixels))[i] = c; if (a != 255) hasAlpha = true; @@ -206,7 +206,7 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const int sz = tmpImage->w * tmpImage->h; // The alpha channel to be filled with alpha values - Uint8 *alphaChannel = new Uint8[sz]; + uint8_t *alphaChannel = new uint8_t[sz]; // Figure out whether the image uses its alpha layer if (!tmpImage->format->palette) @@ -216,9 +216,9 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) { for (int i = 0; i < sz; ++ i) { - unsigned v = ((static_cast(tmpImage->pixels))[i] + unsigned v = ((static_cast(tmpImage->pixels))[i] & fmt->Amask) >> fmt->Ashift; - Uint8 a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1))); + uint8_t a = (v << fmt->Aloss) + (v >> (8 - (fmt->Aloss << 1))); if (a != 255) hasAlpha = true; -- cgit v1.2.3-60-g2f50