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

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: Fixed Compositing browser tests high dpi 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
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/resource/resource_bundle_win.cc » ('j') | 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 2c505595cb56365977fb2326f9eab0b20869da7c..daea33fe880aa4d369efbcb94fe81ff14f96e326 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -109,8 +109,6 @@ class ResourceBundle::ResourceBundleImageSource : public gfx::ImageSkiaSource {
if (!found)
return gfx::ImageSkiaRep();
- float loaded_image_scale = ui::GetImageScale(scale_factor);
-
if (fell_back_to_1x) {
// GRIT fell back to the 100% image, so rescale it to the correct size.
image = skia::ImageOperations::Resize(
@@ -132,7 +130,9 @@ class ResourceBundle::ResourceBundleImageSource : public gfx::ImageSkiaSource {
image = SkBitmapOperations::CreateBlendedBitmap(image, mask, 0.2);
}
} else {
- image = PlatformScaleImage(image, loaded_image_scale, scale);
+ image = PlatformScaleImage(image,
+ ui::GetScaleForScaleFactor(scale_factor),
+ scale);
}
return gfx::ImageSkiaRep(image, scale);
}
@@ -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
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/resource/resource_bundle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698