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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 kImageRepCocoa, | 55 kImageRepCocoa, |
56 kImageRepCairoCache, | 56 kImageRepCairoCache, |
57 kImageRepSkia, | 57 kImageRepSkia, |
58 }; | 58 }; |
59 | 59 |
60 typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap; | 60 typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap; |
61 | 61 |
62 // Creates an empty image with no representations. | 62 // Creates an empty image with no representations. |
63 Image(); | 63 Image(); |
64 | 64 |
| 65 // Creates a new image with the default representation. The object will take |
| 66 // ownership of the image. |
| 67 explicit Image(const SkBitmap* bitmap); |
| 68 |
65 // Creates a new image by copying the bitmap for use as the default | 69 // Creates a new image by copying the bitmap for use as the default |
66 // representation. | 70 // representation. |
67 explicit Image(const SkBitmap& bitmap); | 71 explicit Image(const SkBitmap& bitmap); |
68 | 72 |
69 // To create an Image that supports multiple resolutions pass a vector | 73 // To create an Image that supports multiple resolutions pass a vector |
70 // of bitmaps, one for each resolution. | 74 // of bitmaps, one for each resolution. |
71 explicit Image(const std::vector<const SkBitmap*>& bitmaps); | 75 explicit Image(const std::vector<const SkBitmap*>& bitmaps); |
72 | 76 |
73 #if defined(TOOLKIT_GTK) | 77 #if defined(TOOLKIT_GTK) |
74 // Does not increase |pixbuf|'s reference count; expects to take ownership. | 78 // Does not increase |pixbuf|'s reference count; expects to take ownership. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // be cheaply copied. | 153 // be cheaply copied. |
150 scoped_refptr<internal::ImageStorage> storage_; | 154 scoped_refptr<internal::ImageStorage> storage_; |
151 | 155 |
152 friend class ::ImageTest; | 156 friend class ::ImageTest; |
153 friend class ::ImageMacTest; | 157 friend class ::ImageMacTest; |
154 }; | 158 }; |
155 | 159 |
156 } // namespace gfx | 160 } // namespace gfx |
157 | 161 |
158 #endif // UI_GFX_IMAGE_IMAGE_H_ | 162 #endif // UI_GFX_IMAGE_IMAGE_H_ |
OLD | NEW |