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/graphics.cpp | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src/graphics.cpp') diff --git a/src/graphics.cpp b/src/graphics.cpp index a082c5e4b..3693666ea 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -408,8 +408,8 @@ bool Graphics::drawRescaledImage(Image *image, int srcX, int srcY, dstRect.y = static_cast(dstY); srcRect.x = static_cast(srcX); srcRect.y = static_cast(srcY); - srcRect.w = static_cast(width); - srcRect.h = static_cast(height); + srcRect.w = static_cast(width); + srcRect.h = static_cast(height); returnValue = !(SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mTarget, &dstRect) < 0); @@ -438,8 +438,8 @@ bool Graphics::drawImage(const Image *image, int srcX, int srcY, dstRect.y = static_cast(dstY); srcRect.x = static_cast(srcX); srcRect.y = static_cast(srcY); - srcRect.w = static_cast(width); - srcRect.h = static_cast(height); + srcRect.w = static_cast(width); + srcRect.h = static_cast(height); if (mBlitMode == BLIT_NORMAL) { @@ -485,8 +485,8 @@ void Graphics::drawImagePattern(const Image *image, int x, int y, int w, int h) dstRect.y = static_cast(dstY); srcRect.x = static_cast(srcX); srcRect.y = static_cast(srcY); - srcRect.w = static_cast(dw); - srcRect.h = static_cast(dh); + srcRect.w = static_cast(dw); + srcRect.h = static_cast(dh); SDL_BlitSurface(image->mSDLSurface, &srcRect, mTarget, &dstRect); } @@ -534,8 +534,8 @@ void Graphics::drawRescaledImagePattern(Image *image, int x, int y, dstRect.y = static_cast(dstY); srcRect.x = static_cast(srcX); srcRect.y = static_cast(srcY); - srcRect.w = static_cast(dw); - srcRect.h = static_cast(dh); + srcRect.w = static_cast(dw); + srcRect.h = static_cast(dh); SDL_BlitSurface(tmpImage->mSDLSurface, &srcRect, mTarget, &dstRect); @@ -760,8 +760,8 @@ void Graphics::calcImagePattern(GraphicsVertexes* vert, dstRect.y = static_cast(dstY); srcRect.x = static_cast(srcX); srcRect.y = static_cast(srcY); - srcRect.w = static_cast(dw); - srcRect.h = static_cast(dh); + srcRect.w = static_cast(dw); + srcRect.h = static_cast(dh); if (SDL_FakeUpperBlit(image->mSDLSurface, &srcRect, mTarget, &dstRect) == 1) @@ -790,8 +790,8 @@ void Graphics::calcTile(ImageVertexes *vert, int x, int y) rect->dst.y = static_cast(y); rect->src.x = static_cast(image->mBounds.x); rect->src.y = static_cast(image->mBounds.y); - rect->src.w = static_cast(image->mBounds.w); - rect->src.h = static_cast(image->mBounds.h); + rect->src.w = static_cast(image->mBounds.w); + rect->src.h = static_cast(image->mBounds.h); if (SDL_FakeUpperBlit(image->mSDLSurface, &rect->src, mTarget, &rect->dst) == 1) { @@ -1000,7 +1000,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) SDL_LockSurface(mTarget); const int bpp = mTarget->format->BytesPerPixel; - Uint32 pixel = SDL_MapRGB(mTarget->format, + uint32_t pixel = SDL_MapRGB(mTarget->format, mColor.r, mColor.g, mColor.b); switch (bpp) @@ -1008,7 +1008,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) case 1: for (y = y1; y < y2; y++) { - Uint8 *p = static_cast(mTarget->pixels) + uint8_t *p = static_cast(mTarget->pixels) + y * mTarget->pitch; for (x = x1; x < x2; x++) *(p + x) = pixel; @@ -1017,13 +1017,13 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) case 2: for (y = y1; y < y2; y++) { - Uint8 *p0 = static_cast(mTarget->pixels) + uint8_t *p0 = static_cast(mTarget->pixels) + y * mTarget->pitch; for (x = x1; x < x2; x++) { - Uint8 *p = p0 + x * 2; - *reinterpret_cast(p) = gcn::SDLAlpha16( - pixel, *reinterpret_cast(p), + uint8_t *p = p0 + x * 2; + *reinterpret_cast(p) = gcn::SDLAlpha16( + pixel, *reinterpret_cast(p), mColor.a, mTarget->format); } } @@ -1037,11 +1037,11 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) for (y = y1; y < y2; y++) { - Uint8 *p0 = static_cast(mTarget->pixels) + uint8_t *p0 = static_cast(mTarget->pixels) + y * mTarget->pitch; for (x = x1; x < x2; x++) { - Uint8 *p = p0 + x * 3; + uint8_t *p = p0 + x * 3; #if SDL_BYTEORDER == SDL_BIG_ENDIAN p[2] = (p[2] * ca + cb) >> 8; p[1] = (p[1] * ca + cg) >> 8; @@ -1065,18 +1065,18 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) for (y = y1; y < y2; y++) { - Uint8 *p0 = static_cast(mTarget->pixels) + uint8_t *p0 = static_cast(mTarget->pixels) + y * mTarget->pitch; for (x = x1; x < x2; x++) { - Uint8 *p = p0 + x * 4; - Uint32 dst = *reinterpret_cast(p); + uint8_t *p = p0 + x * 4; + uint32_t dst = *reinterpret_cast(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; - *reinterpret_cast(p) = ((b & 0xff) + *reinterpret_cast(p) = ((b & 0xff) | (g & 0xff00) | (r & 0xff0000)); } } @@ -1113,12 +1113,12 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) for (y = y1; y < y2; y++) { - Uint32 *p0 = reinterpret_cast(static_cast( + uint32_t *p0 = reinterpret_cast(static_cast( mTarget->pixels) + y * mTarget->pitch); for (x = x1; x < x2; x++) { - Uint32 *p = p0 + x; - const Uint32 dst = *p; + uint32_t *p = p0 + x; + const uint32_t dst = *p; *p = cB[dst & 0xff] | cG[(dst & 0xff00) >> 8] | cR[(dst & 0xff0000) >> 16]; } @@ -1140,7 +1140,7 @@ void Graphics::fillRectangle(const gcn::Rectangle& rectangle) rect.w = area.width; rect.h = area.height; - Uint32 color = SDL_MapRGBA(mTarget->format, + uint32_t color = SDL_MapRGBA(mTarget->format, mColor.r, mColor.g, mColor.b, mColor.a); SDL_FillRect(mTarget, &rect, color); } -- cgit v1.2.3-60-g2f50