diff options
Diffstat (limited to 'src/guichan/sdl')
-rw-r--r-- | src/guichan/sdl/sdlgraphics.cpp | 4 | ||||
-rw-r--r-- | src/guichan/sdl/sdlimage.cpp | 18 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/guichan/sdl/sdlgraphics.cpp b/src/guichan/sdl/sdlgraphics.cpp index 28aface0e..67aa657cd 100644 --- a/src/guichan/sdl/sdlgraphics.cpp +++ b/src/guichan/sdl/sdlgraphics.cpp @@ -65,7 +65,7 @@ namespace gcn { SDLGraphics::SDLGraphics() : - mTarget(0), + mTarget(nullptr), mAlpha(false) { } @@ -155,7 +155,7 @@ namespace gcn const SDLImage* srcImage = dynamic_cast<const SDLImage*>(image); - if (srcImage == NULL) + if (!srcImage) { throw GCN_EXCEPTION("Trying to draw an image of unknown format," " must be an SDLImage."); diff --git a/src/guichan/sdl/sdlimage.cpp b/src/guichan/sdl/sdlimage.cpp index 12c5571cf..156b399b3 100644 --- a/src/guichan/sdl/sdlimage.cpp +++ b/src/guichan/sdl/sdlimage.cpp @@ -50,6 +50,8 @@ #include "guichan/exception.hpp" #include "guichan/sdl/sdlpixel.hpp" +#include "debug.h" + namespace gcn { SDLImage::SDLImage(SDL_Surface* surface, bool autoFree) @@ -71,7 +73,7 @@ namespace gcn int SDLImage::getWidth() const { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to get the width of " "a non loaded image."); @@ -82,7 +84,7 @@ namespace gcn int SDLImage::getHeight() const { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to get the height of " "a non loaded image."); @@ -93,7 +95,7 @@ namespace gcn Color SDLImage::getPixel(int x, int y) { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to get a pixel from a " "non loaded image."); @@ -104,7 +106,7 @@ namespace gcn void SDLImage::putPixel(int x, int y, const Color& color) { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to put a pixel in a " "non loaded image."); @@ -115,7 +117,7 @@ namespace gcn void SDLImage::convertToDisplayFormat() { - if (mSurface == NULL) + if (!mSurface) { throw GCN_EXCEPTION("Trying to convert a non loaded image " "to display format."); @@ -155,16 +157,16 @@ namespace gcn { tmp = SDL_DisplayFormatAlpha(mSurface); SDL_FreeSurface(mSurface); - mSurface = NULL; + mSurface = nullptr; } else { tmp = SDL_DisplayFormat(mSurface); SDL_FreeSurface(mSurface); - mSurface = NULL; + mSurface = nullptr; } - if (tmp == NULL) + if (!tmp) throw GCN_EXCEPTION("Unable to convert image to display format."); if (hasPink) |