Add option to enable or disable auto-scale

This commit is contained in:
elasota
2020-06-20 01:33:26 -04:00
parent 1981320afe
commit 3c662845b4
8 changed files with 70 additions and 29 deletions

View File

@@ -31,6 +31,8 @@
#define kDisplay12Inch 2
#define kDisplay13Inch 3
extern Boolean isAutoScale;
typedef struct
{
@@ -327,15 +329,20 @@ public:
if (physicalHeight < 480)
physicalHeight = 480;
double xMul = static_cast<double>(physicalWidth) / 640;
double yMul = static_cast<double>(physicalHeight) / 480;
double minMul = 1.0;
double granularity = 2.0;
if (isAutoScale)
{
double xMul = static_cast<double>(physicalWidth) / 640.0;
double yMul = static_cast<double>(physicalHeight) / 480.0;
xMul = floor(xMul * granularity) / granularity;
yMul = floor(yMul * granularity) / granularity;
double granularity = 2.0;
double minMul = std::max<double>(1.0, std::min(xMul, yMul));
xMul = floor(xMul * granularity) / granularity;
yMul = floor(yMul * granularity) / granularity;
minMul = std::max<double>(1.0, std::min(xMul, yMul));
}
virtualWidth = physicalWidth / minMul;
virtualHeight = physicalHeight / minMul;