From 24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 12 Feb 2014 18:24:58 +0100 Subject: WINTERMUTE: Use game format for fallback font rendering. BDF fonts got 32bit drawing support in ece8b7fb65402238ab7df896361a9cefe28b8897 Thus it is not necessary to draw onto a 16bit surface. --- engines/wintermute/base/font/base_font_truetype.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'engines/wintermute/base') diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index b879e789e3..f8eb40d42a 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -271,11 +271,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, //debugC(kWintermuteDebugFont, "%s %d %d %d %d", text.c_str(), RGBCOLGetR(_layers[0]->_color), RGBCOLGetG(_layers[0]->_color), RGBCOLGetB(_layers[0]->_color), RGBCOLGetA(_layers[0]->_color)); // void drawString(Surface *dst, const Common::String &str, int x, int y, int w, uint32 color, TextAlign align = kTextAlignLeft, int deltax = 0, bool useEllipsis = true) const; Graphics::Surface *surface = new Graphics::Surface(); - if (_deletableFont) { // We actually have a TTF - surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), _gameRef->_renderer->getPixelFormat()); - } else { // We are using a fallback, they can't do 32bpp - surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), Graphics::PixelFormat(2, 5, 5, 5, 1, 11, 6, 1, 0)); - } + surface->create((uint16)width, (uint16)(_lineHeight * lines.size()), _gameRef->_renderer->getPixelFormat()); uint32 useColor = 0xffffffff; Common::Array::iterator it; int heightOffset = 0; @@ -285,7 +281,6 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, } BaseSurface *retSurface = _gameRef->_renderer->createSurface(); - Graphics::Surface *convertedSurface = surface->convertTo(_gameRef->_renderer->getPixelFormat()); if (_deletableFont) { // Reconstruct the alpha channel of the font. @@ -295,7 +290,7 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, // to its original alpha value. Graphics::PixelFormat format = _gameRef->_renderer->getPixelFormat(); - uint32 *pixels = (uint32 *)convertedSurface->getPixels(); + uint32 *pixels = (uint32 *)surface->getPixels(); // This is a Surface we created ourselves, so no empty space between rows. for (int i = 0; i < surface->w * surface->h; ++i) { @@ -306,11 +301,9 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, } } - retSurface->putSurface(*convertedSurface, true); - convertedSurface->free(); + retSurface->putSurface(*surface, true); surface->free(); delete surface; - delete convertedSurface; return retSurface; // TODO: _isUnderline, _isBold, _isItalic, _isStriked } -- cgit v1.2.3