[Scummvm-git-logs] scummvm master -> 6ea020d5f1cdc8adfb0bfbe23906d0727a78c558

sev- sev at scummvm.org
Mon Feb 6 08:41:45 CET 2017


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:
6ea020d5f1 GRAPHICS: Cleanup MacText code


Commit: 6ea020d5f1cdc8adfb0bfbe23906d0727a78c558
    https://github.com/scummvm/scummvm/commit/6ea020d5f1cdc8adfb0bfbe23906d0727a78c558
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2017-02-06T08:41:09+01:00

Commit Message:
GRAPHICS: Cleanup MacText code

Changed paths:
    graphics/macgui/mactext.cpp
    graphics/macgui/mactext.h


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4042088..e15c8f8 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -140,8 +140,6 @@ void MacText::splitString(Common::String &str) {
 
 			if (text.size()) {
 				for (uint i = 0; i < text.size(); i++) {
-					_text.push_back(text[i]);
-
 					_textLines[curLine].chunks[curChunk].text = text[i];
 
 					if ((text.size() > 1 || !nextChunk) && !(i == text.size() - 1 && nextChunk)) {
@@ -189,12 +187,8 @@ void MacText::splitString(Common::String &str) {
 
 		_textLines[curLine].chunks[curChunk].text = text[0];
 
-		_text.push_back(text[0]);
-
 		if (text.size() > 1) {
 			for (uint i = 1; i < text.size(); i++) {
-				_text.push_back(text[i]);
-
 				curLine++;
 				_textLines.resize(curLine + 1);
 				_textLines[curLine].chunks.push_back(_currentFormatting);
@@ -331,28 +325,28 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int
 }
 
 void MacText::appendText(Common::String str) {
-	int oldLen = _text.size();
+	int oldLen = _textLines.size();
 
 	// TODO: Recalc length
 
 	splitString(str);
 	recalcDims();
 
-	render(oldLen + 1, _text.size());
+	render(oldLen + 1, _textLines.size());
 }
 
 void MacText::replaceLastLine(Common::String str) {
-	int oldLen = MAX<int>(0, _text.size() - 1);
+	int oldLen = MAX<int>(0, _textLines.size() - 1);
 
 	// TODO: Recalc length, adapt to _textLines
 
-	if (_text.size())
-		_text.pop_back();
+	if (_textLines.size())
+		_textLines.pop_back();
 
 	splitString(str);
 	recalcDims();
 
-	render(oldLen, _text.size());
+	render(oldLen, _textLines.size());
 }
 
 } // End of namespace Graphics
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 08fa9eb..4df4f1c 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -96,7 +96,7 @@ public:
 	void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
 	void appendText(Common::String str);
 	void replaceLastLine(Common::String str);
-	int getLineCount() { return _text.size(); }
+	int getLineCount() { return _textLines.size(); }
 
 	void render();
 	Graphics::ManagedSurface *getSurface() { return _surface; }
@@ -119,8 +119,6 @@ private:
 	int _maxWidth;
 	int _interLinear;
 
-	Common::Array<Common::String> _text;
-
 	int _textMaxWidth;
 	int _textMaxHeight;
 





More information about the Scummvm-git-logs mailing list