From 0ec70a22fdebf04af66c797746bec995d73c3d0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boldizs=C3=A1r=20Lipka?= Date: Thu, 5 Jun 2014 16:20:55 +0200 Subject: [PATCH] Add a function to check if the handled pointer is NULL. --- src/sdl/texture.cpp | 5 +++++ src/sdl/texture.hpp | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/sdl/texture.cpp b/src/sdl/texture.cpp index 026c69bd3a29..67488290b348 100644 --- a/src/sdl/texture.cpp +++ b/src/sdl/texture.cpp @@ -343,6 +343,11 @@ void ttexture::update_pixels(SDL_Surface *surf) } } +bool ttexture::null() const +{ + return texture_ == NULL; +} + void ttexture::initialise_from_surface(SDL_Renderer& renderer, const int access) { if(access == SDL_TEXTUREACCESS_STATIC) { diff --git a/src/sdl/texture.hpp b/src/sdl/texture.hpp index 519fd7f29ff3..84bed8a66814 100644 --- a/src/sdl/texture.hpp +++ b/src/sdl/texture.hpp @@ -281,6 +281,13 @@ class ttexture */ void update_pixels(SDL_Surface* surf); + /** + * Tells whether the instance really handles an SDL_Texture object. + * + * @return True if the handled pointer is NULL. + */ + bool null() const; + private: /** * The reference count of the texture.