OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 25 matching lines...) Expand all Loading... |
36 namespace gfx { | 36 namespace gfx { |
37 | 37 |
38 namespace internal { | 38 namespace internal { |
39 class ImageRep; | 39 class ImageRep; |
40 class ImageStorage; | 40 class ImageStorage; |
41 } | 41 } |
42 | 42 |
43 class Image { | 43 class Image { |
44 public: | 44 public: |
45 enum RepresentationType { | 45 enum RepresentationType { |
46 kGdkPixbufRep, | 46 kImageRepGdk, |
47 kNSImageRep, | 47 kImageRepCocoa, |
48 kSkBitmapRep, | 48 kImageRepSkia, |
49 }; | 49 }; |
50 | 50 |
51 typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap; | 51 typedef std::map<RepresentationType, internal::ImageRep*> RepresentationMap; |
52 | 52 |
53 // Creates a new image with the default representation. The object will take | 53 // Creates a new image with the default representation. The object will take |
54 // ownership of the image. | 54 // ownership of the image. |
55 explicit Image(const SkBitmap* bitmap); | 55 explicit Image(const SkBitmap* bitmap); |
56 | 56 |
57 // To create an Image that supports multiple resolutions pass a vector | 57 // To create an Image that supports multiple resolutions pass a vector |
58 // of bitmaps, one for each resolution. | 58 // of bitmaps, one for each resolution. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // be cheaply copied. | 121 // be cheaply copied. |
122 scoped_refptr<internal::ImageStorage> storage_; | 122 scoped_refptr<internal::ImageStorage> storage_; |
123 | 123 |
124 friend class ::ImageTest; | 124 friend class ::ImageTest; |
125 friend class ::ImageMacTest; | 125 friend class ::ImageMacTest; |
126 }; | 126 }; |
127 | 127 |
128 } // namespace gfx | 128 } // namespace gfx |
129 | 129 |
130 #endif // UI_GFX_IMAGE_H_ | 130 #endif // UI_GFX_IMAGE_H_ |
OLD | NEW |