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

bluegr noreply at scummvm.org
Sun Jan 16 11:22:40 UTC 2022


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:
a14c5a4a53 SDL: Replace gfx_mode with scale_factor in initSizeHint()


Commit: a14c5a4a53710073f3ee4ad028fa1f59b0870b0b
    https://github.com/scummvm/scummvm/commit/a14c5a4a53710073f3ee4ad028fa1f59b0870b0b
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-01-16T13:22:37+02:00

Commit Message:
SDL: Replace gfx_mode with scale_factor in initSizeHint()

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.h
    backends/graphics/sdl/sdl-graphics.cpp
    backends/graphics/sdl/sdl-graphics.h
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp
    backends/graphics/surfacesdl/surfacesdl-graphics.h
    backends/graphics3d/openglsdl/openglsdl-graphics3d.h


diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h
index a271e1dcbe9..d12ad471909 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.h
+++ b/backends/graphics/openglsdl/openglsdl-graphics.h
@@ -61,20 +61,6 @@ protected:
 
 	bool saveScreenshot(const Common::String &filename) const override;
 
-	int getGraphicsModeScale(int mode) const override {
-#if SDL_VERSION_ATLEAST(2, 0, 0)
-		int windowWidth, windowHeight;
-		SDL_GetWindowSize(_window->getSDLWindow(), &windowWidth, &windowHeight);
-		int realWidth, realHeight;
-		SDL_GL_GetDrawableSize(_window->getSDLWindow(), &realWidth, &realHeight);
-		int scale = realWidth / windowWidth;
-		//debug(9, "window: %dx%d drawable: %dx%d scale: %d", windowWidth, windowHeight, realWidth, realHeight, scale);
-		return scale;
-#else
-		return 1;
-#endif
-	}
-
 private:
 	bool setupMode(uint width, uint height);
 
diff --git a/backends/graphics/sdl/sdl-graphics.cpp b/backends/graphics/sdl/sdl-graphics.cpp
index c38ed886f74..bd02b6149f1 100644
--- a/backends/graphics/sdl/sdl-graphics.cpp
+++ b/backends/graphics/sdl/sdl-graphics.cpp
@@ -138,26 +138,11 @@ bool SdlGraphicsManager::defaultGraphicsModeConfig() const {
 	return true;
 }
 
-int SdlGraphicsManager::getGraphicsModeIdByName(const Common::String &name) const {
-	if (name == "normal" || name == "default") {
-		return getDefaultGraphicsMode();
-	}
-
-	const OSystem::GraphicsMode *mode = getSupportedGraphicsModes();
-	while (mode && mode->name != nullptr) {
-		if (name.equalsIgnoreCase(mode->name)) {
-			return mode->id;
-		}
-		++mode;
-	}
-	return -1;
-}
-
 void SdlGraphicsManager::initSizeHint(const Graphics::ModeList &modes) {
 #if SDL_VERSION_ATLEAST(2, 0, 0)
 	const bool useDefault = defaultGraphicsModeConfig();
 
-	int scale = getGraphicsModeScale(getGraphicsModeIdByName(ConfMan.get("gfx_mode")));
+	int scale = ConfMan.getInt("scale_factor");
 	if (scale == -1) {
 		warning("Unknown scaler; defaulting to 1");
 		scale = 1;
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index 9b004848872..b00ffae014c 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -153,10 +153,7 @@ protected:
 	/** Obtain the user configured fullscreen resolution, or default to the desktop resolution */
 	Common::Rect getPreferredFullscreenResolution();
 
-	virtual int getGraphicsModeScale(int mode) const = 0;
-
 	bool defaultGraphicsModeConfig() const;
-	int getGraphicsModeIdByName(const Common::String &name) const;
 
 	/**
 	 * Gets the dimensions of the window directly from SDL instead of from the
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 153c882e98d..119b83e29e5 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -559,11 +559,6 @@ void SurfaceSdlGraphicsManager::detectSupportedFormats() {
 }
 #endif
 
-int SurfaceSdlGraphicsManager::getGraphicsModeScale(int mode) const {
-	// TODO: I'm not 100% sure this is correct...
-	return _videoMode.scaleFactor;
-}
-
 uint SurfaceSdlGraphicsManager::getDefaultScaler() const {
 	return ScalerMan.findScalerPluginIndex("normal");
 }
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 3507339f86f..ec39a7da306 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -174,8 +174,6 @@ protected:
 
 	void handleResizeImpl(const int width, const int height) override;
 
-	int getGraphicsModeScale(int mode) const override;
-
 	virtual void setupHardwareSize();
 
 	void fixupResolutionForAspectRatio(AspectRatio desiredAspectRatio, int &width, int &height) const;
diff --git a/backends/graphics3d/openglsdl/openglsdl-graphics3d.h b/backends/graphics3d/openglsdl/openglsdl-graphics3d.h
index 768a46f0ca7..35a7a79204d 100644
--- a/backends/graphics3d/openglsdl/openglsdl-graphics3d.h
+++ b/backends/graphics3d/openglsdl/openglsdl-graphics3d.h
@@ -108,7 +108,6 @@ public:
 	void notifyResize(const int width, const int height) override;
 
 	bool gameNeedsAspectRatioCorrection() const override { return false; }
-	int getGraphicsModeScale(int mode) const override { return 1; }
 
 	void transformMouseCoordinates(Common::Point &point);
 	bool notifyMousePosition(Common::Point &mouse) override {




More information about the Scummvm-git-logs mailing list