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

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: Removed unnecessary include 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..7722ddb443e3b43a085655f16067753c47aaeb05 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -109,7 +109,7 @@ class ResourceBundle::ResourceBundleImageSource : public gfx::ImageSkiaSource {
if (!found)
return gfx::ImageSkiaRep();
- float loaded_image_scale = ui::GetImageScale(scale_factor);
+ float loaded_image_scale = ui::GetImageScaleForScaleFactor(scale_factor);
if (fell_back_to_1x) {
// GRIT fell back to the 100% image, so rescale it to the correct size.
@@ -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) || defined(OS_WIN)
+ ui::ScaleFactor scale_factor_to_load = GetMaxScaleFactor();
+#else
+ ui::ScaleFactor scale_factor_to_load = ui::SCALE_FACTOR_100P;
+#endif
+
+ float scale = GetImageScale(scale_factor_to_load);
// TODO(oshima): Consider reading the image size from png IHDR chunk and
// skip decoding here and remove #ifdef below.
@@ -823,15 +829,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