summaryrefslogtreecommitdiff
path: root/src/blitter
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-04-10 22:07:06 +0100
committerMichael Lutz <michi@icosahedron.de>2019-04-10 23:22:20 +0200
commit7c8e7c6b6e16d4a26259a676db32d8776b99817e (patch)
tree99f134b7e66367cf11e10bc5061896eab4a3264f /src/blitter
parent3b4f224c0bc50e7248050d4bcbb6d83fd510c1cc (diff)
downloadopenttd-7c8e7c6b6e16d4a26259a676db32d8776b99817e.tar.xz
Codechange: Use null pointer literal instead of the NULL macro
Diffstat (limited to 'src/blitter')
-rw-r--r--src/blitter/32bpp_anim.cpp2
-rw-r--r--src/blitter/32bpp_anim.hpp4
-rw-r--r--src/blitter/8bpp_optimized.cpp8
-rw-r--r--src/blitter/factory.hpp14
-rw-r--r--src/blitter/null.hpp2
5 files changed, 15 insertions, 15 deletions
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp
index 27b1fbd5b..293ebb173 100644
--- a/src/blitter/32bpp_anim.cpp
+++ b/src/blitter/32bpp_anim.cpp
@@ -414,7 +414,7 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
uint32 *udst = (uint32 *)dst;
const uint32 *src = (const uint32 *)video;
- if (this->anim_buf == NULL) return;
+ if (this->anim_buf == nullptr) return;
const uint16 *anim_line = this->ScreenToAnimOffset((const uint32 *)video) + this->anim_buf;
diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp
index f8fd89281..ea6623493 100644
--- a/src/blitter/32bpp_anim.hpp
+++ b/src/blitter/32bpp_anim.hpp
@@ -26,8 +26,8 @@ protected:
public:
Blitter_32bppAnim() :
- anim_buf(NULL),
- anim_alloc(NULL),
+ anim_buf(nullptr),
+ anim_alloc(nullptr),
anim_buf_width(0),
anim_buf_height(0),
anim_buf_pitch(0)
diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp
index 0f07e7c7b..21bca67e1 100644
--- a/src/blitter/8bpp_optimized.cpp
+++ b/src/blitter/8bpp_optimized.cpp
@@ -167,7 +167,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloca
uint trans = 0;
uint pixels = 0;
uint last_colour = 0;
- byte *count_dst = NULL;
+ byte *count_dst = nullptr;
/* Store the scaled image */
const SpriteLoader::CommonPixel *src = &sprite[i].data[y * sprite[i].width];
@@ -176,11 +176,11 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloca
uint colour = src++->m;
if (last_colour == 0 || colour == 0 || pixels == 255) {
- if (count_dst != NULL) {
+ if (count_dst != nullptr) {
/* Write how many non-transparent bytes we get */
*count_dst = pixels;
pixels = 0;
- count_dst = NULL;
+ count_dst = nullptr;
}
/* As long as we find transparency bytes, keep counting */
if (colour == 0 && trans != 255) {
@@ -206,7 +206,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::Sprite *sprite, Alloca
}
}
- if (count_dst != NULL) *count_dst = pixels;
+ if (count_dst != nullptr) *count_dst = pixels;
/* Write line-ending */
*dst = 0; dst++;
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp
index 01faca68f..5def16ea5 100644
--- a/src/blitter/factory.hpp
+++ b/src/blitter/factory.hpp
@@ -48,7 +48,7 @@ private:
*/
static Blitter **GetActiveBlitter()
{
- static Blitter *s_blitter = NULL;
+ static Blitter *s_blitter = nullptr;
return &s_blitter;
}
@@ -58,8 +58,8 @@ protected:
* @param name The name of the blitter.
* @param description A longer description for the blitter.
* @param usable Whether the blitter is usable (on the current computer). For example for disabling SSE blitters when the CPU can't handle them.
- * @pre name != NULL.
- * @pre description != NULL.
+ * @pre name != nullptr.
+ * @pre description != nullptr.
* @pre There is no blitter registered with this name.
*/
BlitterFactory(const char *name, const char *description, bool usable = true) :
@@ -96,7 +96,7 @@ public:
static Blitter *SelectBlitter(const char *name)
{
BlitterFactory *b = GetBlitterFactory(name);
- if (b == NULL) return NULL;
+ if (b == nullptr) return nullptr;
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
@@ -109,7 +109,7 @@ public:
/**
* Get the blitter factory with the given name.
* @param name the blitter factory to select.
- * @return The blitter factory, or NULL when there isn't one with the wanted name.
+ * @return The blitter factory, or nullptr when there isn't one with the wanted name.
*/
static BlitterFactory *GetBlitterFactory(const char *name)
{
@@ -128,7 +128,7 @@ public:
}
#endif /* defined(WITH_COCOA) */
#endif /* defined(DEDICATED) */
- if (GetBlitters().size() == 0) return NULL;
+ if (GetBlitters().size() == 0) return nullptr;
const char *bname = (StrEmpty(name)) ? default_blitter : name;
Blitters::iterator it = GetBlitters().begin();
@@ -138,7 +138,7 @@ public:
return b;
}
}
- return NULL;
+ return nullptr;
}
/**
diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp
index 8dc98646c..dff4992cc 100644
--- a/src/blitter/null.hpp
+++ b/src/blitter/null.hpp
@@ -21,7 +21,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override {};
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override {};
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override;
- void *MoveTo(void *video, int x, int y) override { return NULL; };
+ void *MoveTo(void *video, int x, int y) override { return nullptr; };
void SetPixel(void *video, int x, int y, uint8 colour) override {};
void DrawRect(void *video, int width, int height, uint8 colour) override {};
void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) override {};