aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-09-29 22:27:24 +0200
committerWillem Jan Palenstijn2013-09-29 22:27:56 +0200
commit2242917dda89cfdf2dd9f15748b5bdb1b4bbe1c3 (patch)
tree3498be7b5348a77436ea9b29c4c4c8e34d02bfb8 /engines/wintermute
parent8989dd3b73543a13f0d8494350f9c004bc2e7310 (diff)
downloadscummvm-rg350-2242917dda89cfdf2dd9f15748b5bdb1b4bbe1c3.tar.gz
scummvm-rg350-2242917dda89cfdf2dd9f15748b5bdb1b4bbe1c3.tar.bz2
scummvm-rg350-2242917dda89cfdf2dd9f15748b5bdb1b4bbe1c3.zip
WINTERMUTE: Do antialiased TT font rendering
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/base/font/base_font_truetype.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index b6f372f377..cc0b9d340a 100644
--- a/engines/wintermute/base/font/base_font_truetype.cpp
+++ b/engines/wintermute/base/font/base_font_truetype.cpp
@@ -286,6 +286,26 @@ 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.
+
+ // Since we painted it with color 0xFFFFFFFF onto a black background,
+ // the alpha channel is gone, but the colour value of each pixel corresponds
+ // to its original alpha value.
+
+ Graphics::PixelFormat format = _gameRef->_renderer->getPixelFormat();
+ uint32 *pixels = (uint32 *)convertedSurface->getPixels();
+
+ // This is a Surface we created ourselves, so no emtpy space between rows.
+ for (int i = 0; i < surface->w * surface->h; ++i) {
+ uint8 a, r, g, b;
+ format.colorToRGB(*pixels, r, g, b);
+ a = r;
+ *pixels++ = format.ARGBToColor(a, r, g, b);
+ }
+ }
+
retSurface->putSurface(*convertedSurface, true);
convertedSurface->free();
surface->free();