Commit b3ca230d authored by stapelberg's avatar stapelberg Committed by Commit bot

Allow arbitrary scale factors.

As discussed in https://codereview.chromium.org/1070433002/, this CL
allows arbitrary scale factors, which works because chromium uses the
resource most closely matching the scale factor (e.g. 1x for 1.25x,
but 2x for 1.9x) and scales it.

BUG=143619

Review URL: https://codereview.chromium.org/1078423002

Cr-Commit-Position: refs/heads/master@{#326851}
parent ccbe99a8
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
#include <math.h>
#include <set> #include <set>
#include <pango/pango.h> #include <pango/pango.h>
...@@ -1427,8 +1428,9 @@ void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) { ...@@ -1427,8 +1428,9 @@ void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) {
float Gtk2UI::GetDeviceScaleFactor() const { float Gtk2UI::GetDeviceScaleFactor() const {
const int kCSSDefaultDPI = 96; const int kCSSDefaultDPI = 96;
const float scale = GetDPI() / kCSSDefaultDPI; float scale = GetDPI() / kCSSDefaultDPI;
return ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(scale)); // Round to 2 decimals, e.g. to 1.33.
return roundf(scale * 100) / 100;
} }
} // namespace libgtk2ui } // namespace libgtk2ui
......
...@@ -50,7 +50,7 @@ def start_xvfb(xvfb_path, display): ...@@ -50,7 +50,7 @@ def start_xvfb(xvfb_path, display):
xvfb_path: Path to Xvfb. xvfb_path: Path to Xvfb.
""" """
cmd = [xvfb_path, display, '-screen', '0', '1024x768x24', '-ac', cmd = [xvfb_path, display, '-screen', '0', '1024x768x24', '-ac',
'-nolisten', 'tcp'] '-nolisten', 'tcp', '-dpi', '96']
try: try:
proc = subprocess.Popen( proc = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
......
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