[Scummvm-cvs-logs] scummvm master -> 24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99

lordhoto lordhoto at gmail.com
Wed Feb 12 18:32:20 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
24d2e246b4 WINTERMUTE: Use game format for fallback font rendering.


Commit: 24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99
    https://github.com/scummvm/scummvm/commit/24d2e246b48a0061c4c2f6c37b5bb5d8646d4e99
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2014-02-12T09:31:06-08:00

Commit Message:
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.

Changed paths:
    engines/wintermute/base/font/base_font_truetype.cpp



diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp
index b879e78..f8eb40d 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
 }






More information about the Scummvm-git-logs mailing list