summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-07 16:18:13 +0300
commit9fe21fcd8883b37bdc30224822e6e42afb35b8f0 (patch)
tree798117abd4dc7e610997d59d530a96ddc1509f53 /src/resources/image.cpp
parent4429cb14e9e187edef27aba692a4266733f79c17 (diff)
downloadmanaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.gz
manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.bz2
manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.tar.xz
manaplus-9fe21fcd8883b37bdc30224822e6e42afb35b8f0.zip
Replace most static_cast<Type> to shorter versions from defines.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index b16ea8939..d820adcfb 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -72,8 +72,8 @@ Image::Image(SDL_Texture *restrict const image,
if (mTexture)
{
- mBounds.w = static_cast<uint16_t>(width);
- mBounds.h = static_cast<uint16_t>(height);
+ mBounds.w = CAST_U16(width);
+ mBounds.h = CAST_U16(height);
mLoaded = true;
}
@@ -118,8 +118,8 @@ Image::Image(SDL_Surface *restrict const image, const bool hasAlphaChannel0,
if (mSDLSurface)
{
- mBounds.w = static_cast<uint16_t>(mSDLSurface->w);
- mBounds.h = static_cast<uint16_t>(mSDLSurface->h);
+ mBounds.w = CAST_U16(mSDLSurface->w);
+ mBounds.h = CAST_U16(mSDLSurface->h);
mLoaded = true;
}
@@ -159,8 +159,8 @@ Image::Image(const GLuint glimage, const int width, const int height,
mBounds.x = 0;
mBounds.y = 0;
- mBounds.w = static_cast<uint16_t>(width);
- mBounds.h = static_cast<uint16_t>(height);
+ mBounds.w = CAST_U16(width);
+ mBounds.h = CAST_U16(height);
if (mGLImage)
{
@@ -314,11 +314,11 @@ void Image::setAlpha(const float alpha)
{
#ifdef USE_SDL2
SDL_SetSurfaceAlphaMod(mSDLSurface,
- static_cast<unsigned char>(255 * mAlpha));
+ CAST_U8(255 * mAlpha));
#else
// Set the alpha value this image is drawn at
SDL_SetAlpha(mSDLSurface, SDL_SRCALPHA,
- static_cast<unsigned char>(255 * mAlpha));
+ CAST_U8(255 * mAlpha));
#endif
}
else
@@ -349,7 +349,7 @@ void Image::setAlpha(const float alpha)
const uint8_t sourceAlpha = mAlphaChannel[i];
if (sourceAlpha > 0)
{
- const uint8_t a = static_cast<uint8_t>(
+ const uint8_t a = CAST_U8(
static_cast<float>(sourceAlpha) * mAlpha);
uint32_t c = (static_cast<uint32_t*>(
@@ -372,7 +372,7 @@ void Image::setAlpha(const float alpha)
const uint8_t sourceAlpha = mAlphaChannel[i];
if (sourceAlpha > 0)
{
- const uint8_t a = static_cast<uint8_t>(
+ const uint8_t a = CAST_U8(
static_cast<float>(sourceAlpha) * mAlpha);
uint32_t c = (static_cast<uint32_t*>(
@@ -395,7 +395,7 @@ void Image::setAlpha(const float alpha)
{
mAlpha = alpha;
SDL_SetTextureAlphaMod(mTexture,
- static_cast<unsigned char>(255 * mAlpha));
+ CAST_U8(255 * mAlpha));
}
#endif
else