From d812d9fac7bae4eff66a5ce8275be19d0ca77a32 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Nov 2012 21:13:16 +0300 Subject: Add own profiler and profiler info to some code. --- src/gui/sdlfont.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/gui/sdlfont.cpp') diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 33581767d..7ecf7cb4f 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -66,6 +66,7 @@ class SDLTextChunk final void generate(TTF_Font *const font, const float alpha) { + BLOCK_START("SDLTextChunk::generate") SDL_Color sdlCol; sdlCol.b = static_cast(color.b); sdlCol.r = static_cast(color.r); @@ -80,11 +81,13 @@ class SDLTextChunk final if (!surface) { img = nullptr; + BLOCK_END("SDLTextChunk::generate") return; } img = imageHelper->createTextSurface(surface, alpha); SDL_FreeSurface(surface); + BLOCK_END("SDLTextChunk::generate") } Image *img; @@ -192,8 +195,12 @@ void SDLFont::drawString(gcn::Graphics *const graphics, const std::string &text, const int x, const int y) { + BLOCK_START("SDLFont::drawString") if (text.empty()) + { + BLOCK_END("SDLFont::drawString") return; + } Graphics *const g = dynamic_cast(graphics); @@ -260,11 +267,12 @@ void SDLFont::drawString(gcn::Graphics *const graphics, image->setAlpha(alpha); g->drawImage(image, x, y); } - + BLOCK_END("SDLFont::drawString") } void SDLFont::slowLogic() { + BLOCK_START("SDLFont::slowLogic") if (!mCleanTime) { mCleanTime = cur_time + CLEAN_TIME; @@ -274,6 +282,7 @@ void SDLFont::slowLogic() doClean(); mCleanTime = cur_time + CLEAN_TIME; } + BLOCK_END("SDLFont::slowLogic") } void SDLFont::createSDLTextChunk(SDLTextChunk *const chunk) -- cgit v1.2.3-60-g2f50