From 454508376039429ad292de69cd491badda798062 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 May 2014 22:47:46 +0300 Subject: Fix code style in render. --- src/render/sdlgraphics.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/render/sdlgraphics.cpp') diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 9b852689d..8720b4dc9 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -952,19 +952,22 @@ void SDLGraphics::fillRectangle(const Rect& rectangle) for (y = y1; y < y2; y++) { uint8_t *const p = static_cast(mWindow->pixels) - + y * mWindow->pitch; + + static_cast(y * mWindow->pitch); for (x = x1; x < x2; x++) - *(p + x) = static_cast(pixel); + { + *(p + static_cast(x)) + = static_cast(pixel); + } } break; case 2: for (y = y1; y < y2; y++) { uint8_t *const p0 = static_cast(mWindow->pixels) - + y * mWindow->pitch; + + static_cast(y * mWindow->pitch); for (x = x1; x < x2; x++) { - uint8_t *const p = p0 + x * 2; + uint8_t *const p = p0 + static_cast(x * 2); *reinterpret_cast(p) = SDLAlpha16( static_cast(pixel), *reinterpret_cast(p), @@ -982,10 +985,10 @@ void SDLGraphics::fillRectangle(const Rect& rectangle) for (y = y1; y < y2; y++) { uint8_t *const p0 = static_cast(mWindow->pixels) - + y * mWindow->pitch; + + static_cast(y * mWindow->pitch); for (x = x1; x < x2; x++) { - uint8_t *const p = p0 + x * 3; + uint8_t *const p = p0 + static_cast(x * 3); #if SDL_BYTEORDER == SDL_BIG_ENDIAN p[2] = static_cast((p[2] * ca + cb) >> 8); p[1] = static_cast((p[1] * ca + cg) >> 8); @@ -1074,10 +1077,10 @@ void SDLGraphics::fillRectangle(const Rect& rectangle) { uint32_t *const p0 = reinterpret_cast( static_cast(mWindow->pixels) - + y * mWindow->pitch); + + static_cast(y * mWindow->pitch)); for (x = x1; x < x2; x++) { - uint32_t *const p = p0 + x; + uint32_t *const p = p0 + static_cast(x); const uint32_t dst = *p; *p = cB[dst & bMask / bShift] | cG[(dst & gMask) / gShift] @@ -1222,7 +1225,7 @@ void SDLGraphics::drawHLine(int x1, int y, int x2) SDL_LockSurface(mWindow); uint8_t *p = static_cast(mWindow->pixels) - + y * mWindow->pitch + x1 * bpp; + + static_cast(y * mWindow->pitch + x1 * bpp); const uint32_t pixel = SDL_MapRGB(mWindow->format, static_cast(mColor.r), @@ -1347,7 +1350,7 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) SDL_LockSurface(mWindow); uint8_t *p = static_cast(mWindow->pixels) - + y1 * mWindow->pitch + x * bpp; + + static_cast(y1 * mWindow->pitch + x * bpp); const uint32_t pixel = SDL_MapRGB(mWindow->format, static_cast(mColor.r), -- cgit v1.2.3-60-g2f50