From dba24b2e59eb739e73228dbcf707e943905a9e5a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 27 Dec 2012 22:43:59 +0300 Subject: Fix text size if it was not power of two. --- src/gui/sdlfont.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/gui/sdlfont.cpp') diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index d195278fa..3ece4b849 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -82,6 +82,8 @@ class SDLTextChunk final SDL_Surface *surface = TTF_RenderUTF8_Blended( font, strBuf, sdlCol); + const int width = surface->w; + const int height = surface->h; if (!surface) { @@ -96,7 +98,7 @@ class SDLTextChunk final SDL_Color sdlCol2; const SDL_PixelFormat * const format = surface->format; SDL_Surface *background = imageHelper->create32BitSurface( - surface->w, surface->h); + width, height); if (!background) { img = nullptr; @@ -138,7 +140,8 @@ class SDLTextChunk final SDL_FreeSurface(surface2); surface = background; } - img = imageHelper->createTextSurface(surface, alpha); + img = imageHelper->createTextSurface( + surface, width, height, alpha); SDL_FreeSurface(surface); BLOCK_END("SDLTextChunk::generate") -- cgit v1.2.3-60-g2f50