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

bluegr bluegr at gmail.com
Sat Jul 27 06:12:01 CEST 2019


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:
ecd89808c4 BACKENDS: Avoid redundant format changes on Dingux and LinuxMoto


Commit: ecd89808c49941323cca84724c1a26dfe26ce10f
    https://github.com/scummvm/scummvm/commit/ecd89808c49941323cca84724c1a26dfe26ce10f
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-07-27T07:11:57+03:00

Commit Message:
BACKENDS: Avoid redundant format changes on Dingux and LinuxMoto

Changed paths:
    backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
    backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
    backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h


diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 5e86a2b..f306182 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -101,6 +101,24 @@ void DINGUXSdlGraphicsManager::setGraphicsModeIntern() {
 void DINGUXSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
 	assert(_transactionMode == kTransactionActive);
 
+#ifdef USE_RGB_COLOR
+	// Avoid redundant format changes
+	Graphics::PixelFormat newFormat;
+	if (!format)
+		newFormat = Graphics::PixelFormat::createFormatCLUT8();
+	else
+		newFormat = *format;
+
+	assert(newFormat.bytesPerPixel > 0);
+
+	if (newFormat != _videoMode.format) {
+		_videoMode.format = newFormat;
+		_transactionDetails.formatChanged = true;
+		_screenFormat = newFormat;
+	}
+#endif
+
+
 	// Avoid redundant res changes
 	if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
 		return;
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
index b36136c..7ca4202 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
@@ -100,10 +100,27 @@ void LinuxmotoSdlGraphicsManager::setGraphicsModeIntern() {
 	blitCursor();
 }
 
-
-void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h) {
+void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
 	assert(_transactionMode == kTransactionActive);
 
+#ifdef USE_RGB_COLOR
+	// Avoid redundant format changes
+	Graphics::PixelFormat newFormat;
+	if (!format)
+		newFormat = Graphics::PixelFormat::createFormatCLUT8();
+	else
+		newFormat = *format;
+
+	assert(newFormat.bytesPerPixel > 0);
+
+	if (newFormat != _videoMode.format) {
+		_videoMode.format = newFormat;
+		_transactionDetails.formatChanged = true;
+		_screenFormat = newFormat;
+	}
+#endif
+
+
 	// Avoid redundant res changes
 	if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
 		return;
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
index e48cff3..cc2af5f 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
@@ -29,7 +29,7 @@ class LinuxmotoSdlGraphicsManager : public SurfaceSdlGraphicsManager {
 public:
 	LinuxmotoSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window);
 
-	virtual void initSize(uint w, uint h) override;
+	virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL) override;
 	virtual void setGraphicsModeIntern() override;
 	virtual int getGraphicsModeScale(int mode) const override;
 	virtual void internUpdateScreen() override;





More information about the Scummvm-git-logs mailing list