Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3657)

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 1078423002: Allow arbitrary scale factors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow arbitrary scale factors. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | testing/xvfb.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index a57b59fb7905762f861446e6587b52f536adf2dc..bb150f56d3f063a3f0d63635da2bcc632db3a17c 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
+#include <math.h>
#include <set>
#include <pango/pango.h>
@@ -1426,8 +1427,9 @@ void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) {
float Gtk2UI::GetDeviceScaleFactor() const {
const int kCSSDefaultDPI = 96;
- const float scale = GetDPI() / kCSSDefaultDPI;
- return ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactor(scale));
+ float scale = GetDPI() / kCSSDefaultDPI;
+ // Round to 2 decimals, e.g. to 1.33.
+ return roundf(scale * 100) / 100;
}
} // namespace libgtk2ui
« no previous file with comments | « no previous file | testing/xvfb.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698