diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-07 16:18:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-07 16:18:13 +0300 |
commit | 9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch) | |
tree | 798117abd4dc7e610997d59d530a96ddc1509f53 /src/render/sdlgraphics.cpp | |
parent | 4429cb14e9e187edef27aba692a4266733f79c17 (diff) | |
download | mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2 mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz mv-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip |
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/render/sdlgraphics.cpp')
-rw-r--r-- | src/render/sdlgraphics.cpp | 282 |
1 files changed, 141 insertions, 141 deletions
diff --git a/src/render/sdlgraphics.cpp b/src/render/sdlgraphics.cpp index 3e71937c6..0043d1ccc 100644 --- a/src/render/sdlgraphics.cpp +++ b/src/render/sdlgraphics.cpp @@ -78,16 +78,16 @@ void SDLGraphics::drawRescaledImage(const Image *restrict const image, SDL_Rect srcRect = { - static_cast<int16_t>(bounds.x), - static_cast<int16_t>(bounds.y), - static_cast<uint16_t>(bounds.w), - static_cast<uint16_t>(bounds.h) + CAST_S16(bounds.x), + CAST_S16(bounds.y), + CAST_U16(bounds.w), + CAST_U16(bounds.h) }; SDL_Rect dstRect = { - static_cast<int16_t>(dstX + top.xOffset), - static_cast<int16_t>(dstY + top.yOffset), + CAST_S16(dstX + top.xOffset), + CAST_S16(dstY + top.yOffset), 0, 0 }; @@ -125,7 +125,7 @@ void SDLGraphics::drawImageInline(const Image *restrict const image, if (srcX < 0) { w += srcX; - dstX -= static_cast<int16_t>(srcX); + dstX -= CAST_S16(srcX); srcX = 0; } const int maxw = src->w - srcX; @@ -135,7 +135,7 @@ void SDLGraphics::drawImageInline(const Image *restrict const image, if (srcY < 0) { h += srcY; - dstY -= static_cast<int16_t>(srcY); + dstY -= CAST_S16(srcY); srcY = 0; } const int maxh = src->h - srcY; @@ -149,7 +149,7 @@ void SDLGraphics::drawImageInline(const Image *restrict const image, if (dx > 0) { w -= dx; - dstX += static_cast<int16_t>(dx); + dstX += CAST_S16(dx); srcX += dx; } dx = dstX + w - clipX - clip->w; @@ -160,7 +160,7 @@ void SDLGraphics::drawImageInline(const Image *restrict const image, if (dy > 0) { h -= dy; - dstY += static_cast<int16_t>(dy); + dstY += CAST_S16(dy); srcY += dy; } dy = dstY + h - clipY - clip->h; @@ -171,18 +171,18 @@ void SDLGraphics::drawImageInline(const Image *restrict const image, { SDL_Rect srcRect = { - static_cast<int16_t>(srcX), - static_cast<int16_t>(srcY), - static_cast<uint16_t>(w), - static_cast<uint16_t>(h) + CAST_S16(srcX), + CAST_S16(srcY), + CAST_U16(w), + CAST_U16(h) }; SDL_Rect dstRect = { - static_cast<int16_t>(dstX), - static_cast<int16_t>(dstY), - static_cast<uint16_t>(w), - static_cast<uint16_t>(h) + CAST_S16(dstX), + CAST_S16(dstY), + CAST_U16(w), + CAST_U16(h) }; SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); @@ -218,7 +218,7 @@ void SDLGraphics::drawImageCached(const Image *restrict const image, if (srcX < 0) { w += srcX; - x -= static_cast<int16_t>(srcX); + x -= CAST_S16(srcX); srcX = 0; } const int maxw = src->w - srcX; @@ -228,7 +228,7 @@ void SDLGraphics::drawImageCached(const Image *restrict const image, if (srcY < 0) { h += srcY; - y -= static_cast<int16_t>(srcY); + y -= CAST_S16(srcY); srcY = 0; } const int maxh = src->h - srcY; @@ -242,7 +242,7 @@ void SDLGraphics::drawImageCached(const Image *restrict const image, if (dx > 0) { w -= dx; - x += static_cast<int16_t>(dx); + x += CAST_S16(dx); srcX += dx; } dx = x + w - clipX - clip->w; @@ -253,7 +253,7 @@ void SDLGraphics::drawImageCached(const Image *restrict const image, if (dy > 0) { h -= dy; - y += static_cast<int16_t>(dy); + y += CAST_S16(dy); srcY += dy; } dy = y + h - clipY - clip->h; @@ -264,18 +264,18 @@ void SDLGraphics::drawImageCached(const Image *restrict const image, { SDL_Rect srcRect = { - static_cast<int16_t>(srcX), - static_cast<int16_t>(srcY), - static_cast<uint16_t>(w), - static_cast<uint16_t>(h) + CAST_S16(srcX), + CAST_S16(srcY), + CAST_U16(w), + CAST_U16(h) }; SDL_Rect dstRect = { - static_cast<int16_t>(x), - static_cast<int16_t>(y), - static_cast<uint16_t>(w), - static_cast<uint16_t>(h) + CAST_S16(x), + CAST_S16(y), + CAST_U16(w), + CAST_U16(h) }; SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); @@ -318,7 +318,7 @@ void SDLGraphics::drawPatternCached(const Image *restrict const image, if (y2 < 0) { h2 += y2; - dstY -= static_cast<int16_t>(y2); + dstY -= CAST_S16(y2); y2 = 0; } const int maxh = src->h - y2; @@ -329,7 +329,7 @@ void SDLGraphics::drawPatternCached(const Image *restrict const image, if (dy > 0) { h2 -= dy; - dstY += static_cast<int16_t>(dy); + dstY += CAST_S16(dy); y2 += dy; } dy = dstY + h2 - clipY - clip->h; @@ -347,7 +347,7 @@ void SDLGraphics::drawPatternCached(const Image *restrict const image, if (x2 < 0) { w2 += x2; - dstX -= static_cast<int16_t>(x2); + dstX -= CAST_S16(x2); x2 = 0; } const int maxw = src->w - x2; @@ -358,7 +358,7 @@ void SDLGraphics::drawPatternCached(const Image *restrict const image, if (dx > 0) { w2 -= dx; - dstX += static_cast<int16_t>(dx); + dstX += CAST_S16(dx); x2 += dx; } dx = dstX + w2 - clipX - clip->w; @@ -369,18 +369,18 @@ void SDLGraphics::drawPatternCached(const Image *restrict const image, { SDL_Rect srcRect = { - static_cast<int16_t>(x2), - static_cast<int16_t>(y2), - static_cast<uint16_t>(w2), - static_cast<uint16_t>(h2) + CAST_S16(x2), + CAST_S16(y2), + CAST_U16(w2), + CAST_U16(h2) }; SDL_Rect dstRect = { - static_cast<int16_t>(dstX), - static_cast<int16_t>(dstY), - static_cast<uint16_t>(w2), - static_cast<uint16_t>(h2) + CAST_S16(dstX), + CAST_S16(dstY), + CAST_U16(w2), + CAST_U16(h2) }; SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); @@ -439,7 +439,7 @@ void SDLGraphics::drawPatternInline(const Image *restrict const image, if (y2 < 0) { h2 += y2; - dstY -= static_cast<int16_t>(y2); + dstY -= CAST_S16(y2); y2 = 0; } const int maxh = src->h - y2; @@ -450,7 +450,7 @@ void SDLGraphics::drawPatternInline(const Image *restrict const image, if (dy > 0) { h2 -= dy; - dstY += static_cast<int16_t>(dy); + dstY += CAST_S16(dy); y2 += dy; } dy = dstY + h2 - clipY - clip->h; @@ -468,7 +468,7 @@ void SDLGraphics::drawPatternInline(const Image *restrict const image, if (x2 < 0) { w2 += x2; - dstX -= static_cast<int16_t>(x2); + dstX -= CAST_S16(x2); x2 = 0; } const int maxw = src->w - x2; @@ -479,7 +479,7 @@ void SDLGraphics::drawPatternInline(const Image *restrict const image, if (dx > 0) { w2 -= dx; - dstX += static_cast<int16_t>(dx); + dstX += CAST_S16(dx); x2 += dx; } dx = dstX + w2 - clipX - clip->w; @@ -490,18 +490,18 @@ void SDLGraphics::drawPatternInline(const Image *restrict const image, { SDL_Rect srcRect = { - static_cast<int16_t>(x2), - static_cast<int16_t>(y2), - static_cast<uint16_t>(w2), - static_cast<uint16_t>(h2) + CAST_S16(x2), + CAST_S16(y2), + CAST_U16(w2), + CAST_U16(h2) }; SDL_Rect dstRect = { - static_cast<int16_t>(dstX), - static_cast<int16_t>(dstY), - static_cast<uint16_t>(w2), - static_cast<uint16_t>(h2) + CAST_S16(dstX), + CAST_S16(dstY), + CAST_U16(w2), + CAST_U16(h2) }; SDL_LowerBlit(src, &srcRect, mWindow, &dstRect); @@ -557,16 +557,16 @@ void SDLGraphics::drawRescaledPattern(const Image *restrict const image, SDL_Rect srcRect = { - static_cast<int16_t>(srcX), - static_cast<int16_t>(srcY), - static_cast<uint16_t>(dw), - static_cast<uint16_t>(dh) + CAST_S16(srcX), + CAST_S16(srcY), + CAST_U16(dw), + CAST_U16(dh) }; SDL_Rect dstRect = { - static_cast<int16_t>(dstX), - static_cast<int16_t>(dstY), + CAST_S16(dstX), + CAST_S16(dstY), 0, 0 }; @@ -620,13 +620,13 @@ void SDLGraphics::calcPatternInline(ImageVertexes *restrict const vert, DoubleRect *const r = new DoubleRect(); SDL_Rect &srcRect = r->src; - srcRect.x = static_cast<int16_t>(srcX); - srcRect.y = static_cast<int16_t>(srcY); - srcRect.w = static_cast<uint16_t>(dw); - srcRect.h = static_cast<uint16_t>(dh); + srcRect.x = CAST_S16(srcX); + srcRect.y = CAST_S16(srcY); + srcRect.w = CAST_U16(dw); + srcRect.h = CAST_U16(dh); SDL_Rect &dstRect = r->dst; - dstRect.x = static_cast<int16_t>(dstX); - dstRect.y = static_cast<int16_t>(dstY); + dstRect.x = CAST_S16(dstX); + dstRect.y = CAST_S16(dstY); if (SDL_FakeUpperBlit(image->mSDLSurface, &srcRect, mWindow, &dstRect) == 1) @@ -698,12 +698,12 @@ void SDLGraphics::calcTileSDL(ImageVertexes *restrict const vert, const SDL_Rect &bounds = image->mBounds; DoubleRect *rect = new DoubleRect(); - rect->src.x = static_cast<int16_t>(bounds.x); - rect->src.y = static_cast<int16_t>(bounds.y); - rect->src.w = static_cast<uint16_t>(bounds.w); - rect->src.h = static_cast<uint16_t>(bounds.h); - rect->dst.x = static_cast<int16_t>(x + top.xOffset); - rect->dst.y = static_cast<int16_t>(y + top.yOffset); + rect->src.x = CAST_S16(bounds.x); + rect->src.y = CAST_S16(bounds.y); + rect->src.w = CAST_U16(bounds.w); + rect->src.h = CAST_U16(bounds.h); + rect->dst.x = CAST_S16(x + top.xOffset); + rect->dst.y = CAST_S16(y + top.yOffset); if (SDL_FakeUpperBlit(image->mSDLSurface, &rect->src, mWindow, &rect->dst) == 1) { @@ -837,7 +837,7 @@ int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src, if (srcx < 0) { w += srcx; - dstrect->x -= static_cast<int16_t>(srcx); + dstrect->x -= CAST_S16(srcx); srcx = 0; } int maxw = src->w - srcx; @@ -849,7 +849,7 @@ int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src, if (srcy < 0) { h += srcy; - dstrect->y -= static_cast<int16_t>(srcy); + dstrect->y -= CAST_S16(srcy); srcy = 0; } int maxh = src->h - srcy; @@ -863,7 +863,7 @@ int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src, if (dx > 0) { w -= dx; - dstrect->x += static_cast<int16_t>(dx); + dstrect->x += CAST_S16(dx); srcx += dx; } dx = dstrect->x + w - clipX - clip->w; @@ -874,7 +874,7 @@ int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src, if (dy > 0) { h -= dy; - dstrect->y += static_cast<int16_t>(dy); + dstrect->y += CAST_S16(dy); srcy += dy; } dy = dstrect->y + h - clipY - clip->h; @@ -883,12 +883,12 @@ int SDLGraphics::SDL_FakeUpperBlit(const SDL_Surface *restrict const src, if (w > 0 && h > 0) { - srcrect->x = static_cast<int16_t>(srcx); - srcrect->y = static_cast<int16_t>(srcy); - srcrect->w = static_cast<int16_t>(w); - srcrect->h = static_cast<int16_t>(h); - dstrect->w = static_cast<int16_t>(w); - dstrect->h = static_cast<int16_t>(h); + srcrect->x = CAST_S16(srcx); + srcrect->y = CAST_S16(srcy); + srcrect->w = CAST_S16(w); + srcrect->h = CAST_S16(h); + dstrect->w = CAST_S16(w); + dstrect->h = CAST_S16(h); return 1; // return SDL_LowerBlit(src, &sr, dst, dstrect); @@ -925,8 +925,8 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 const int bpp = mWindow->format->BytesPerPixel; const uint32_t pixel = SDL_MapRGB(mWindow->format, - static_cast<uint8_t>(mColor.r), static_cast<uint8_t>(mColor.g), - static_cast<uint8_t>(mColor.b)); + CAST_U8(mColor.r), CAST_U8(mColor.g), + CAST_U8(mColor.b)); switch (bpp) { @@ -934,11 +934,11 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 cilk_for (int y = y1; y < y2; y++) { uint8_t *const p = static_cast<uint8_t *>(mWindow->pixels) - + static_cast<size_t>(y * mWindow->pitch); + + CAST_SIZE(y * mWindow->pitch); for (int x = x1; x < x2; x++) { - *(p + static_cast<size_t>(x)) - = static_cast<uint8_t>(pixel); + *(p + CAST_SIZE(x)) + = CAST_U8(pixel); } } break; @@ -946,14 +946,14 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 cilk_for (int y = y1; y < y2; y++) { uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels) - + static_cast<size_t>(y * mWindow->pitch); + + CAST_SIZE(y * mWindow->pitch); for (int x = x1; x < x2; x++) { - uint8_t *const p = p0 + static_cast<size_t>(x * 2); + uint8_t *const p = p0 + CAST_SIZE(x * 2); *reinterpret_cast<uint16_t *>(p) = SDLAlpha16( - static_cast<uint16_t>(pixel), + CAST_U16(pixel), *reinterpret_cast<uint16_t *>(p), - static_cast<uint8_t>(mColor.a), mWindow->format); + CAST_U8(mColor.a), mWindow->format); } } break; @@ -967,18 +967,18 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 cilk_for (int y = y1; y < y2; y++) { uint8_t *const p0 = static_cast<uint8_t *>(mWindow->pixels) - + static_cast<size_t>(y * mWindow->pitch); + + CAST_SIZE(y * mWindow->pitch); for (int x = x1; x < x2; x++) { - uint8_t *const p = p0 + static_cast<size_t>(x * 3); + uint8_t *const p = p0 + CAST_SIZE(x * 3); #if SDL_BYTEORDER == SDL_BIG_ENDIAN - p[2] = static_cast<uint8_t>((p[2] * ca + cb) >> 8); - p[1] = static_cast<uint8_t>((p[1] * ca + cg) >> 8); - p[0] = static_cast<uint8_t>((p[0] * ca + cr) >> 8); + p[2] = CAST_U8((p[2] * ca + cb) >> 8); + p[1] = CAST_U8((p[1] * ca + cg) >> 8); + p[0] = CAST_U8((p[0] * ca + cr) >> 8); #else - p[0] = static_cast<uint8_t>((p[0] * ca + cb) >> 8); - p[1] = static_cast<uint8_t>((p[1] * ca + cg) >> 8); - p[2] = static_cast<uint8_t>((p[2] * ca + cr) >> 8); + p[0] = CAST_U8((p[0] * ca + cb) >> 8); + p[1] = CAST_U8((p[1] * ca + cg) >> 8); + p[2] = CAST_U8((p[2] * ca + cr) >> 8); #endif } } @@ -1059,10 +1059,10 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 { uint32_t *const p0 = reinterpret_cast<uint32_t*>( static_cast<uint8_t*>(mWindow->pixels) - + static_cast<size_t>(y * mWindow->pitch)); + + CAST_SIZE(y * mWindow->pitch)); for (int x = x1; x < x2; x++) { - uint32_t *const p = p0 + static_cast<size_t>(x); + uint32_t *const p = p0 + CAST_SIZE(x); const uint32_t dst = *p; *p = cB[dst & bMask / bShift] | cG[(dst & gMask) / gShift] @@ -1082,17 +1082,17 @@ void SDLGraphics::fillRectangle(const Rect &restrict rectangle) restrict2 { SDL_Rect rect = { - static_cast<int16_t>(area.x), - static_cast<int16_t>(area.y), - static_cast<uint16_t>(area.width), - static_cast<uint16_t>(area.height) + CAST_S16(area.x), + CAST_S16(area.y), + CAST_U16(area.width), + CAST_U16(area.height) }; const uint32_t color = SDL_MapRGBA(mWindow->format, - static_cast<int8_t>(mColor.r), - static_cast<int8_t>(mColor.g), - static_cast<int8_t>(mColor.b), - static_cast<int8_t>(mColor.a)); + CAST_S8(mColor.r), + CAST_S8(mColor.g), + CAST_S8(mColor.b), + CAST_S8(mColor.a)); SDL_FillRect(mWindow, &rect, color); } } @@ -1113,10 +1113,10 @@ void SDLGraphics::pushClipArea(const Rect &restrict area) restrict2 const ClipRect &restrict carea = mClipStack.top(); const SDL_Rect rect = { - static_cast<int16_t>(carea.x), - static_cast<int16_t>(carea.y), - static_cast<uint16_t>(carea.width), - static_cast<uint16_t>(carea.height) + CAST_S16(carea.x), + CAST_S16(carea.y), + CAST_U16(carea.width), + CAST_U16(carea.height) }; SDL_SetClipRect(mWindow, &rect); } @@ -1131,10 +1131,10 @@ void SDLGraphics::popClipArea() restrict2 const ClipRect &restrict carea = mClipStack.top(); const SDL_Rect rect = { - static_cast<int16_t>(carea.x), - static_cast<int16_t>(carea.y), - static_cast<uint16_t>(carea.width), - static_cast<uint16_t>(carea.height) + CAST_S16(carea.x), + CAST_S16(carea.y), + CAST_U16(carea.width), + CAST_U16(carea.height) }; SDL_SetClipRect(mWindow, &rect); @@ -1205,23 +1205,23 @@ void SDLGraphics::drawHLine(int x1, int y, int x2) restrict2 SDL_LockSurface(mWindow); uint8_t *p = static_cast<uint8_t*>(mWindow->pixels) - + static_cast<size_t>(y * mWindow->pitch + x1 * bpp); + + CAST_SIZE(y * mWindow->pitch + x1 * bpp); const uint32_t pixel = SDL_MapRGB(mWindow->format, - static_cast<uint8_t>(mColor.r), - static_cast<uint8_t>(mColor.g), - static_cast<uint8_t>(mColor.b)); + CAST_U8(mColor.r), + CAST_U8(mColor.g), + CAST_U8(mColor.b)); switch (bpp) { case 1: for (; x1 <= x2; ++x1) - *(p++) = static_cast<uint8_t>(pixel); + *(p++) = CAST_U8(pixel); break; case 2: { uint16_t* q = reinterpret_cast<uint16_t*>(p); - const uint16_t pixel1 = static_cast<uint16_t>(pixel); + const uint16_t pixel1 = CAST_U16(pixel); for (; x1 <= x2; ++x1) *(q++) = pixel1; break; @@ -1229,9 +1229,9 @@ void SDLGraphics::drawHLine(int x1, int y, int x2) restrict2 case 3: { - const uint8_t b0 = static_cast<uint8_t>((pixel >> 16) & 0xff); - const uint8_t b1 = static_cast<uint8_t>((pixel >> 8) & 0xff); - const uint8_t b2 = static_cast<uint8_t>(pixel & 0xff); + const uint8_t b0 = CAST_U8((pixel >> 16) & 0xff); + const uint8_t b1 = CAST_U8((pixel >> 8) & 0xff); + const uint8_t b2 = CAST_U8(pixel & 0xff); #if SDL_BYTEORDER == SDL_BIG_ENDIAN for (; x1 <= x2; ++x1) { @@ -1257,8 +1257,8 @@ void SDLGraphics::drawHLine(int x1, int y, int x2) restrict2 uint32_t *q = reinterpret_cast<uint32_t*>(p); if (mAlpha) { - unsigned char a = static_cast<unsigned char>(mColor.a); - unsigned char a1 = static_cast<unsigned char>(255U - a); + unsigned char a = CAST_U8(mColor.a); + unsigned char a1 = CAST_U8(255U - a); const int b0 = (pixel & 0xff) * a; const int g0 = (pixel & 0xff00) * a; const int r0 = (pixel & 0xff0000) * a; @@ -1330,12 +1330,12 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2 SDL_LockSurface(mWindow); uint8_t *p = static_cast<uint8_t*>(mWindow->pixels) - + static_cast<size_t>(y1 * mWindow->pitch + x * bpp); + + CAST_SIZE(y1 * mWindow->pitch + x * bpp); const uint32_t pixel = SDL_MapRGB(mWindow->format, - static_cast<uint8_t>(mColor.r), - static_cast<uint8_t>(mColor.g), - static_cast<uint8_t>(mColor.b)); + CAST_U8(mColor.r), + CAST_U8(mColor.g), + CAST_U8(mColor.b)); const int pitch = mWindow->pitch; switch (bpp) @@ -1343,7 +1343,7 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2 case 1: for (; y1 <= y2; ++y1) { - *p = static_cast<uint8_t>(pixel); + *p = CAST_U8(pixel); p += pitch; } break; @@ -1352,16 +1352,16 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2 for (; y1 <= y2; ++ y1) { *reinterpret_cast<uint16_t*>(p) - = static_cast<uint16_t>(pixel); + = CAST_U16(pixel); p += pitch; } break; case 3: { - const uint8_t b0 = static_cast<uint8_t>((pixel >> 16) & 0xff); - const uint8_t b1 = static_cast<uint8_t>((pixel >> 8) & 0xff); - const uint8_t b2 = static_cast<uint8_t>(pixel & 0xff); + const uint8_t b0 = CAST_U8((pixel >> 16) & 0xff); + const uint8_t b1 = CAST_U8((pixel >> 8) & 0xff); + const uint8_t b2 = CAST_U8(pixel & 0xff); #if SDL_BYTEORDER == SDL_BIG_ENDIAN for (; y1 <= y2; ++y1) { @@ -1386,8 +1386,8 @@ void SDLGraphics::drawVLine(int x, int y1, int y2) restrict2 { if (mAlpha) { - unsigned char a = static_cast<unsigned char>(mColor.a); - unsigned char a1 = static_cast<unsigned char>(255U - a); + unsigned char a = CAST_U8(mColor.a); + unsigned char a1 = CAST_U8(255U - a); const int b0 = (pixel & 0xff) * a; const int g0 = (pixel & 0xff00) * a; const int r0 = (pixel & 0xff0000) * a; @@ -1470,8 +1470,8 @@ bool SDLGraphics::setVideoMode(const int w, const int h, return false; } - mRect.w = static_cast<uint16_t>(mWindow->w); - mRect.h = static_cast<uint16_t>(mWindow->h); + mRect.w = CAST_U16(mWindow->w); + mRect.h = CAST_U16(mWindow->h); return videoInfo(); } |