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

Unified Diff: ui/base/resource/resource_bundle_ios.mm

Issue 579383003: Uses the correct scale factor for fallback images on iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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_ios.mm
diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm
index 64b8527f77fccfc2e0b0b10675eefe610183e8b0..f719d320f84ca6c0d13d8d5cf528b2d1bd9b0412 100644
--- a/ui/base/resource/resource_bundle_ios.mm
+++ b/ui/base/resource/resource_bundle_ios.mm
@@ -133,13 +133,15 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) {
bool is_fallback = PNGContainsFallbackMarker(data->front(), data->size());
// Create the image from the data.
CGFloat target_scale = ui::GetScaleForScaleFactor(scale_factor);
- CGFloat source_scale = is_fallback ? 1.0 : target_scale;
// Hack: The 200P pak file is the only pak file loaded on iOS devices with
// an @3x scale factor. Force |source_scale| to be 2.0 to handle this case,
- // since it cannot be anything else.
+ // since it cannot be anything else. http://crbug.com/413300.
// TODO(rohitrao): Support proper fallback by using the actual scale factor
// of the source image, rather than assuming it is 1.0 or 2.0.
- if (scale_factor == SCALE_FACTOR_300P) {
+ CGFloat source_scale = target_scale;
+ if (is_fallback) {
+ source_scale = 1.0;
+ } else if (scale_factor == SCALE_FACTOR_300P) {
source_scale = 2.0;
}
base::scoped_nsobject<UIImage> ui_image(
« 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