aboutsummaryrefslogtreecommitdiff
path: root/engines/lab
diff options
context:
space:
mode:
authorFilippos Karapetis2015-12-24 12:27:56 +0200
committerFilippos Karapetis2015-12-24 12:27:56 +0200
commit4b3e671de564b447eae23bfcdb3ce365ba5dd9a0 (patch)
tree73ca537f1d35ad6476b17fe7baba3eae363270d6 /engines/lab
parent7216bddd56d48a4e0ec1f92d9a261943eb8ea072 (diff)
downloadscummvm-rg350-4b3e671de564b447eae23bfcdb3ce365ba5dd9a0.tar.gz
scummvm-rg350-4b3e671de564b447eae23bfcdb3ce365ba5dd9a0.tar.bz2
scummvm-rg350-4b3e671de564b447eae23bfcdb3ce365ba5dd9a0.zip
LAB: Merge flowTextToMem() inside flowText()
Diffstat (limited to 'engines/lab')
-rw-r--r--engines/lab/dispman.cpp27
-rw-r--r--engines/lab/dispman.h19
-rw-r--r--engines/lab/special.cpp6
3 files changed, 15 insertions, 37 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index ead60f7a91..b6ffbf8b2e 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -146,7 +146,16 @@ Common::String DisplayMan::getLine(TextFont *tf, const char **mainBuffer, uint16
}
int DisplayMan::flowText(TextFont *font, int16 spacing, byte penColor, byte backPen,
- bool fillBack, bool centerh, bool centerv, bool output, Common::Rect textRect, const char *str) {
+ bool fillBack, bool centerh, bool centerv, bool output, Common::Rect textRect, const char *str, Image *targetImage) {
+
+ byte *saveDisplayBuffer = _currentDisplayBuffer;
+ uint32 bytesPerPage = _screenBytesPerPage;
+
+ if (targetImage) {
+ _currentDisplayBuffer = targetImage->_imageData;
+ _screenBytesPerPage = (uint32)targetImage->_width * (int32)targetImage->_height;
+ }
+
if (fillBack)
rectFill(textRect, backPen);
@@ -192,24 +201,10 @@ int DisplayMan::flowText(TextFont *font, int16 spacing, byte penColor, byte back
len--;
- return len;
-}
-
-int DisplayMan::flowTextToMem(Image *destIm, TextFont *font, int16 spacing, byte penColor,
- byte backPen, bool fillBack, bool centerh, bool centerv, bool output, Common::Rect textRect,
- const char *str) {
- byte *saveDisplayBuffer = _currentDisplayBuffer;
- uint32 bytesPerPage = _screenBytesPerPage;
-
- _currentDisplayBuffer = destIm->_imageData;
- _screenBytesPerPage = (uint32)destIm->_width * (int32)destIm->_height;
-
- int res = flowText(font, spacing, penColor, backPen, fillBack, centerh, centerv, output, textRect, str);
-
_screenBytesPerPage = bytesPerPage;
_currentDisplayBuffer = saveDisplayBuffer;
- return res;
+ return len;
}
void DisplayMan::createBox(uint16 y2) {
diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h
index cbad419382..3b41505e2f 100644
--- a/engines/lab/dispman.h
+++ b/engines/lab/dispman.h
@@ -177,24 +177,7 @@ public:
* @param text The text itself
*/
int flowText(TextFont *font, int16 spacing, byte penColor, byte backPen, bool fillBack,
- bool centerh, bool centerv, bool output, Common::Rect textRect, const char *text);
-
- /**
- * Calls flowText, but flows it to memory. Same restrictions as flowText.
- * @param destIm Destination buffer
- * @param font Pointer on the font used
- * @param penColor Pen number to use for text
- * @param backPen Background color
- * @param fillBack Whether to fill the background
- * @param centerh Whether to center the text horizontally
- * @param centerv Whether to center the text vertically
- * @param output Whether to output any text
- * @param textRect Coords
- * @param text The text itself
- */
- int flowTextToMem(Image *destIm, TextFont *font, int16 spacing, byte penColor, byte backPen,
- bool fillBack, bool centerh, bool centerv, bool output, Common::Rect textRect,
- const char *text);
+ bool centerh, bool centerv, bool output, Common::Rect textRect, const char *text, Image *targetImage = nullptr);
/**
* Draws a vertical line.
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 301ed59065..be371c6e3c 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -168,16 +168,16 @@ void LabEngine::drawJournalText() {
if (_journalPage <= 1) {
curText = _journalTextTitle.c_str();
- _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, true, true, true, _utils->vgaRectScale(52, 32, 152, 148), curText);
+ _graphics->flowText(_journalFont, -2, 2, 0, false, true, true, true, _utils->vgaRectScale(52, 32, 152, 148), curText, _journalBackImage);
} else {
curText = _journalText.c_str() + charsDrawn;
- charsDrawn += _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(52, 32, 152, 148), curText);
+ charsDrawn += _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(52, 32, 152, 148), curText, _journalBackImage);
}
updateMusicAndEvents();
curText = _journalText.c_str() + charsDrawn;
_lastPage = (*curText == 0);
- _graphics->flowTextToMem(_journalBackImage, _journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(171, 32, 271, 148), curText);
+ _graphics->flowText(_journalFont, -2, 2, 0, false, false, false, true, _utils->vgaRectScale(171, 32, 271, 148), curText, _journalBackImage);
}
void LabEngine::turnPage(bool fromLeft) {