- Pixel stretch 320x200 and 640x400 scale modes in the GL renderer

This commit is contained in:
Magnus Norddahl 2017-07-23 17:18:25 +02:00
parent 45a37211e4
commit 449c4cb711

View file

@ -282,9 +282,19 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
} }
int screenWidth = framebuffer->GetWidth(); int screenWidth = framebuffer->GetWidth();
int screenHeight = framebuffer->GetHeight(); int screenHeight = framebuffer->GetHeight();
float scale = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight); float scaleX, scaleY;
mOutputLetterbox.width = (int)round(screenWidth * scale); if (vid_scalemode == 1 || vid_scalemode == 2)
mOutputLetterbox.height = (int)round(screenHeight * scale); {
scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (screenHeight * 1.2f));
scaleY = scaleX * 1.2f;
}
else
{
scaleX = MIN(clientWidth / (float)screenWidth, clientHeight / (float)screenHeight);
scaleY = scaleX;
}
mOutputLetterbox.width = (int)round(screenWidth * scaleX);
mOutputLetterbox.height = (int)round(screenHeight * scaleY);
mOutputLetterbox.left = (clientWidth - mOutputLetterbox.width) / 2; mOutputLetterbox.left = (clientWidth - mOutputLetterbox.width) / 2;
mOutputLetterbox.top = (clientHeight - mOutputLetterbox.height) / 2; mOutputLetterbox.top = (clientHeight - mOutputLetterbox.height) / 2;
@ -305,10 +315,10 @@ void FGLRenderer::SetOutputViewport(GL_IRECT *bounds)
{ {
mScreenViewport.width = mOutputLetterbox.width; mScreenViewport.width = mOutputLetterbox.width;
mScreenViewport.height = mOutputLetterbox.height; mScreenViewport.height = mOutputLetterbox.height;
mSceneViewport.left = (int)round(mSceneViewport.left * scale); mSceneViewport.left = (int)round(mSceneViewport.left * scaleX);
mSceneViewport.top = (int)round(mSceneViewport.top * scale); mSceneViewport.top = (int)round(mSceneViewport.top * scaleY);
mSceneViewport.width = (int)round(mSceneViewport.width * scale); mSceneViewport.width = (int)round(mSceneViewport.width * scaleX);
mSceneViewport.height = (int)round(mSceneViewport.height * scale); mSceneViewport.height = (int)round(mSceneViewport.height * scaleY);
// Without render buffers we have to render directly to the letterbox // Without render buffers we have to render directly to the letterbox
if (!FGLRenderBuffers::IsEnabled()) if (!FGLRenderBuffers::IsEnabled())