Adress typo in gpuident and add extra checks on the recommended scale value

This commit is contained in:
Sam Gateau 2019-07-06 01:13:38 +02:00
parent 1aa067db74
commit b4e86741e0
2 changed files with 7 additions and 4 deletions

View file

@ -70,12 +70,15 @@ void PerformanceManager::applyPerformancePreset(PerformanceManager::PerformanceP
auto masterDisplay = platform::getDisplay(platform::getMasterDisplay());
// eval recommanded PPI and Scale
float ppi{96};
float recommandedPpiScale = 1.0f;
const float RECOMMANDED_PPI[] = { 200.0f, 120.f, 160.f, 250.f};
if (!masterDisplay.empty() && masterDisplay.count(platform::keys::display::ppi)) {
ppi = masterDisplay[platform::keys::display::ppi];
recommandedPpiScale = std::min(1.0f, RECOMMANDED_PPI[preset] / (float) ppi);
float ppi = masterDisplay[platform::keys::display::ppi];
// only scale if the actual ppi is higher than the recommended ppi
if (ppi > RECOMMANDED_PPI[preset]) {
// make sure the scale is no less than a quarter
recommandedPpiScale = std::max(0.25f, RECOMMANDED_PPI[preset] / (float) ppi);
}
}
switch (preset) {

View file

@ -289,7 +289,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer)
nlohmann::json output = {};
output["model"] = deviceName;
output["coordsinatesleft"] = test->DesktopCoordinates.left;
output["coordinatesleft"] = test->DesktopCoordinates.left;
output["coordinatesright"] = test->DesktopCoordinates.right;
output["coordinatestop"] = test->DesktopCoordinates.top;
output["coordinatesbottom"] = test->DesktopCoordinates.bottom;