aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base
diff options
context:
space:
mode:
authorJohannes Schickel2014-02-12 18:24:58 +0100
committerJohannes Schickel2014-02-12 18:31:06 +0100
commit24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99 (patch)
treeea8667e856279711770e3dadd6ea099cb5dc56b5 /engines/wintermute/base
parent5883f4cc3fe5861c314afedb00c692f31f1a1124 (diff)
downloadscummvm-rg350-24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99.tar.gz
scummvm-rg350-24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99.tar.bz2
scummvm-rg350-24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99.zip
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.
Diffstat (limited to 'engines/wintermute/base')
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp13
1 files changed, 3 insertions, 10 deletions
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<WideString>::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
}