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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
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. | 186 // Stores a representation into the map. A representation of that type must |
| 187 // not already be in the map. |
187 void AddRepresentation(scoped_ptr<internal::ImageRep> rep) const; | 188 void AddRepresentation(scoped_ptr<internal::ImageRep> rep) const; |
188 | 189 |
189 // Internal class that holds all the representations. This allows the Image to | 190 // Internal class that holds all the representations. This allows the Image to |
190 // be cheaply copied. | 191 // be cheaply copied. |
191 scoped_refptr<internal::ImageStorage> storage_; | 192 scoped_refptr<internal::ImageStorage> storage_; |
192 }; | 193 }; |
193 | 194 |
194 } // namespace gfx | 195 } // namespace gfx |
195 | 196 |
196 #endif // UI_GFX_IMAGE_IMAGE_H_ | 197 #endif // UI_GFX_IMAGE_IMAGE_H_ |
OLD | NEW |