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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 AddRepresentation(rep); | 315 AddRepresentation(rep); |
316 } | 316 } |
317 | 317 |
318 Image::Image(const ImageSkia& image) | 318 Image::Image(const ImageSkia& image) |
319 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { | 319 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { |
320 internal::ImageRepSkia* rep = new internal::ImageRepSkia( | 320 internal::ImageRepSkia* rep = new internal::ImageRepSkia( |
321 new ImageSkia(image)); | 321 new ImageSkia(image)); |
322 AddRepresentation(rep); | 322 AddRepresentation(rep); |
323 } | 323 } |
324 | 324 |
325 Image::Image(const ImageSkiaRep& image_skia_rep) | |
326 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { | |
327 internal::ImageRepSkia* rep = | |
328 new internal::ImageRepSkia(new ImageSkia(image_skia_rep)); | |
329 AddRepresentation(rep); | |
330 } | |
331 | |
332 Image::Image(const SkBitmap& bitmap) | 325 Image::Image(const SkBitmap& bitmap) |
333 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { | 326 : storage_(new internal::ImageStorage(Image::kImageRepSkia)) { |
334 internal::ImageRepSkia* rep = | 327 internal::ImageRepSkia* rep = |
335 new internal::ImageRepSkia(new ImageSkia(bitmap)); | 328 new internal::ImageRepSkia(new ImageSkia(bitmap)); |
336 AddRepresentation(rep); | 329 AddRepresentation(rep); |
337 } | 330 } |
338 | 331 |
339 #if defined(TOOLKIT_GTK) | 332 #if defined(TOOLKIT_GTK) |
340 Image::Image(GdkPixbuf* pixbuf) | 333 Image::Image(GdkPixbuf* pixbuf) |
341 : storage_(new internal::ImageStorage(Image::kImageRepGdk)) { | 334 : storage_(new internal::ImageStorage(Image::kImageRepGdk)) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 591 } |
599 return it->second; | 592 return it->second; |
600 } | 593 } |
601 | 594 |
602 void Image::AddRepresentation(internal::ImageRep* rep) const { | 595 void Image::AddRepresentation(internal::ImageRep* rep) const { |
603 CHECK(storage_.get()); | 596 CHECK(storage_.get()); |
604 storage_->representations().insert(std::make_pair(rep->type(), rep)); | 597 storage_->representations().insert(std::make_pair(rep->type(), rep)); |
605 } | 598 } |
606 | 599 |
607 } // namespace gfx | 600 } // namespace gfx |
OLD | NEW |