[Scummvm-git-logs] scummvm master -> 2761107ae3ca6785cc19623ccf8bb8132c231b95

mgerhardy martin.gerhardy at gmail.com
Tue Dec 29 11:34:15 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:
2761107ae3 TWINE: optimized drawSelectableCharacters for drawcalls


Commit: 2761107ae3ca6785cc19623ccf8bb8132c231b95
    https://github.com/scummvm/scummvm/commit/2761107ae3ca6785cc19623ccf8bb8132c231b95
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2020-12-29T12:33:53+01:00

Commit Message:
TWINE: optimized drawSelectableCharacters for drawcalls

Changed paths:
    engines/twine/menu/menuoptions.cpp
    engines/twine/menu/menuoptions.h


diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 49476bed3b..7d544a9425 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -124,7 +124,7 @@ void MenuOptions::showEndSequence() {
 	_engine->setPalette(_engine->_screens->paletteRGBA);
 }
 
-void MenuOptions::drawSelectableCharacter(int32 x, int32 y) {
+void MenuOptions::drawSelectableCharacter(int32 x, int32 y, Common::Rect &dirtyRect) {
 	const int32 borderTop = 200;
 	const int32 borderLeft = 25;
 	const int32 halfButtonHeight = 25;
@@ -164,7 +164,11 @@ void MenuOptions::drawSelectableCharacter(int32 x, int32 y) {
 	const int32 textY = centerY - _engine->_text->getCharHeight(character) / 2;
 	_engine->_text->drawText(textX, textY, buffer);
 
-	_engine->copyBlockPhys(rect);
+	if (dirtyRect.isEmpty()) {
+		dirtyRect = rect;
+	} else {
+		dirtyRect.extend(rect);
+	}
 }
 
 void MenuOptions::setOnScreenKeyboard(int x, int y) {
@@ -194,11 +198,16 @@ void MenuOptions::setOnScreenKeyboard(int x, int y) {
 }
 
 void MenuOptions::drawSelectableCharacters() {
+	Common::Rect dirtyRect;
 	for (int8 x = 0; x < ONSCREENKEYBOARD_WIDTH; x++) {
 		for (int8 y = 0; y < ONSCREENKEYBOARD_HEIGHT; y++) {
-			drawSelectableCharacter(x, y);
+			drawSelectableCharacter(x, y, dirtyRect);
 		}
 	}
+	if (dirtyRect.isEmpty()) {
+		return;
+	}
+	_engine->copyBlockPhys(dirtyRect);
 }
 
 void MenuOptions::drawPlayerName(int32 centerx, int32 top, int32 type) {
diff --git a/engines/twine/menu/menuoptions.h b/engines/twine/menu/menuoptions.h
index bafe2772e4..a5aff64261 100644
--- a/engines/twine/menu/menuoptions.h
+++ b/engines/twine/menu/menuoptions.h
@@ -23,6 +23,7 @@
 #ifndef TWINE_MENUOPTIONS_H
 #define TWINE_MENUOPTIONS_H
 
+#include "common/rect.h"
 #define ONSCREENKEYBOARD_WIDTH 14
 #define ONSCREENKEYBOARD_HEIGHT 5
 
@@ -46,7 +47,7 @@ private:
 	bool enterPlayerName(int32 textIdx);
 	void drawSelectableCharacters();
 	void drawPlayerName(int32 centerx, int32 top, int32 type);
-	void drawSelectableCharacter(int32 x, int32 y);
+	void drawSelectableCharacter(int32 x, int32 y, Common::Rect &dirtyRect);
 	int chooseSave(int textIdx, bool showEmptySlots = false);
 
 public:




More information about the Scummvm-git-logs mailing list