1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fixes for multiple new issues from Sonar

This commit is contained in:
Ivan Savenko
2025-02-20 16:57:52 +00:00
parent 0548f325e4
commit 2362c6da21
50 changed files with 190 additions and 223 deletions

View File

@@ -125,27 +125,27 @@ size_t CTrueTypeFont::getStringWidthScaled(const std::string & text) const
return width;
}
void CTrueTypeFont::renderText(SDL_Surface * surface, const std::string & data, const ColorRGBA & color, const Point & pos) const
void CTrueTypeFont::renderText(SDL_Surface * surface, const std::string & text, const ColorRGBA & color, const Point & pos) const
{
if (data.empty())
if (text.empty())
return;
if (outline)
renderTextImpl(surface, data, Colors::BLACK, pos - Point(1,1) * getScalingFactor());
renderTextImpl(surface, text, Colors::BLACK, pos - Point(1,1) * getScalingFactor());
if (dropShadow || outline)
renderTextImpl(surface, data, Colors::BLACK, pos + Point(1,1) * getScalingFactor());
renderTextImpl(surface, text, Colors::BLACK, pos + Point(1,1) * getScalingFactor());
renderTextImpl(surface, data, color, pos);
renderTextImpl(surface, text, color, pos);
}
void CTrueTypeFont::renderTextImpl(SDL_Surface * surface, const std::string & data, const ColorRGBA & color, const Point & pos) const
void CTrueTypeFont::renderTextImpl(SDL_Surface * surface, const std::string & text, const ColorRGBA & color, const Point & pos) const
{
SDL_Surface * rendered;
if (blended)
rendered = TTF_RenderUTF8_Blended(font.get(), data.c_str(), CSDL_Ext::toSDL(color));
rendered = TTF_RenderUTF8_Blended(font.get(), text.c_str(), CSDL_Ext::toSDL(color));
else
rendered = TTF_RenderUTF8_Solid(font.get(), data.c_str(), CSDL_Ext::toSDL(color));
rendered = TTF_RenderUTF8_Solid(font.get(), text.c_str(), CSDL_Ext::toSDL(color));
assert(rendered);