Loosen minimum screen size detection code for output scale calculation

We return early for screens with physical height reported as ≤ 0mm.

However some extremely dumb screens report a value for their height
greater than zero but absurdly small, causing the scale calculator to
go ballistic. Theoretically this could happen for widths, too.

Let's loosen the detection to flag a physical screen size as invalid if
either its width or height is less than 3mm. There is no screen that
can possibly make sense to exist at this physical size given the angular
resolution of the human eyeball. And if for some reason it does, 100%
scale is fine for it.

BUG: 490777
FIXED-IN: 6.2.0
This commit is contained in:
Nate Graham 2024-07-29 16:16:01 -06:00
parent 93e794435f
commit f015b73a48

View file

@ -527,8 +527,9 @@ std::shared_ptr<OutputMode> OutputConfigurationStore::chooseMode(Output *output)
double OutputConfigurationStore::chooseScale(Output *output, OutputMode *mode) const
{
if (output->physicalSize().height() <= 0) {
// invalid size, can't do anything with this
if (output->physicalSize().height() < 3 || output->physicalSize().width() < 3) {
// A screen less than 3mm wide or tall doesn't make any sense; these are
// all caused by the screen mis-reporting its size.
return 1.0;
}
const double outputDpi = mode->size().height() / (output->physicalSize().height() / 25.4);