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

Unified Diff: ui/base/resource/resource_bundle.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: Fix try server errors 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
Index: ui/base/resource/resource_bundle.cc
diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
index 2c505595cb56365977fb2326f9eab0b20869da7c..53a763bbf249bcd27d8fdb7d6f9562fcba9188df 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -353,7 +353,13 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
DCHECK(!data_packs_.empty()) <<
"Missing call to SetResourcesDataDLL?";
- float scale = PlatformGetImageScale();
+#if defined(OS_CHROMEOS)
+ ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor();
+#else
+ ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
+#endif
+
+ float scale = PlatformGetImageScale(scale_factor_to_load);
// TODO(oshima): Consider reading the image size from png IHDR chunk and
// skip decoding here and remove #ifdef below.
@@ -527,6 +533,14 @@ ScaleFactor ResourceBundle::GetMaxScaleFactor() const {
#endif
}
+#if !defined(OS_WIN)
+// static
+float ResourceBundle::PlatformGetImageScale(
+ ui::ScaleFactor scale_factor) {
+ return GetImageScale(scale_factor);
+}
+#endif
+
ResourceBundle::ResourceBundle(Delegate* delegate)
: delegate_(delegate),
images_and_fonts_lock_(new base::Lock),
@@ -823,15 +837,6 @@ SkBitmap ResourceBundle::PlatformScaleImage(const SkBitmap& image,
float desired_scale) {
return image;
}
-
-float ResourceBundle::PlatformGetImageScale() {
-#if defined(OS_CHROMEOS)
- ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor();
-#else
- ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
-#endif
- return GetImageScale(scale_factor_to_load);
-}
#endif
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698