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

Unified Diff: ui/base/resource/resource_bundle.cc

Issue 6849030: Add support for multi resolution icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comments Created 9 years, 8 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_linux.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 56b37619be579c567d53aa2031ca4b4fb83c6d13..a080ad3db65e5806286d1f401e187449af97a47b 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -119,6 +119,11 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
scoped_ptr<SkBitmap> bitmap(LoadBitmap(resources_data_, resource_id));
if (bitmap.get()) {
+ // Check if there's a large version of the image as well.
+ scoped_ptr<SkBitmap> large_bitmap;
+ if (large_icon_resources_data_)
+ large_bitmap.reset(LoadBitmap(large_icon_resources_data_, resource_id));
+
// The load was successful, so cache the image.
base::AutoLock lock_scope(*lock_);
@@ -126,7 +131,11 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
if (images_.count(resource_id))
return *images_[resource_id];
- gfx::Image* image = new gfx::Image(bitmap.release());
+ std::vector<const SkBitmap*> bitmaps;
+ bitmaps.push_back(bitmap.release());
+ if (large_bitmap.get())
+ bitmaps.push_back(large_bitmap.release());
+ gfx::Image* image = new gfx::Image(bitmaps);
images_[resource_id] = image;
return *image;
}
@@ -190,6 +199,7 @@ void ResourceBundle::ReloadFonts() {
ResourceBundle::ResourceBundle()
: lock_(new base::Lock),
resources_data_(NULL),
+ large_icon_resources_data_(NULL),
locale_resources_data_(NULL) {
}
« no previous file with comments | « ui/base/resource/resource_bundle.h ('k') | ui/base/resource/resource_bundle_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698