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

Unified Diff: ui/gfx/image/image_skia.cc

Issue 11301007: Load the resources for max scale factor first. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/image/image_skia.cc
diff --git a/ui/gfx/image/image_skia.cc b/ui/gfx/image/image_skia.cc
index a886ab02d35b732c026e04eb5279e99475de8d33..7cc89e4e4bd54de9a53561fffc92fff46083e0aa 100644
--- a/ui/gfx/image/image_skia.cc
+++ b/ui/gfx/image/image_skia.cc
@@ -61,11 +61,18 @@ class ImageSkiaStorage : public base::RefCounted<ImageSkiaStorage>,
ImageSkiaStorage(ImageSkiaSource* source, ui::ScaleFactor scale_factor)
: source_(source),
read_only_(false) {
- const ImageSkiaRep& image = *FindRepresentation(scale_factor, true);
- if (image.is_null())
+ ImageSkia::ImageSkiaReps::iterator it =
+ FindRepresentation(scale_factor, true);
+ // TODO(oshima): This is necessary as there are scale indepdent
+ // resources loaded as 100P. Fix them and remove this.
+ if (scale_factor != ui::SCALE_FACTOR_100P &&
+ (it == image_reps_.end() || it->is_null()))
+ it = FindRepresentation(ui::SCALE_FACTOR_100P, true);
+
+ if (it == image_reps_.end() || it->is_null())
source_.reset();
else
- size_.SetSize(image.GetWidth(), image.GetHeight());
+ size_.SetSize(it->GetWidth(), it->GetHeight());
}
bool has_source() const { return source_.get() != NULL; }
« no previous file with comments | « ui/base/resource/resource_bundle_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698