summaryrefslogtreecommitdiff
path: root/src/gui/sdlfont.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-27 22:43:59 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-27 23:15:06 +0300
commitdba24b2e59eb739e73228dbcf707e943905a9e5a (patch)
treebdbcca13bb984a47fd4f1f41d0429244777e10e9 /src/gui/sdlfont.cpp
parentef5ba77247a2860a201c4d9177c4f3479d53538a (diff)
downloadplus-dba24b2e59eb739e73228dbcf707e943905a9e5a.tar.gz
plus-dba24b2e59eb739e73228dbcf707e943905a9e5a.tar.bz2
plus-dba24b2e59eb739e73228dbcf707e943905a9e5a.tar.xz
plus-dba24b2e59eb739e73228dbcf707e943905a9e5a.zip
Fix text size if it was not power of two.
Diffstat (limited to 'src/gui/sdlfont.cpp')
-rw-r--r--src/gui/sdlfont.cpp7
1 files changed, 5 insertions, 2 deletions
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")