summaryrefslogtreecommitdiff
path: root/src/guichan/sdl/sdlgraphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guichan/sdl/sdlgraphics.cpp')
-rw-r--r--src/guichan/sdl/sdlgraphics.cpp23
1 files changed, 15 insertions, 8 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;