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

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

Issue 1825863002: Allow windows to use both 100P, 200P assets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/resource/resource_bundle.cc
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index 8afa15b608988d97be8981edc0f61467667a3c13..af674403333e5bb2feba3007758f9bf395eb808b 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -390,12 +390,14 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
DCHECK(!data_packs_.empty()) <<
"Missing call to SetResourcesDataDLL?";
-#if defined(OS_CHROMEOS) || defined(OS_WIN)
- ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor();
+#if defined(OS_CHROMEOS)
+ ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor();
+#if defined(OS_WIN)
+ ui::ScaleFactor scale_factor_to_load =
+ gfx::GetDPIScale() > 1.25 ? GetMaxScaleFactor() : ui::SCALE_FACTOR_100P;
#else
- ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
+ ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
#endif
-
// TODO(oshima): Consider reading the image size from png IHDR chunk and
// skip decoding here and remove #ifdef below.
// ResourceBundle::GetSharedInstance() is destroyed after the
@@ -610,7 +612,7 @@ void ResourceBundle::ReloadFonts() {
}
ScaleFactor ResourceBundle::GetMaxScaleFactor() const {
-#if defined(OS_CHROMEOS) || defined(OS_WIN)
+#if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_LINUX)
return max_scale_factor_;
#else
return GetSupportedScaleFactors().back();
@@ -642,7 +644,7 @@ void ResourceBundle::InitSharedInstance(Delegate* delegate) {
DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice";
g_shared_instance_ = new ResourceBundle(delegate);
static std::vector<ScaleFactor> supported_scale_factors;
-#if !defined(OS_IOS) && !defined(OS_WIN)
+#if !defined(OS_IOS)
// On platforms other than iOS, 100P is always a supported scale factor.
// For Windows we have a separate case in this function.
supported_scale_factors.push_back(SCALE_FACTOR_100P);
@@ -672,22 +674,8 @@ void ResourceBundle::InitSharedInstance(Delegate* delegate) {
#elif defined(OS_MACOSX)
if (base::mac::IsOSLionOrLater())
supported_scale_factors.push_back(SCALE_FACTOR_200P);
-#elif defined(OS_CHROMEOS)
- // TODO(oshima): Include 200P only if the device support 200P
+#elif defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_WIN)
supported_scale_factors.push_back(SCALE_FACTOR_200P);
-#elif defined(OS_LINUX) && BUILDFLAG(ENABLE_HIDPI)
- supported_scale_factors.push_back(SCALE_FACTOR_200P);
-#elif defined(OS_WIN)
- bool default_to_100P = true;
- // On Windows if the dpi scale is greater than 1.25 on high dpi machines
- // downscaling from 200 percent looks better than scaling up from 100
- // percent.
oshima 2016/03/28 18:46:47 ImageSkia uses 2.0 assets for 1.25 so this is no l
- if (gfx::GetDPIScale() > 1.25) {
- supported_scale_factors.push_back(SCALE_FACTOR_200P);
- default_to_100P = false;
- }
- if (default_to_100P)
- supported_scale_factors.push_back(SCALE_FACTOR_100P);
#endif
ui::SetSupportedScaleFactors(supported_scale_factors);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698