[Scummvm-git-logs] scummvm master -> e1358b966a1a2f48d5ef6af2cd1b5ffc302ef6f2

bgK bastien.bouclet at gmail.com
Fri Feb 14 05:26:26 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:
e1358b966a 3DS: Defer texture updates when the palette changes


Commit: e1358b966a1a2f48d5ef6af2cd1b5ffc302ef6f2
    https://github.com/scummvm/scummvm/commit/e1358b966a1a2f48d5ef6af2cd1b5ffc302ef6f2
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2020-02-14T06:21:46+01:00

Commit Message:
3DS: Defer texture updates when the palette changes

Fixes a performance issue with the Gob engine where the palette is
updated a large number of times during a single frame.

Changed paths:
    backends/platform/3ds/osystem-graphics.cpp
    backends/platform/3ds/osystem.cpp
    backends/platform/3ds/osystem.h


diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index a94557b..b4ff84c 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -329,12 +329,9 @@ float OSystem_3DS::getScaleRatio() const {
 void OSystem_3DS::setPalette(const byte *colors, uint start, uint num) {
 	assert(start + num <= 256);
 	memcpy(_palette + 3 * start, colors, 3 * num);
-
-	// Manually update all color that were changed
-	if (_gameScreen.format.bytesPerPixel == 1) {
-		flushGameScreen();
-	}
+	_gameTextureDirty = true;
 }
+
 void OSystem_3DS::grabPalette(byte *colors, uint start, uint num) const {
 	assert(start + num <= 256);
 	memcpy(colors, _palette + 3 * start, 3 * num);
@@ -391,7 +388,7 @@ Graphics::Surface *OSystem_3DS::lockScreen() {
 	return &_gameScreen;
 }
 void OSystem_3DS::unlockScreen() {
-	flushGameScreen();
+	_gameTextureDirty = true;
 }
 
 void OSystem_3DS::updateScreen() {
@@ -399,6 +396,11 @@ void OSystem_3DS::updateScreen() {
 		return;
 	}
 
+	if (_gameTextureDirty) {
+		flushGameScreen();
+		_gameTextureDirty = false;
+	}
+
 // 	updateFocus();
 	updateMagnify();
 
diff --git a/backends/platform/3ds/osystem.cpp b/backends/platform/3ds/osystem.cpp
index 11022b6..ce68f97 100644
--- a/backends/platform/3ds/osystem.cpp
+++ b/backends/platform/3ds/osystem.cpp
@@ -78,6 +78,7 @@ OSystem_3DS::OSystem_3DS():
 	_magY(0),
 	_magWidth(400),
 	_magHeight(240),
+	_gameTextureDirty(false),
 	_overlayVisible(false),
 	_screenChangeId(0),
 	_magnifyMode(MODE_MAGOFF),
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index 93439d5..d4fa6e4 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -222,6 +222,7 @@ private:
 	byte _cursorPalette[3 * 256];
 
 	Graphics::Surface _gameScreen;
+	bool _gameTextureDirty;
 	Sprite _gameTopTexture;
 	Sprite _gameBottomTexture;
 	Sprite _overlay;




More information about the Scummvm-git-logs mailing list