diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-06 23:34:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-07 19:23:40 +0300 |
commit | 36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch) | |
tree | 190156cb88b13a38a6d13c69ee0742cc078065a1 /src/gui/fonts/font.cpp | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/gui/fonts/font.cpp')
-rw-r--r-- | src/gui/fonts/font.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index fc752c2eb..78c243a70 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -128,7 +128,7 @@ Font::Font(std::string filename, size = 4; } - if (!fontCounter) + if (fontCounter == 0) { strBuf = new char[65535]; memset(strBuf, 0, 65535); @@ -141,13 +141,13 @@ Font::Font(std::string filename, filename.c_str()); mFont = openFont(filename.c_str(), size); - if (!mFont) + if (mFont == nullptr) { logger->log("Error normal loading font " + filename); filename = "fonts/dejavusans.ttf"; mFont = openFont(fixDirSeparators(filename).c_str(), size); - if (!mFont) + if (mFont == nullptr) { #ifdef UNITTESTS reportAlways("Font load failed %s", @@ -229,14 +229,14 @@ void Font::loadFont(std::string filename, fixDirSeparators(filename); TTF_Font *const font = openFont(filename.c_str(), size); - if (!font) + if (font == nullptr) { logger->log("Font::Font: " + std::string(TTF_GetError())); return; } - if (mFont) + if (mFont != nullptr) TTF_CloseFont(mFont); mFont = font; @@ -283,7 +283,7 @@ void Font::drawString(Graphics *const graphics, TextChunk *const chunk2 = (*i).second; cache->moveToFirst(chunk2); Image *const image = chunk2->img; - if (image) + if (image != nullptr) { image->setAlpha(alpha); graphics->drawImage(image, x, y); @@ -309,7 +309,7 @@ void Font::drawString(Graphics *const graphics, cache->insertFirst(chunk2); const Image *const image = chunk2->img; - if (image) + if (image != nullptr) graphics->drawImage(image, x, y); } BLOCK_END("Font::drawString") @@ -318,7 +318,7 @@ void Font::drawString(Graphics *const graphics, void Font::slowLogic(const int rnd) { BLOCK_START("Font::slowLogic") - if (!mCleanTime) + if (mCleanTime == 0) { mCleanTime = cur_time + CLEAN_TIME + rnd; } @@ -345,7 +345,7 @@ int Font::getWidth(const std::string &text) const TextChunk *const chunk = (*i).second; cache->moveToFirst(chunk); const Image *const image = chunk->img; - if (image) + if (image != nullptr) return image->getWidth(); else return 0; @@ -476,7 +476,7 @@ void Font::generate(TextChunk &chunk) void Font::insertChunk(TextChunk *const chunk) { - if (!chunk || chunk->text.empty() || !chunk->img) + if ((chunk == nullptr) || chunk->text.empty() || (chunk->img == nullptr)) return; // logger->log("insert chunk: text=%s, color: %d,%d,%d", // chunk->text.c_str(), chunk->color.r, chunk->color.g, chunk->color.b); |