Skip to content

Commit

Permalink
Merge pull request #17359 from hrydgard/integer-scale-factor-fix
Browse files Browse the repository at this point in the history
Less broken behavior with integer scale factor + auto render resolution
  • Loading branch information
hrydgard committed Apr 30, 2023
2 parents 6459f75 + 02880d7 commit 07b2828
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion GPU/Common/PresentationCommon.cpp
Expand Up @@ -125,9 +125,20 @@ void CalculateDisplayOutputRect(FRect *rc, float origW, float origH, const FRect
if (rotated) {
wDim = 272.0f;
}

int zoom = g_Config.iInternalResolution;
if (zoom == 0) {
// Auto (1:1) mode, not super meaningful with integer scaling, but let's do something that makes
// some sense. use the longest dimension, just to have something. round down.
if (!g_Config.IsPortrait()) {
zoom = (PSP_CoreParameter().pixelWidth) / 480;
} else {
zoom = (PSP_CoreParameter().pixelHeight) / 480;
}
}
// If integer scaling, limit ourselves to even multiples of the rendered resolution,
// to make sure all the pixels are square.
wDim *= g_Config.iInternalResolution;
wDim *= zoom;
outW = std::max(1.0f, floorf(outW / wDim)) * wDim;
outH = outW / origRatio;
}
Expand Down

0 comments on commit 07b2828

Please sign in to comment.