Commit fb35e64a authored by rohitrao's avatar rohitrao Committed by Commit bot

Uses the correct scale factor for fallback images on iOS.

Fallback images should always have a source scale factor of 1.0, even on 300P
devices.

BUG=413300,415616
TEST=None

Review URL: https://codereview.chromium.org/579383003

Cr-Commit-Position: refs/heads/master@{#295703}
parent 3d9825c9
...@@ -133,13 +133,15 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { ...@@ -133,13 +133,15 @@ gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) {
bool is_fallback = PNGContainsFallbackMarker(data->front(), data->size()); bool is_fallback = PNGContainsFallbackMarker(data->front(), data->size());
// Create the image from the data. // Create the image from the data.
CGFloat target_scale = ui::GetScaleForScaleFactor(scale_factor); 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 // 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, // 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 // 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. // 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; source_scale = 2.0;
} }
base::scoped_nsobject<UIImage> ui_image( base::scoped_nsobject<UIImage> ui_image(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment