| 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 return image; | 647 return image; |
| 648 } | 648 } |
| 649 #elif defined(OS_MACOSX) | 649 #elif defined(OS_MACOSX) |
| 650 NSImage* Image::CopyNSImage() const { | 650 NSImage* Image::CopyNSImage() const { |
| 651 NSImage* image = ToNSImage(); | 651 NSImage* image = ToNSImage(); |
| 652 base::mac::NSObjectRetain(image); | 652 base::mac::NSObjectRetain(image); |
| 653 return image; | 653 return image; |
| 654 } | 654 } |
| 655 #endif | 655 #endif |
| 656 | 656 |
| 657 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
| 658 Image::operator NSImage*() const { | |
| 659 return ToNSImage(); | |
| 660 } | |
| 661 #endif | |
| 662 | |
| 663 bool Image::HasRepresentation(RepresentationType type) const { | 657 bool Image::HasRepresentation(RepresentationType type) const { |
| 664 return storage_.get() && storage_->representations().count(type) != 0; | 658 return storage_.get() && storage_->representations().count(type) != 0; |
| 665 } | 659 } |
| 666 | 660 |
| 667 size_t Image::RepresentationCount() const { | 661 size_t Image::RepresentationCount() const { |
| 668 if (!storage_.get()) | 662 if (!storage_.get()) |
| 669 return 0; | 663 return 0; |
| 670 | 664 |
| 671 return storage_->representations().size(); | 665 return storage_->representations().size(); |
| 672 } | 666 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 698 } | 692 } |
| 699 return it->second; | 693 return it->second; |
| 700 } | 694 } |
| 701 | 695 |
| 702 void Image::AddRepresentation(internal::ImageRep* rep) const { | 696 void Image::AddRepresentation(internal::ImageRep* rep) const { |
| 703 CHECK(storage_.get()); | 697 CHECK(storage_.get()); |
| 704 storage_->representations().insert(std::make_pair(rep->type(), rep)); | 698 storage_->representations().insert(std::make_pair(rep->type(), rep)); |
| 705 } | 699 } |
| 706 | 700 |
| 707 } // namespace gfx | 701 } // namespace gfx |
| OLD | NEW |