[Scummvm-git-logs] scummvm master -> 4143b795aafe48ff1dd6e586207202761a5dbcec
mgerhardy
martin.gerhardy at gmail.com
Wed Dec 23 12:38:11 UTC 2020
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:
4143b795aa TWINE: optimized fadeInCharacters
Commit: 4143b795aafe48ff1dd6e586207202761a5dbcec
https://github.com/scummvm/scummvm/commit/4143b795aafe48ff1dd6e586207202761a5dbcec
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-23T13:38:02+01:00
Commit Message:
TWINE: optimized fadeInCharacters
This fixes the following issues:
https://bugs.scummvm.org/ticket/12001
https://bugs.scummvm.org/ticket/11982
Changed paths:
engines/twine/text.cpp
engines/twine/text.h
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index f585363216..673174e10b 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -210,7 +210,7 @@ void Text::drawCharacter(int32 x, int32 y, uint8 character) { // drawCharacter
} while (1);
}
-void Text::drawCharacterShadow(int32 x, int32 y, uint8 character, int32 color) { // drawDoubleLetter
+void Text::drawCharacterShadow(int32 x, int32 y, uint8 character, int32 color, Common::Rect& dirtyRect) { // drawDoubleLetter
if (character == ' ') {
return;
}
@@ -222,13 +222,13 @@ void Text::drawCharacterShadow(int32 x, int32 y, uint8 character, int32 color) {
setFontColor(color);
drawCharacter(x, y, character);
- int32 left = x;
- int32 top = y;
- // FIXME: get right font size
- int32 right = x + 32;
- int32 bottom = y + 38;
-
- _engine->copyBlockPhys(left, top, right, bottom);
+ // TODO: get font size
+ const Common::Rect rect(x, y, x + 32, y + 38);
+ if (dirtyRect.isEmpty()) {
+ dirtyRect = rect;
+ } else {
+ dirtyRect.extend(rect);
+ }
}
void Text::drawText(int32 x, int32 y, const char *dialogue) {
@@ -486,15 +486,20 @@ void Text::renderContinueReadingTriangle() {
}
void Text::fadeInCharacters(int32 counter, int32 fontColor) {
+ Common::Rect dirtyRect;
while (--counter >= 0) {
const BlendInCharacter *ptr = &_fadeInCharacters[counter];
setFontColor(fontColor);
- drawCharacterShadow(ptr->x, ptr->y, ptr->chr, fontColor);
+ drawCharacterShadow(ptr->x, ptr->y, ptr->chr, fontColor, dirtyRect);
fontColor -= _dialTextStepSize;
if (fontColor > _dialTextStopColor) {
fontColor = _dialTextStopColor;
}
}
+ if (dirtyRect.isEmpty()) {
+ return;
+ }
+ _engine->copyBlockPhys(dirtyRect);
}
int32 Text::getCharWidth(uint8 chr) const {
@@ -607,6 +612,7 @@ bool Text::drawTextFullscreen(int32 index) {
ProgressiveTextState printedText;
for (;;) {
+ ScopedFPS scopedFps;
_engine->readKeys();
printedText = updateProgressiveText();
playVox(currDialTextEntry);
@@ -619,7 +625,6 @@ bool Text::drawTextFullscreen(int32 index) {
aborted = true;
break;
}
- _engine->_system->delayMillis(1);
}
hasHiddenVox = false;
diff --git a/engines/twine/text.h b/engines/twine/text.h
index 91dfbf33c0..53c9b91fcf 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -126,7 +126,7 @@ private:
* @param character ascii character to display
* @param color character color
*/
- void drawCharacterShadow(int32 x, int32 y, uint8 character, int32 color);
+ void drawCharacterShadow(int32 x, int32 y, uint8 character, int32 color, Common::Rect& dirtyRect);
void initProgressiveTextBuffer();
struct WordSize {
int32 inChar = 0;
More information about the Scummvm-git-logs
mailing list