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

Unified Diff: ui/base/resource/resource_bundle_win.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/base/resource/resource_bundle.cc ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aad1ef10e83ed42b472a03c82510f52310d40163..993755f08d5ee74e26cbbc817204b0f289b33e21 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;
#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 {
+ 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);
}
}
« no previous file with comments | « ui/base/resource/resource_bundle.cc ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698