OPENGL: Fix aspect ratio correction behavior.
Now only 320x200 and 640x400 will result in aspect ratio correction to be used if the user requested it. This should fix some strechting in Myst/Riven.
This commit is contained in:
parent
a77c29327e
commit
b8dcd9a25e
3 changed files with 18 additions and 14 deletions
|
@ -1245,12 +1245,16 @@ void OpenGLGraphicsManager::toggleAntialiasing() {
|
||||||
_transactionDetails.filterChanged = true;
|
_transactionDetails.filterChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint OpenGLGraphicsManager::getAspectRatio() {
|
uint OpenGLGraphicsManager::getAspectRatio() const {
|
||||||
// In case we enable aspect ratio correction we force a 4/3 ratio.
|
// In case we enable aspect ratio correction we force a 4/3 ratio.
|
||||||
|
// But just for 320x200 and 640x400 games, since other games do not need
|
||||||
|
// this.
|
||||||
// TODO: This makes OpenGL Normal behave like OpenGL Conserve, when aspect
|
// TODO: This makes OpenGL Normal behave like OpenGL Conserve, when aspect
|
||||||
// ratio correction is enabled, but it's better than the previous 4/3 mode
|
// ratio correction is enabled, but it's better than the previous 4/3 mode
|
||||||
// mess at least...
|
// mess at least...
|
||||||
if (_videoMode.aspectRatioCorrection)
|
if (_videoMode.aspectRatioCorrection
|
||||||
|
&& ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
|
||||||
|
|| (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
|
||||||
return 13333;
|
return 13333;
|
||||||
else if (_videoMode.mode == OpenGL::GFX_NORMAL)
|
else if (_videoMode.mode == OpenGL::GFX_NORMAL)
|
||||||
return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
|
return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
|
||||||
|
|
|
@ -214,10 +214,7 @@ protected:
|
||||||
virtual void calculateDisplaySize(int &width, int &height);
|
virtual void calculateDisplaySize(int &width, int &height);
|
||||||
virtual void refreshDisplaySize();
|
virtual void refreshDisplaySize();
|
||||||
|
|
||||||
/**
|
uint getAspectRatio() const;
|
||||||
* Returns the current target aspect ratio x 10000
|
|
||||||
*/
|
|
||||||
virtual uint getAspectRatio();
|
|
||||||
|
|
||||||
bool _formatBGR;
|
bool _formatBGR;
|
||||||
|
|
||||||
|
|
|
@ -313,14 +313,17 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
|
||||||
_videoMode.overlayWidth = _videoMode.hardwareWidth = _videoMode.screenWidth * scaleFactor;
|
_videoMode.overlayWidth = _videoMode.hardwareWidth = _videoMode.screenWidth * scaleFactor;
|
||||||
_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;
|
_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;
|
||||||
|
|
||||||
int screenAspectRatio = _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
|
// The only modes where we need to adapt the aspect ratio are 320x200
|
||||||
int desiredAspectRatio = getAspectRatio();
|
// and 640x400. That is since our aspect ratio correction in fact is
|
||||||
|
// only used to ensure that the original pixel size aspect for these
|
||||||
// Do not downscale dimensions, only enlarge them if needed
|
// modes is used.
|
||||||
if (screenAspectRatio > desiredAspectRatio)
|
// (Non-square pixels on old monitors vs square pixel on new ones).
|
||||||
_videoMode.hardwareHeight = (_videoMode.overlayWidth * 10000 + 5000) / desiredAspectRatio;
|
if (_videoMode.aspectRatioCorrection
|
||||||
else if (screenAspectRatio < desiredAspectRatio)
|
&& ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
|
||||||
_videoMode.hardwareWidth = (_videoMode.overlayHeight * desiredAspectRatio + 5000) / 10000;
|
|| (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
|
||||||
|
_videoMode.overlayHeight = _videoMode.hardwareHeight = 240 * scaleFactor;
|
||||||
|
else
|
||||||
|
_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
_screenResized = false;
|
_screenResized = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue