OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" | 5 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include <pango/pango.h> | 10 #include <pango/pango.h> |
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1431 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) { | 1431 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) { |
1432 device_scale_factor_ = device_scale_factor; | 1432 device_scale_factor_ = device_scale_factor; |
1433 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); | 1433 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); |
1434 UpdateDefaultFont(label_style->font_desc); | 1434 UpdateDefaultFont(label_style->font_desc); |
1435 } | 1435 } |
1436 | 1436 |
1437 float Gtk2UI::GetDeviceScaleFactor() const { | 1437 float Gtk2UI::GetDeviceScaleFactor() const { |
1438 if (gfx::Display::HasForceDeviceScaleFactor()) | 1438 if (gfx::Display::HasForceDeviceScaleFactor()) |
1439 return gfx::Display::GetForcedDeviceScaleFactor(); | 1439 return gfx::Display::GetForcedDeviceScaleFactor(); |
1440 const int kCSSDefaultDPI = 96; | 1440 const int kCSSDefaultDPI = 96; |
1441 float scale = GetDPI() / kCSSDefaultDPI; | 1441 const float scale = GetDPI() / kCSSDefaultDPI; |
1442 // Round to 1 decimal, e.g. to 1.4. | 1442 // Round to 1 decimal, e.g. to 1.4. |
1443 return roundf(scale * 10) / 10; | 1443 const float rounded = roundf(scale * 10) / 10; |
1444 // See crbug.com/484400 | |
1445 return (rounded < 1.3 ? 1.0 : rounded); | |
Evan Stade
2015/08/28 14:54:11
nit, no parens
| |
1444 } | 1446 } |
1445 | 1447 |
1446 } // namespace libgtk2ui | 1448 } // namespace libgtk2ui |
1447 | 1449 |
1448 views::LinuxUI* BuildGtk2UI() { | 1450 views::LinuxUI* BuildGtk2UI() { |
1449 return new libgtk2ui::Gtk2UI; | 1451 return new libgtk2ui::Gtk2UI; |
1450 } | 1452 } |
OLD | NEW |