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

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

Issue 10245003: Makes ImageSkia more like SkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comment Created 8 years, 7 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 | « skia/ext/skia_utils_mac_unittest.mm ('k') | ui/gfx/canvas.h » ('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 693677c8ae7dfb22375993eb0846fc0b7a329c7d..9de5a4fab17f0a130633c13586856c909b18c940 100644
--- a/ui/base/resource/resource_bundle.cc
+++ b/ui/base/resource/resource_bundle.cc
@@ -24,6 +24,7 @@
#include "ui/base/ui_base_switches.h"
#include "ui/gfx/codec/jpeg_codec.h"
#include "ui/gfx/codec/png_codec.h"
+#include "ui/gfx/image/image_skia.h"
namespace ui {
@@ -231,25 +232,26 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
if (image.IsEmpty()) {
DCHECK(!delegate_ && !data_packs_.empty()) <<
"Missing call to SetResourcesDataDLL?";
- ScopedVector<const SkBitmap> bitmaps;
+ gfx::ImageSkia image_skia;
for (size_t i = 0; i < data_packs_.size(); ++i) {
- SkBitmap* bitmap = LoadBitmap(*data_packs_[i], resource_id);
- if (bitmap)
- bitmaps.push_back(bitmap);
+ scoped_ptr<SkBitmap> bitmap(LoadBitmap(*data_packs_[i], resource_id));
+ if (bitmap.get()) {
+#if defined(ENABLE_DIP)
+ image_skia.AddBitmapForScale(*bitmap, data_packs_[i]->GetScaleFactor());
+#else
+ image_skia.AddBitmapForScale(*bitmap, 1.0f);
+#endif
+ }
}
- if (bitmaps.empty()) {
+ if (image_skia.empty()) {
LOG(WARNING) << "Unable to load image with id " << resource_id;
NOTREACHED(); // Want to assert in debug mode.
// The load failed to retrieve the image; show a debugging red square.
return GetEmptyImage();
}
- std::vector<const SkBitmap*> tmp_bitmaps;
- bitmaps.release(&tmp_bitmaps);
-
- // Takes ownership of bitmaps.
- image = gfx::Image(tmp_bitmaps);
+ image = gfx::Image(image_skia);
}
// The load was successful, so cache the image.
« no previous file with comments | « skia/ext/skia_utils_mac_unittest.mm ('k') | ui/gfx/canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698