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