summaryrefslogtreecommitdiff
path: root/src/resources/openglimagehelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/openglimagehelper.cpp')
-rw-r--r--src/resources/openglimagehelper.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index d854c0666..66c60e039 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -69,7 +69,7 @@ OpenGLImageHelper::~OpenGLImageHelper()
Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
{
SDL_Surface *const tmpImage = loadPng(rw);
- if (!tmpImage)
+ if (tmpImage == nullptr)
{
reportAlways("Error, image load failed: %s", IMG_GetError());
return nullptr;
@@ -77,7 +77,7 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
SDL_Surface *const surf = convertTo32Bit(tmpImage);
MSDL_FreeSurface(tmpImage);
- if (!surf)
+ if (surf == nullptr)
return nullptr;
uint32_t *pixels = static_cast<uint32_t *>(surf->pixels);
@@ -88,14 +88,14 @@ Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
case 1:
{
const DyePalette *const pal = dye.getSPalete();
- if (pal)
+ if (pal != nullptr)
DYEPALETTEP(pal, SOGLColor)(pixels, surf->w * surf->h);
break;
}
case 2:
{
const DyePalette *const pal = dye.getAPalete();
- if (pal)
+ if (pal != nullptr)
DYEPALETTEP(pal, AOGLColor)(pixels, surf->w * surf->h);
break;
}
@@ -121,11 +121,11 @@ Image *OpenGLImageHelper::createTextSurface(SDL_Surface *const tmpImage,
const int width, const int height,
const float alpha)
{
- if (!tmpImage)
+ if (tmpImage == nullptr)
return nullptr;
Image *const img = glLoad(tmpImage, width, height);
- if (img)
+ if (img != nullptr)
img->setAlpha(alpha);
return img;
}
@@ -141,7 +141,7 @@ int OpenGLImageHelper::powerOfTwo(const int input)
SDL_Surface *OpenGLImageHelper::convertSurfaceNormalize(SDL_Surface *tmpImage,
int width, int height)
{
- if (!tmpImage)
+ if (tmpImage == nullptr)
return nullptr;
int realWidth = powerOfTwo(width);
@@ -190,7 +190,7 @@ SDL_Surface *OpenGLImageHelper::convertSurfaceNormalize(SDL_Surface *tmpImage,
tmpImage = MSDL_CreateRGBSurface(SDL_SWSURFACE, realWidth, realHeight,
32, rmask, gmask, bmask, amask);
- if (!tmpImage)
+ if (tmpImage == nullptr)
{
reportAlways("Error, image convert failed: out of memory");
return nullptr;
@@ -203,7 +203,7 @@ SDL_Surface *OpenGLImageHelper::convertSurfaceNormalize(SDL_Surface *tmpImage,
SDL_Surface *OpenGLImageHelper::convertSurface(SDL_Surface *tmpImage,
int width, int height)
{
- if (!tmpImage)
+ if (tmpImage == nullptr)
return nullptr;
#ifdef USE_SDL2
@@ -242,7 +242,7 @@ SDL_Surface *OpenGLImageHelper::convertSurface(SDL_Surface *tmpImage,
tmpImage = MSDL_CreateRGBSurface(SDL_SWSURFACE, width, height,
32, rmask, gmask, bmask, amask);
- if (!tmpImage)
+ if (tmpImage == nullptr)
{
reportAlways("Error, image convert failed: out of memory");
return nullptr;
@@ -308,21 +308,21 @@ void OpenGLImageHelper::bindTexture(const GLuint texture)
Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
int width, int height)
{
- if (!tmpImage)
+ if (tmpImage == nullptr)
return nullptr;
BLOCK_START("OpenGLImageHelper::glLoad")
// Flush current error flag.
graphicsManager.getLastError();
- if (!width)
+ if (width == 0)
width = tmpImage->w;
- if (!height)
+ if (height == 0)
height = tmpImage->h;
SDL_Surface *oldImage = tmpImage;
tmpImage = convertSurfaceNormalize(tmpImage, width, height);
- if (!tmpImage)
+ if (tmpImage == nullptr)
return nullptr;
const int realWidth = tmpImage->w;
@@ -414,7 +414,7 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage,
MSDL_FreeSurface(tmpImage);
GLenum error = graphicsManager.getLastError();
- if (error)
+ if (error != 0u)
{
std::string errmsg = GraphicsManager::errorToString(error);
reportAlways("Error: Image GL import failed: %s (%u)",
@@ -493,17 +493,17 @@ void OpenGLImageHelper::copySurfaceToImage(const Image *const image,
const int x, const int y,
SDL_Surface *surface) const
{
- if (!surface || !image)
+ if (surface == nullptr || image == nullptr)
return;
SDL_Surface *const oldSurface = surface;
surface = convertSurface(surface, surface->w, surface->h);
- if (!surface)
+ if (surface == nullptr)
return;
// +++ probably need combine
// mglTextureSubImage2D and mglTextureSubImage2DEXT
- if (mglTextureSubImage2D)
+ if (mglTextureSubImage2D != nullptr)
{
mglTextureSubImage2D(image->mGLImage,
0,