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

Unified Diff: ui/gfx/display.cc

Issue 11348033: Initialize device scale factor correctly on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't truncate scale factor on Chrome OS. Created 8 years, 1 month 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 | « content/renderer/render_widget.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/display.cc
diff --git a/ui/gfx/display.cc b/ui/gfx/display.cc
index ef3f250a483d113770958e5003f37b2d1507044b..5b375891ad0fa271aae4cc990c0f116a724eabc7 100644
--- a/ui/gfx/display.cc
+++ b/ui/gfx/display.cc
@@ -83,8 +83,15 @@ void Display::SetScaleAndBounds(
float device_scale_factor,
const gfx::Rect& bounds_in_pixel) {
Insets insets = bounds_.InsetsFrom(work_area_);
- if (!HasForceDeviceScaleFactor())
+ if (!HasForceDeviceScaleFactor()) {
+#if defined(OS_MACOSX)
sky 2012/11/15 17:23:52 Shouldn't this be done at the call site and not he
+ // Unless an explicit scale factor was provided for testing, ensure the
+ // scale is integral.
+ device_scale_factor = static_cast<int>(device_scale_factor);
+#endif
device_scale_factor_ = device_scale_factor;
+ }
+ device_scale_factor_ = std::max(1.0f, device_scale_factor_);
#if defined(USE_AURA)
bounds_in_pixel_ = bounds_in_pixel;
#endif
« no previous file with comments | « content/renderer/render_widget.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698