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

Unified Diff: ui/base/layout.cc

Issue 211493009: Ensure that extension resources are loaded with the correct scaling applied on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Compositing browser tests high dpi Created 6 years, 9 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/base/layout.h ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/layout.cc
diff --git a/ui/base/layout.cc b/ui/base/layout.cc
index 2c1fb51a3952706e1f6d77a0b2f29a46c2508124..01c38f1d5414cc431705df7021de457b2b774113 100644
--- a/ui/base/layout.cc
+++ b/ui/base/layout.cc
@@ -20,6 +20,7 @@
#if defined(OS_WIN)
#include "base/win/metro.h"
+#include "ui/gfx/win/dpi.h"
#include <Windows.h>
#endif // defined(OS_WIN)
@@ -90,7 +91,7 @@ void SetSupportedScaleFactors(
for (std::vector<ScaleFactor>::const_iterator it =
g_supported_scale_factors->begin();
it != g_supported_scale_factors->end(); ++it) {
- scales.push_back(GetImageScale(*it));
+ scales.push_back(kScaleFactorScales[*it]);
}
gfx::ImageSkia::SetSupportedScales(scales);
}
@@ -117,7 +118,11 @@ ScaleFactor GetSupportedScaleFactor(float scale) {
}
float GetImageScale(ScaleFactor scale_factor) {
- return kScaleFactorScales[scale_factor];
+#if defined(OS_WIN)
+ if (gfx::IsHighDPIEnabled())
+ return gfx::win::GetDeviceScaleFactor();
+#endif
+ return GetScaleForScaleFactor(scale_factor);
}
bool IsScaleFactorSupported(ScaleFactor scale_factor) {
@@ -144,6 +149,10 @@ ScaleFactor FindClosestScaleFactorUnsafe(float scale) {
return closest_match;
}
+float GetScaleForScaleFactor(ScaleFactor scale_factor) {
+ return kScaleFactorScales[scale_factor];
+}
+
namespace test {
ScopedSetSupportedScaleFactors::ScopedSetSupportedScaleFactors(
« no previous file with comments | « ui/base/layout.h ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698