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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 class SkBitmap; | 31 class SkBitmap; |
32 | 32 |
33 namespace { | 33 namespace { |
34 class ImageTest; | 34 class ImageTest; |
35 class ImageMacTest; | 35 class ImageMacTest; |
36 } | 36 } |
37 | 37 |
38 namespace gfx { | 38 namespace gfx { |
39 class ImageSkia; | 39 class ImageSkia; |
40 class ImageSkiaRep; | |
41 | 40 |
42 #if defined(TOOLKIT_GTK) | 41 #if defined(TOOLKIT_GTK) |
43 class CairoCachedSurface; | 42 class CairoCachedSurface; |
44 #endif | 43 #endif |
45 | 44 |
46 namespace internal { | 45 namespace internal { |
47 class ImageRep; | 46 class ImageRep; |
48 class ImageStorage; | 47 class ImageStorage; |
49 } | 48 } |
50 | 49 |
(...skipping 15 matching lines...) Expand all Loading... |
66 // Creates a new image by copying the PNG-encoded input for use as the default | 65 // Creates a new image by copying the PNG-encoded input for use as the default |
67 // representation. For example (from an std::vector): | 66 // representation. For example (from an std::vector): |
68 // std::vector<unsigned char> png = ...; | 67 // std::vector<unsigned char> png = ...; |
69 // gfx::Image image(&png.front(), png.size()); | 68 // gfx::Image image(&png.front(), png.size()); |
70 Image(const unsigned char* png, size_t input_size); | 69 Image(const unsigned char* png, size_t input_size); |
71 | 70 |
72 // Creates a new image by copying the ImageSkia for use as the default | 71 // Creates a new image by copying the ImageSkia for use as the default |
73 // representation. | 72 // representation. |
74 explicit Image(const ImageSkia& image); | 73 explicit Image(const ImageSkia& image); |
75 | 74 |
76 // Creates a new image by copying the image rep for use as the default | |
77 // representation. | |
78 explicit Image(const ImageSkiaRep& image_rep); | |
79 | |
80 // Creates a new image by copying the bitmap for use as the default | 75 // Creates a new image by copying the bitmap for use as the default |
81 // representation. | 76 // representation. |
82 // TODO(pkotwicz): Get rid of this constructor. | 77 // TODO(pkotwicz): Get rid of this constructor. |
83 explicit Image(const SkBitmap& bitmap); | 78 explicit Image(const SkBitmap& bitmap); |
84 | 79 |
85 #if defined(TOOLKIT_GTK) | 80 #if defined(TOOLKIT_GTK) |
86 // Does not increase |pixbuf|'s reference count; expects to take ownership. | 81 // Does not increase |pixbuf|'s reference count; expects to take ownership. |
87 explicit Image(GdkPixbuf* pixbuf); | 82 explicit Image(GdkPixbuf* pixbuf); |
88 #elif defined(OS_MACOSX) | 83 #elif defined(OS_MACOSX) |
89 // Does not retain |image|; expects to take ownership. | 84 // Does not retain |image|; expects to take ownership. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 // be cheaply copied. | 172 // be cheaply copied. |
178 scoped_refptr<internal::ImageStorage> storage_; | 173 scoped_refptr<internal::ImageStorage> storage_; |
179 | 174 |
180 friend class ::ImageTest; | 175 friend class ::ImageTest; |
181 friend class ::ImageMacTest; | 176 friend class ::ImageMacTest; |
182 }; | 177 }; |
183 | 178 |
184 } // namespace gfx | 179 } // namespace gfx |
185 | 180 |
186 #endif // UI_GFX_IMAGE_IMAGE_H_ | 181 #endif // UI_GFX_IMAGE_IMAGE_H_ |
OLD | NEW |