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 // An Image wraps an image any flavor, be it platform-native GdkBitmap/NSImage, | 5 // An Image wraps an image any flavor, be it platform-native GdkBitmap/NSImage, |
6 // or a SkBitmap. This also provides easy conversion to other image types | 6 // or a SkBitmap. This also provides easy conversion to other image types |
7 // through operator overloading. It will cache the converted representations | 7 // through operator overloading. It will cache the converted representations |
8 // internally to prevent double-conversion. | 8 // internally to prevent double-conversion. |
9 // | 9 // |
10 // The lifetime of both the initial representation and any converted ones are | 10 // The lifetime of both the initial representation and any converted ones are |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 private: | 177 private: |
178 // Returns the type of the default representation. | 178 // Returns the type of the default representation. |
179 RepresentationType DefaultRepresentationType() const; | 179 RepresentationType DefaultRepresentationType() const; |
180 | 180 |
181 // Returns the ImageRep of the appropriate type or NULL if there is no | 181 // Returns the ImageRep of the appropriate type or NULL if there is no |
182 // representation of that type (and must_exist is false). | 182 // representation of that type (and must_exist is false). |
183 internal::ImageRep* GetRepresentation( | 183 internal::ImageRep* GetRepresentation( |
184 RepresentationType rep_type, bool must_exist) const; | 184 RepresentationType rep_type, bool must_exist) const; |
185 | 185 |
186 // Stores a representation into the map. A representation of that type must | 186 // Stores a representation into the map. A representation of that type must |
187 // not already be in the map. | 187 // not already be in the map. Returns a pointer to the representation stored |
188 void AddRepresentation(scoped_ptr<internal::ImageRep> rep) const; | 188 // inside the map. |
| 189 internal::ImageRep* AddRepresentation( |
| 190 scoped_ptr<internal::ImageRep> rep) const; |
189 | 191 |
190 // Internal class that holds all the representations. This allows the Image to | 192 // Internal class that holds all the representations. This allows the Image to |
191 // be cheaply copied. | 193 // be cheaply copied. |
192 scoped_refptr<internal::ImageStorage> storage_; | 194 scoped_refptr<internal::ImageStorage> storage_; |
193 }; | 195 }; |
194 | 196 |
195 } // namespace gfx | 197 } // namespace gfx |
196 | 198 |
197 #endif // UI_GFX_IMAGE_IMAGE_H_ | 199 #endif // UI_GFX_IMAGE_IMAGE_H_ |
OLD | NEW |