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

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

Issue 659883002: Enable hidpi on Linux, refactor a bit on Windows to share Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 6 years, 2 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.cc
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index c4d70b29841aafe3e788bd266d948da96cf61533..4f74afb5a9f222a2ae7a0edd2d86f99272c294d9 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -29,6 +29,7 @@
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"
+#include "ui/gfx/dpi.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_source.h"
#include "ui/gfx/safe_integer_conversions.h"
@@ -45,11 +46,6 @@
#include "ui/gfx/platform_font_pango.h"
#endif
-#if defined(OS_WIN)
-#include "ui/base/win/dpi_setup.h"
-#include "ui/gfx/win/dpi.h"
-#endif
-
#if defined(OS_MACOSX) && !defined(OS_IOS)
#include "base/mac/mac_util.h"
#endif
@@ -386,7 +382,7 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
DCHECK(!data_packs_.empty()) <<
"Missing call to SetResourcesDataDLL?";
-#if defined(OS_CHROMEOS) || defined(OS_WIN)
+#if defined(OS_CHROMEOS) || defined(OS_WIN) || defined(OS_LINUX)
ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor();
#else
ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
@@ -626,7 +622,7 @@ void ResourceBundle::InitSharedInstance(Delegate* delegate) {
#elif defined(OS_CHROMEOS)
// TODO(oshima): Include 200P only if the device support 200P
supported_scale_factors.push_back(SCALE_FACTOR_200P);
-#elif defined(OS_LINUX) && defined(ENABLE_HIDPI)
+#elif defined(OS_LINUX)
supported_scale_factors.push_back(SCALE_FACTOR_200P);
#elif defined(OS_WIN)
bool default_to_100P = true;
@@ -643,13 +639,13 @@ void ResourceBundle::InitSharedInstance(Delegate* delegate) {
supported_scale_factors.push_back(SCALE_FACTOR_100P);
#endif
ui::SetSupportedScaleFactors(supported_scale_factors);
-#if defined(OS_WIN)
+#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
// Must be called _after_ supported scale factors are set since it
// uses them.
// Don't initialize the device scale factor if it has already been
// initialized.
- if (!gfx::win::IsDeviceScaleFactorSet())
- ui::win::InitDeviceScaleFactor();
+ if (!gfx::IsDeviceScaleFactorSet())
+ gfx::InitDeviceScaleFactor(gfx::GetDPIScale());
#endif
}
« no previous file with comments | « ui/base/layout.cc ('k') | ui/base/resource/resource_bundle_unittest.cc » ('j') | ui/gfx/dpi.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698