| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/image/image.h" | 5 #include "ui/gfx/image/image.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 Image::Image(const SkBitmap* bitmap) | 227 Image::Image(const SkBitmap* bitmap) |
| 228 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { | 228 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { |
| 229 internal::ImageRepSkia* rep = new internal::ImageRepSkia( | 229 internal::ImageRepSkia* rep = new internal::ImageRepSkia( |
| 230 new ImageSkia(bitmap)); | 230 new ImageSkia(bitmap)); |
| 231 AddRepresentation(rep); | 231 AddRepresentation(rep); |
| 232 } | 232 } |
| 233 | 233 |
| 234 Image::Image(const SkBitmap& bitmap) | 234 Image::Image(const SkBitmap& bitmap) |
| 235 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { | 235 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { |
| 236 internal::ImageRepSkia* rep = | 236 internal::ImageRepSkia* rep = |
| 237 new internal::ImageRepSkia(new ImageSkia(new SkBitmap(bitmap))); | 237 new internal::ImageRepSkia(new ImageSkia(bitmap)); |
| 238 AddRepresentation(rep); | 238 AddRepresentation(rep); |
| 239 } | 239 } |
| 240 | 240 |
| 241 Image::Image(const std::vector<const SkBitmap*>& bitmaps) | 241 Image::Image(const std::vector<const SkBitmap*>& bitmaps) |
| 242 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { | 242 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { |
| 243 internal::ImageRepSkia* rep = new internal::ImageRepSkia( | 243 internal::ImageRepSkia* rep = new internal::ImageRepSkia( |
| 244 new ImageSkia(bitmaps)); | 244 new ImageSkia(bitmaps)); |
| 245 AddRepresentation(rep); | 245 AddRepresentation(rep); |
| 246 } | 246 } |
| 247 | 247 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 // Something went seriously wrong... | 436 // Something went seriously wrong... |
| 437 return NULL; | 437 return NULL; |
| 438 } | 438 } |
| 439 | 439 |
| 440 void Image::AddRepresentation(internal::ImageRep* rep) const { | 440 void Image::AddRepresentation(internal::ImageRep* rep) const { |
| 441 CHECK(storage_.get()); | 441 CHECK(storage_.get()); |
| 442 storage_->representations().insert(std::make_pair(rep->type(), rep)); | 442 storage_->representations().insert(std::make_pair(rep->type(), rep)); |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace gfx | 445 } // namespace gfx |
| OLD | NEW |