| 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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 #endif | 548 #endif |
| 549 | 549 |
| 550 #if defined(OS_MACOSX) | 550 #if defined(OS_MACOSX) |
| 551 NSImage* Image::CopyNSImage() const { | 551 NSImage* Image::CopyNSImage() const { |
| 552 NSImage* image = ToNSImage(); | 552 NSImage* image = ToNSImage(); |
| 553 base::mac::NSObjectRetain(image); | 553 base::mac::NSObjectRetain(image); |
| 554 return image; | 554 return image; |
| 555 } | 555 } |
| 556 #endif | 556 #endif |
| 557 | 557 |
| 558 #if defined(OS_MACOSX) | |
| 559 Image::operator NSImage*() const { | |
| 560 return ToNSImage(); | |
| 561 } | |
| 562 #endif | |
| 563 | |
| 564 bool Image::HasRepresentation(RepresentationType type) const { | 558 bool Image::HasRepresentation(RepresentationType type) const { |
| 565 return storage_.get() && storage_->representations().count(type) != 0; | 559 return storage_.get() && storage_->representations().count(type) != 0; |
| 566 } | 560 } |
| 567 | 561 |
| 568 size_t Image::RepresentationCount() const { | 562 size_t Image::RepresentationCount() const { |
| 569 if (!storage_.get()) | 563 if (!storage_.get()) |
| 570 return 0; | 564 return 0; |
| 571 | 565 |
| 572 return storage_->representations().size(); | 566 return storage_->representations().size(); |
| 573 } | 567 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 599 } | 593 } |
| 600 return it->second; | 594 return it->second; |
| 601 } | 595 } |
| 602 | 596 |
| 603 void Image::AddRepresentation(internal::ImageRep* rep) const { | 597 void Image::AddRepresentation(internal::ImageRep* rep) const { |
| 604 CHECK(storage_.get()); | 598 CHECK(storage_.get()); |
| 605 storage_->representations().insert(std::make_pair(rep->type(), rep)); | 599 storage_->representations().insert(std::make_pair(rep->type(), rep)); |
| 606 } | 600 } |
| 607 | 601 |
| 608 } // namespace gfx | 602 } // namespace gfx |
| OLD | NEW |