Commit b1ac0546 authored by Stephen Chenney's avatar Stephen Chenney Committed by Chromium LUCI CQ

Round the deviceScaleFactor for GTK

A previous change,
https://crrev.com/54668d23a68b82a35be7359cce9e4569e178cf6f,
removed rounding of the scale factor for GTK platforms.
This resulting in blurry content for some users with desktop
environments that give deviceScaleFactors of 1.002 and similar.

To address the problem, round the scale to 2 decimal places.

Fixed: 1087109
Change-Id: I17364d69facc3745528a8971bb2616ff76eb9b25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2639816Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845887}
parent eea2de39
...@@ -1073,14 +1073,13 @@ float GtkUi::GetRawDeviceScaleFactor() { ...@@ -1073,14 +1073,13 @@ float GtkUi::GetRawDeviceScaleFactor() {
DCHECK_GT(scale, 0.0); DCHECK_GT(scale, 0.0);
gdouble resolution = gdk_screen_get_resolution(screen); gdouble resolution = gdk_screen_get_resolution(screen);
// TODO(https://crbug.com/1033552): Remove this hack once the Trusty bots are
// fixed to have a resolution of 96, or when the Trusty bots are removed
// altogether.
if (std::abs(resolution - 95.8486) < 0.001)
resolution = 96;
if (resolution > 0) if (resolution > 0)
scale *= resolution / kDefaultDPI; scale *= resolution / kDefaultDPI;
// Round to 2 decimal places to address problems with some Linux desktop
// environments that result in scales of 1.002... and the like.
scale = roundf(scale * 100.0) / 100;
return scale; return scale;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment