diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-25 21:28:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-25 21:46:40 +0300 |
commit | 81db0022e50e25d922ac7d67d9ec6017b8856f13 (patch) | |
tree | 0ead8c5df5b8eb00cbe5e07e2f7dc36170786846 /src/graphics.cpp | |
parent | 6317f3e0c1e2c6d2e88dd99443e7f45f7bb77f44 (diff) | |
download | manaverse-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.gz manaverse-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.bz2 manaverse-81db0022e50e25d922ac7d67d9ec6017b8856f13.tar.xz manaverse-81db0022e50e25d922ac7d67d9ec6017b8856f13.zip |
Fix old casts.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 5241bbcc6..e6841fa5c 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -845,7 +845,8 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) case 1: for (y = y1; y < y2; y++) { - Uint8 *p = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p = static_cast<Uint8 *>(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) *(p + x) = pixel; } @@ -853,12 +854,14 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) case 2: for (y = y1; y < y2; y++) { - Uint8 *p0 = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p0 = static_cast<Uint8 *>(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) { Uint8 *p = p0 + x * 2; - *(Uint16 *)p = gcn::SDLAlpha16( - pixel, *(Uint32 *)p, mColor.a, mTarget->format); + *reinterpret_cast<Uint16 *>(p) = gcn::SDLAlpha16( + pixel, *reinterpret_cast<Uint32 *>(p), + mColor.a, mTarget->format); } } break; @@ -871,7 +874,8 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) for (y = y1; y < y2; y++) { - Uint8 *p0 = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p0 = static_cast<Uint8 *>(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) { Uint8 *p = p0 + x * 3; @@ -896,18 +900,19 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) const unsigned a1 = (255 - mColor.a); for (y = y1; y < y2; y++) { - Uint8 *p0 = (Uint8 *)mTarget->pixels + y * mTarget->pitch; + Uint8 *p0 = static_cast<Uint8 *>(mTarget->pixels) + + y * mTarget->pitch; for (x = x1; x < x2; x++) { Uint8 *p = p0 + x * 4; - Uint32 dst = *(Uint32 *)p; + Uint32 dst = *reinterpret_cast<Uint32 *>(p); const unsigned int b = (pb + (dst & 0xff) * a1) >> 8; const unsigned int g = (pg + (dst & 0xff00) * a1) >> 8; const unsigned int r = (pr + (dst & 0xff0000) * a1) >> 8; - *(Uint32 *)p = ((b & 0xff) | (g & 0xff00) - | (r & 0xff0000)); + *reinterpret_cast<Uint32 *>(p) = ((b & 0xff) + | (g & 0xff00) | (r & 0xff0000)); } } break; |