| 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 #include <set> | 8 #include <set> | 
| 9 | 9 | 
| 10 #include "base/logging.h" | 10 #include "base/logging.h" | 
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 281 | 281 | 
| 282 #if defined(OS_IOS) | 282 #if defined(OS_IOS) | 
| 283 class ImageRepCocoaTouch : public ImageRep { | 283 class ImageRepCocoaTouch : public ImageRep { | 
| 284  public: | 284  public: | 
| 285   explicit ImageRepCocoaTouch(UIImage* image) | 285   explicit ImageRepCocoaTouch(UIImage* image) | 
| 286       : ImageRep(Image::kImageRepCocoaTouch), | 286       : ImageRep(Image::kImageRepCocoaTouch), | 
| 287         image_(image) { | 287         image_(image) { | 
| 288     CHECK(image); | 288     CHECK(image); | 
| 289   } | 289   } | 
| 290 | 290 | 
| 291   virtual ~ImageRepCocoaTouch() { | 291   ~ImageRepCocoaTouch() override { | 
| 292     base::mac::NSObjectRelease(image_); | 292     base::mac::NSObjectRelease(image_); | 
| 293     image_ = nil; | 293     image_ = nil; | 
| 294   } | 294   } | 
| 295 | 295 | 
| 296   virtual int Width() const override { | 296   int Width() const override { return Size().width(); } | 
| 297     return Size().width(); |  | 
| 298   } |  | 
| 299 | 297 | 
| 300   virtual int Height() const override { | 298   int Height() const override { return Size().height(); } | 
| 301     return Size().height(); |  | 
| 302   } |  | 
| 303 | 299 | 
| 304   virtual gfx::Size Size() const override { | 300   gfx::Size Size() const override { return internal::UIImageSize(image_); } | 
| 305     return internal::UIImageSize(image_); |  | 
| 306   } |  | 
| 307 | 301 | 
| 308   UIImage* image() const { return image_; } | 302   UIImage* image() const { return image_; } | 
| 309 | 303 | 
| 310  private: | 304  private: | 
| 311   UIImage* image_; | 305   UIImage* image_; | 
| 312 | 306 | 
| 313   DISALLOW_COPY_AND_ASSIGN(ImageRepCocoaTouch); | 307   DISALLOW_COPY_AND_ASSIGN(ImageRepCocoaTouch); | 
| 314 }; | 308 }; | 
| 315 #elif defined(OS_MACOSX) | 309 #elif defined(OS_MACOSX) | 
| 316 class ImageRepCocoa : public ImageRep { | 310 class ImageRepCocoa : public ImageRep { | 
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 753   } | 747   } | 
| 754   return it->second; | 748   return it->second; | 
| 755 } | 749 } | 
| 756 | 750 | 
| 757 void Image::AddRepresentation(internal::ImageRep* rep) const { | 751 void Image::AddRepresentation(internal::ImageRep* rep) const { | 
| 758   CHECK(storage_.get()); | 752   CHECK(storage_.get()); | 
| 759   storage_->representations().insert(std::make_pair(rep->type(), rep)); | 753   storage_->representations().insert(std::make_pair(rep->type(), rep)); | 
| 760 } | 754 } | 
| 761 | 755 | 
| 762 }  // namespace gfx | 756 }  // namespace gfx | 
| OLD | NEW | 
|---|