aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/bladerunner/subtitles.cpp8
-rw-r--r--engines/bladerunner/subtitles.h3
2 files changed, 9 insertions, 2 deletions
diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp
index 36daee3d4c..df38552e2c 100644
--- a/engines/bladerunner/subtitles.cpp
+++ b/engines/bladerunner/subtitles.cpp
@@ -364,8 +364,12 @@ void Subtitles::draw(Graphics::Surface &s) {
return;
}
- Common::Array<Common::U32String> lines;
- _font->wordWrapText(_currentText, kTextMaxWidth, lines);
+ // This check is done so that lines won't be re-calculated multiple times for the same text
+ if (_currentText != _prevText) {
+ lines.clear();
+ _prevText = _currentText;
+ _font->wordWrapText(_currentText, kTextMaxWidth, lines);
+ }
int y = s.h - (kMarginBottom + MAX(kPreferedLine, lines.size()) * _font->getFontHeight());
diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h
index 1de059b071..b84e0cf704 100644
--- a/engines/bladerunner/subtitles.h
+++ b/engines/bladerunner/subtitles.h
@@ -75,6 +75,9 @@ class Subtitles {
bool _isVisible;
bool _forceShowWhenNoSpeech;
Common::U32String _currentText;
+ Common::U32String _prevText;
+
+ Common::Array<Common::U32String> lines;
bool _gameSubsResourceEntriesFound[kMaxTextResourceEntries]; // false if a TRE file did not open successfully
bool _isSystemActive; // true if the whole subtitles subsystem should be disabled (due to missing required resources)