| Index: ui/base/resource/resource_bundle.cc
|
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc
|
| index 24c05606eead09f08c2297556732a361cfc9aa56..02416e75f16366d312b2fb7e6557c55f389174e4 100644
|
| --- a/ui/base/resource/resource_bundle.cc
|
| +++ b/ui/base/resource/resource_bundle.cc
|
| @@ -26,6 +26,7 @@
|
| #include "ui/gfx/codec/png_codec.h"
|
| #include "ui/gfx/font.h"
|
| #include "ui/gfx/image/image.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
|
|
| namespace ui {
|
|
|
| @@ -241,14 +242,21 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
|
| }
|
|
|
| DCHECK(!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);
|
| + // TODO(pkotwicz): Convert LoadBitmap to return reference instead of
|
| + // pointer.
|
| + 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.
|
| @@ -262,10 +270,7 @@ gfx::Image& ResourceBundle::GetImageNamed(int resource_id) {
|
| if (images_.count(resource_id))
|
| return *images_[resource_id];
|
|
|
| - std::vector<const SkBitmap*> tmp_bitmaps;
|
| - bitmaps.release(&tmp_bitmaps);
|
| - // Takes ownership of bitmaps.
|
| - gfx::Image* image = new gfx::Image(tmp_bitmaps);
|
| + gfx::Image* image = new gfx::Image(image_skia);
|
| images_[resource_id] = image;
|
| return *image;
|
| }
|
|
|