[Scummvm-git-logs] scummvm master -> 5a06fcecddd0fec6336a24b8f84ca73b055f8bdd

sev- sev at scummvm.org
Sun Jan 5 10:34:52 UTC 2020


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

Summary:
bd4f0aa570 GRAPHICS: MACGUI: Fix text height for one line texts
3c0ee87022 DIRECTOR: Improved code for Frame::renderText()
5a06fcecdd GRAPHICS: MACGUI: Generate MacText surface for empty texts


Commit: bd4f0aa570b795afaf8c5a5b3837082b995b797f
    https://github.com/scummvm/scummvm/commit/bd4f0aa570b795afaf8c5a5b3837082b995b797f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-05T10:59:11+01:00

Commit Message:
GRAPHICS: MACGUI: Fix text height for one line texts

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 0df403a..916219f 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -395,7 +395,7 @@ int MacText::getLineWidth(int line, bool enforce) {
 		height = MAX(height, _textLines[line].chunks[i].getFont()->getFontHeight());
 	}
 
-	if (!hastext)
+	if (!hastext && _textLines.size() > 1)
 		height = height > 3 ? height - 3 : 0;
 
 	_textLines[line].width = width;


Commit: 3c0ee870220d90014603f3a52695b1f83865caf5
    https://github.com/scummvm/scummvm/commit/3c0ee870220d90014603f3a52695b1f83865caf5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-05T11:33:46+01:00

Commit Message:
DIRECTOR: Improved code for Frame::renderText()

Changed paths:
    engines/director/frame.cpp


diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 83a243f..8d27eed 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -813,7 +813,7 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) {
 	}
 }
 
-void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::Rect *textSize) {
+void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::Rect *textRect) {
 	TextCast *textCast = (TextCast*)_sprites[spriteId]->_cast;
 
 	int x = _sprites[spriteId]->_startPoint.x; // +rectLeft;
@@ -822,10 +822,10 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 	int width;
 
 	if (_vm->getVersion() >= 4) {
-		if (textSize == NULL)
+		if (textRect == NULL)
 			width = textCast->_initialRect.right;
 		else {
-			width = textSize->width();
+			width = textRect->width();
 		}
 	} else {
 		width = textCast->_initialRect.width(); //_sprites[spriteId]->_width;
@@ -844,11 +844,11 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 
 	Graphics::MacFont *macFont = new Graphics::MacFont(textCast->_fontId, textCast->_fontSize, textCast->_textSlant);
 
-	debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s' text: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont).c_str(), Common::toPrintable(textCast->_ftext).c_str());
+	debugC(3, kDebugText, "renderText: sprite: %d x: %d y: %d w: %d h: %d font: '%s' text: '%s'", spriteId, x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont).c_str(), Common::toPrintable(textCast->_ftext).c_str());
 
 	uint16 boxShadow = (uint16)textCast->_boxShadow;
 	uint16 borderSize = (uint16)textCast->_borderSize;
-	if (textSize != NULL)
+	if (textRect != NULL)
 		borderSize = 0;
 	uint16 padding = (uint16)textCast->_gutterSize;
 	uint16 textShadow = (uint16)textCast->_textShadow;
@@ -863,14 +863,14 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 		return;
 
 	height = textSurface->h;
-	if (textSize != NULL) {
+	if (textRect != NULL) {
 		// TODO: this offset could be due to incorrect fonts loaded!
-		textSize->bottom = height + textCast->_cachedMacText->getLineCount();
+		textRect->bottom = height + textCast->_cachedMacText->getLineCount();
 	}
 
 	uint16 textX = 0, textY = 0;
 
-	if (textSize == NULL) {
+	if (textRect == NULL) {
 		if (borderSize > 0) {
 			if (_vm->getVersion() <= 3)
 				height++;
@@ -916,11 +916,11 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
 	Graphics::ManagedSurface textWithFeatures(width + (borderSize * 2) + boxShadow + textShadow, height + borderSize + boxShadow + textShadow);
 	textWithFeatures.fillRect(Common::Rect(textWithFeatures.w, textWithFeatures.h), 0xff);
 
-	if (textSize == NULL && boxShadow > 0) {
+	if (textRect == NULL && boxShadow > 0) {
 		textWithFeatures.fillRect(Common::Rect(boxShadow, boxShadow, textWithFeatures.w + boxShadow, textWithFeatures.h), 0);
 	}
 
-	if (textSize == NULL && borderSize != kSizeNone) {
+	if (textRect == NULL && borderSize != kSizeNone) {
 		for (int bb = 0; bb < borderSize; bb++) {
 			Common::Rect borderRect(bb, bb, textWithFeatures.w - bb - boxShadow - textShadow, textWithFeatures.h - bb - boxShadow - textShadow);
 			textWithFeatures.fillRect(borderRect, 0xff);


Commit: 5a06fcecddd0fec6336a24b8f84ca73b055f8bdd
    https://github.com/scummvm/scummvm/commit/5a06fcecddd0fec6336a24b8f84ca73b055f8bdd
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-01-05T11:34:17+01:00

Commit Message:
GRAPHICS: MACGUI: Generate MacText surface for empty texts

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 916219f..2fc9b8d 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -69,8 +69,7 @@ MacText::MacText(Common::U32String s, MacWindowManager *wm, const MacFont *macFo
 
 	_currentFormatting = _defaultFormatting;
 
-	if (!_str.empty())
-		splitString(_str);
+	splitString(_str);
 
 	recalcDims();
 
@@ -101,8 +100,7 @@ MacText::MacText(const Common::String &s, MacWindowManager *wm, const MacFont *m
 
 	_currentFormatting = _defaultFormatting;
 
-	if (!_str.empty())
-		splitString(_str);
+	splitString(_str);
 
 	recalcDims();
 
@@ -114,13 +112,11 @@ void MacText::setMaxWidth(int maxWidth) {
 
 	_textLines.clear();
 
-	if (!_str.empty()) {
-		splitString(_str);
+	splitString(_str);
 
-		recalcDims();
+	recalcDims();
 
-		_fullRefresh = true;
-	}
+	_fullRefresh = true;
 }
 
 static const Common::U32String::value_type *readHex(uint16 *res, const Common::U32String::value_type *s, int len) {




More information about the Scummvm-git-logs mailing list