diff options
Diffstat (limited to 'src/guichan/sdl')
-rw-r--r-- | src/guichan/sdl/sdlgraphics.cpp | 23 | ||||
-rw-r--r-- | src/guichan/sdl/sdlimage.cpp | 4 |
2 files changed, 17 insertions, 10 deletions
diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index c8cec6370..ae61a0432 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -283,7 +283,8 @@ namespace gcn SDL_LockSurface(mTarget); - Uint8 *p = (Uint8 *)mTarget->pixels + y * mTarget->pitch + x1 * bpp; + Uint8 *p = static_cast<Uint8*>(mTarget->pixels) + + y * mTarget->pitch + x1 * bpp; Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, @@ -298,7 +299,7 @@ namespace gcn case 2: { - Uint16* q = (Uint16*)p; + Uint16* q = reinterpret_cast<Uint16*>(p); for (; x1 <= x2; ++x1) *(q++) = pixel; break; @@ -329,7 +330,7 @@ namespace gcn case 4: { - Uint32* q = (Uint32*)p; + Uint32 *q = reinterpret_cast<Uint32*>(p); for (; x1 <= x2; ++x1) { if (mAlpha) @@ -395,7 +396,8 @@ namespace gcn SDL_LockSurface(mTarget); - Uint8 *p = (Uint8 *)mTarget->pixels + y1 * mTarget->pitch + x * bpp; + Uint8 *p = static_cast<Uint8*>(mTarget->pixels) + + y1 * mTarget->pitch + x * bpp; Uint32 pixel = SDL_MapRGB(mTarget->format, mColor.r, mColor.g, mColor.b); @@ -411,9 +413,9 @@ namespace gcn break; case 2: - for (; y1 <= y2; ++y1) + for (; y1 <= y2; ++ y1) { - *(Uint16*)p = pixel; + *reinterpret_cast<Uint16*>(p) = pixel; p += mTarget->pitch; } break; @@ -445,9 +447,14 @@ namespace gcn for (; y1 <= y2; ++y1) { if (mAlpha) - *(Uint32*)p = SDLAlpha32(pixel, *(Uint32*)p, mColor.a); + { + *reinterpret_cast<Uint32*>(p) = SDLAlpha32(pixel, + *reinterpret_cast<Uint32*>(p), mColor.a); + } else - *(Uint32*)p = pixel; + { + *reinterpret_cast<Uint32*>(p) = pixel; + } p += mTarget->pitch; } break; diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp index 4f9b9565c..cf8505c4e 100644 --- a/src/guichan/sdl/sdlimage.cpp +++ b/src/guichan/sdl/sdlimage.cpp @@ -142,8 +142,8 @@ namespace gcn { Uint8 r, g, b, a; - SDL_GetRGBA(((unsigned int*)mSurface->pixels)[i], mSurface->format, - &r, &g, &b, &a); + SDL_GetRGBA((static_cast<unsigned int*>(mSurface->pixels)[i]), + mSurface->format, &r, &g, &b, &a); if (a != 255) { |