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

Unified Diff: ui/base/resource/resource_bundle_win.cc

Issue 11953054: Fix high-DPI on Windows to make use of DIP scaling in WebKit. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Code cleanup. Created 7 years, 11 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
Index: ui/base/resource/resource_bundle_win.cc
diff --git a/ui/base/resource/resource_bundle_win.cc b/ui/base/resource/resource_bundle_win.cc
index 0f6092d17996cf85d2bb3427ff5636f81cce6a10..e590291d0e8b9d48a8ef01c12913ab3ac63b25c3 100644
--- a/ui/base/resource/resource_bundle_win.cc
+++ b/ui/base/resource/resource_bundle_win.cc
@@ -41,31 +41,38 @@ void ResourceBundle::LoadCommonResources() {
bool use_hidpi = false;
#if defined(ENABLE_HIDPI)
- // If we're running in HiDPI mode at a scale larger than 150%, we switch
- // to 2x resources for desktop layouts.
- use_hidpi = ui::GetDPIScale() > 1.5;
+ // Have high-DPI resources for 140% and 180% scaling on Windows based on
+ // default scaling for Metro mode. If high-DPI mode is enabled, load resource
+ // pak closest to the desired scale factor.
+ use_hidpi = ui::GetDPIScale() > 1.2;
pkotwicz 2013/01/23 18:13:12 For the purpose of this CL, you actually do not ne
kevers 2013/01/23 20:02:19 Backing this change out for the time being. Will
#endif
- switch (ui::GetDisplayLayout()) {
- case ui::LAYOUT_TOUCH:
- AddDataPackFromPath(
- GetResourcesPakFilePath("chrome_touch_100_percent.pak"),
- SCALE_FACTOR_100P);
- break;
- default:
- if (use_hidpi) {
- AddDataPackFromPath(GetResourcesPakFilePath(
- "chrome_200_percent.pak"),
- SCALE_FACTOR_200P);
- AddDataPackFromPath(GetResourcesPakFilePath(
- "webkit_resources_200_percent.pak"),
- SCALE_FACTOR_200P);
- } else {
- AddDataPackFromPath(
- GetResourcesPakFilePath("chrome_100_percent.pak"),
- SCALE_FACTOR_100P);
- }
- break;
+ if (use_hidpi) {
+ float scale = ui::GetDPIScale();
+ if (scale > 1.6f) {
+ AddDataPackFromPath(GetResourcesPakFilePath(
+ "chrome_touch_180_percent.pak"),
+ SCALE_FACTOR_180P);
+ } else {
pkotwicz 2013/01/23 18:13:12 Nit: Put a comment that we will be using 1.4x reso
kevers 2013/01/23 20:02:19 Backing out change for now.
+ AddDataPackFromPath(GetResourcesPakFilePath(
+ "chrome_touch_140_percent.pak"),
+ SCALE_FACTOR_140P);
+ }
+
+ // Currently missing some scaled assets. 100% resources required as
+ // fallback.
+ AddDataPackFromPath(
+ GetResourcesPakFilePath("chrome_100_percent.pak"),
+ SCALE_FACTOR_100P);
+
+ } else if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) {
+ AddDataPackFromPath(
+ GetResourcesPakFilePath("chrome_touch_100_percent.pak"),
+ SCALE_FACTOR_100P);
+ } else {
+ AddDataPackFromPath(
+ GetResourcesPakFilePath("chrome_100_percent.pak"),
+ SCALE_FACTOR_100P);
}
}

Powered by Google App Engine
This is Rietveld 408576698