SDL: Replace gfx_mode with scale_factor in initSizeHint()

This commit is contained in:
Cameron Cawley 2022-01-14 21:25:28 +00:00 committed by Filippos Karapetis
parent 42bc12a007
commit a14c5a4a53
6 changed files with 1 additions and 41 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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

View file

@ -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");
}

View file

@ -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;

View file

@ -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 {