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

Unified Diff: ui/gfx/display.cc

Issue 12257016: (Not ready for review!) Toolbar and views high dpi support. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up more useless diffs. Created 7 years, 10 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 | « ui/gfx/display.h ('k') | ui/gfx/screen_win.cc » ('j') | 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 40608a1d21127d265463131cb069199d6015942b..a5b386c8465f2f53dd9520b56331988adf3f38d3 100644
--- a/ui/gfx/display.cc
+++ b/ui/gfx/display.cc
@@ -29,6 +29,13 @@ float GetForcedDeviceScaleFactorImpl() {
if (!base::StringToDouble(value, &scale_in_double))
LOG(ERROR) << "Failed to parse the default device scale factor:" << value;
}
+#if defined(OS_WIN)
+ else {
+ static double os_scale = ui::GetDPIScale();
+ scale_in_double = os_scale;
+ }
+#endif
+
return static_cast<float>(scale_in_double);
}
@@ -42,12 +49,12 @@ float Display::GetForcedDeviceScaleFactor() {
GetForcedDeviceScaleFactorImpl();
return kForcedDeviceScaleFactor;
}
-
//static
bool Display::HasForceDeviceScaleFactor() {
return HasForceDeviceScaleFactorImpl();
}
+
// static
int64 Display::GetID(uint16 manufacturer_id,
uint16 product_code,
@@ -73,7 +80,7 @@ Display::Display(int64 id, const gfx::Rect& bounds)
bounds_(bounds),
work_area_(bounds),
device_scale_factor_(GetForcedDeviceScaleFactor()) {
-#if defined(USE_AURA)
+#if defined(USE_AURA) // || defined(OS_WIN)
SetScaleAndBounds(device_scale_factor_, bounds);
#endif
}
@@ -101,7 +108,7 @@ void Display::SetScaleAndBounds(
device_scale_factor_ = device_scale_factor;
}
device_scale_factor_ = std::max(1.0f, device_scale_factor_);
-#if defined(USE_AURA)
+#if defined(USE_AURA) || defined(OS_WIN)
bounds_in_pixel_ = bounds_in_pixel;
#endif
bounds_ = gfx::Rect(gfx::ToFlooredSize(
@@ -112,7 +119,7 @@ void Display::SetScaleAndBounds(
void Display::SetSize(const gfx::Size& size_in_pixel) {
SetScaleAndBounds(
device_scale_factor_,
-#if defined(USE_AURA)
+#if defined(USE_AURA) || defined(OS_WIN)
gfx::Rect(bounds_in_pixel_.origin(), size_in_pixel));
#else
gfx::Rect(bounds_.origin(), size_in_pixel));
« no previous file with comments | « ui/gfx/display.h ('k') | ui/gfx/screen_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698