summaryrefslogtreecommitdiff
path: root/src/gui/fonts
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-23 22:01:44 +0300
commit3c404128c4669a1f4f190e20a89553677717fc50 (patch)
tree2db4e5031089c800c4e00fd6244e578f44a7c910 /src/gui/fonts
parent89b267d6d73bbc59f7c313b8a22b97fbb27f99a8 (diff)
downloadManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.gz
ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.bz2
ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.tar.xz
ManaVerse-3c404128c4669a1f4f190e20a89553677717fc50.zip
Add missing comments into defines.
Diffstat (limited to 'src/gui/fonts')
-rw-r--r--src/gui/fonts/font.cpp30
-rw-r--r--src/gui/fonts/font.h2
-rw-r--r--src/gui/fonts/textchunk.cpp19
-rw-r--r--src/gui/fonts/textchunk.h2
4 files changed, 32 insertions, 21 deletions
diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp
index 7bc0c5357..93356fefd 100644
--- a/src/gui/fonts/font.cpp
+++ b/src/gui/fonts/font.cpp
@@ -247,12 +247,14 @@ void Font::drawString(Graphics *const graphics,
{
#ifdef DEBUG_FONT_COUNTERS
mDeleteCounter ++;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
cache->removeBack();
}
#ifdef DEBUG_FONT_COUNTERS
mCreateCounter ++;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
TextChunk *chunk2 = new TextChunk(text, col, col2, this);
chunk2->generate(mFont, alpha);
@@ -321,36 +323,40 @@ void Font::doClean()
const size_t size = CAST_SIZE(cache->size);
#ifdef DEBUG_FONT_COUNTERS
logger->log("ptr: %u, size: %ld", f, size);
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
if (size > CACHE_SIZE_SMALL3)
{
#ifdef DEBUG_FONT_COUNTERS
mDeleteCounter += 100;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
cache->removeBack(100);
#ifdef DEBUG_FONT_COUNTERS
logger->log("delete3");
-#endif
+#endif // DEBUG_FONT_COUNTERS
}
else if (size > CACHE_SIZE_SMALL2)
{
#ifdef DEBUG_FONT_COUNTERS
mDeleteCounter += 20;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
cache->removeBack(20);
#ifdef DEBUG_FONT_COUNTERS
logger->log("delete2");
-#endif
+#endif // DEBUG_FONT_COUNTERS
}
else if (size > CACHE_SIZE_SMALL1)
{
#ifdef DEBUG_FONT_COUNTERS
mDeleteCounter ++;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
cache->removeBack();
#ifdef DEBUG_FONT_COUNTERS
logger->log("delete1");
-#endif
+#endif // DEBUG_FONT_COUNTERS
}
}
}
@@ -405,12 +411,14 @@ void Font::generate(TextChunk &chunk)
{
#ifdef DEBUG_FONT_COUNTERS
mDeleteCounter ++;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
cache->removeBack();
}
#ifdef DEBUG_FONT_COUNTERS
mCreateCounter ++;
-#endif
+#endif // DEBUG_FONT_COUNTERS
+
const float alpha = static_cast<float>(chunk.color.a) / 255.0F;
chunk.generate(mFont, alpha);
// logger->log("generate image: " + chunk.text);
diff --git a/src/gui/fonts/font.h b/src/gui/fonts/font.h
index d8e16936f..302980b93 100644
--- a/src/gui/fonts/font.h
+++ b/src/gui/fonts/font.h
@@ -150,6 +150,6 @@ class Font final
#ifdef UNITTESTS
extern int textChunkCnt;
-#endif
+#endif // UNITTESTS
#endif // GUI_FONTS_FONT_H
diff --git a/src/gui/fonts/textchunk.cpp b/src/gui/fonts/textchunk.cpp
index 06e649bf4..3025305fd 100644
--- a/src/gui/fonts/textchunk.cpp
+++ b/src/gui/fonts/textchunk.cpp
@@ -46,7 +46,7 @@ char *restrict strBuf = nullptr;
#ifdef UNITTESTS
int textChunkCnt = 0;
-#endif
+#endif // UNITTESTS
TextChunk::TextChunk() :
img(nullptr),
@@ -59,7 +59,7 @@ TextChunk::TextChunk() :
{
#ifdef UNITTESTS
textChunkCnt ++;
-#endif
+#endif // UNITTESTS
}
TextChunk::TextChunk(const std::string &restrict text0,
@@ -76,7 +76,7 @@ TextChunk::TextChunk(const std::string &restrict text0,
{
#ifdef UNITTESTS
textChunkCnt ++;
-#endif
+#endif // UNITTESTS
}
TextChunk::~TextChunk()
@@ -84,7 +84,7 @@ TextChunk::~TextChunk()
delete2(img);
#ifdef UNITTESTS
textChunkCnt --;
-#endif
+#endif // UNITTESTS
}
bool TextChunk::operator==(const TextChunk &restrict chunk) const
@@ -103,9 +103,10 @@ void TextChunk::generate(TTF_Font *restrict const font,
sdlCol.g = CAST_U8(color.g);
#ifdef USE_SDL2
sdlCol.a = 255;
-#else
+#else // USE_SDL2
+
sdlCol.unused = 0;
-#endif
+#endif // USE_SDL2
getSafeUtf8String(text, strBuf);
@@ -140,9 +141,11 @@ void TextChunk::generate(TTF_Font *restrict const font,
sdlCol2.g = CAST_U8(color2.g);
#ifdef USE_SDL2
sdlCol2.a = 255;
-#else
+#else // USE_SDL2
+
sdlCol2.unused = 0;
-#endif
+#endif // USE_SDL2
+
SDL_Surface *const surface2 = MTTF_RenderUTF8_Blended(
font, strBuf, sdlCol2);
if (!surface2)
diff --git a/src/gui/fonts/textchunk.h b/src/gui/fonts/textchunk.h
index e2151bac2..8cb1df9f2 100644
--- a/src/gui/fonts/textchunk.h
+++ b/src/gui/fonts/textchunk.h
@@ -67,6 +67,6 @@ class TextChunk final
#ifdef UNITTESTS
extern int textChunkCnt;
-#endif
+#endif // UNITTESTS
#endif // GUI_FONTS_TEXTCHUNK_H