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 |
11 // tied to the lifetime of the Image's internal storage. To allow Images to be | 11 // tied to the lifetime of the Image's internal storage. To allow Images to be |
12 // cheaply passed around by value, the actual image data is stored in a ref- | 12 // cheaply passed around by value, the actual image data is stored in a ref- |
13 // counted member. When all Images referencing this storage are deleted, the | 13 // counted member. When all Images referencing this storage are deleted, the |
14 // actual representations are deleted, too. | 14 // actual representations are deleted, too. |
15 | 15 |
16 #ifndef UI_GFX_IMAGE_IMAGE_H_ | 16 #ifndef UI_GFX_IMAGE_IMAGE_H_ |
17 #define UI_GFX_IMAGE_IMAGE_H_ | 17 #define UI_GFX_IMAGE_IMAGE_H_ |
18 #pragma once | 18 #pragma once |
19 | 19 |
20 #include <map> | 20 #include <map> |
21 #include <vector> | 21 #include <vector> |
22 | 22 |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "base/gtest_prod_util.h" | 24 #include "base/gtest_prod_util.h" |
25 #include "base/memory/ref_counted.h" | 25 #include "base/memory/ref_counted.h" |
26 #include "build/build_config.h" | |
27 #include "ui/gfx/native_widget_types.h" // Forward-declares GdkPixbuf and NSIma ge. | 26 #include "ui/gfx/native_widget_types.h" // Forward-declares GdkPixbuf and NSIma ge. |
rvargas (doing something else)
2011/07/12 21:40:19
nit: do you mind fixing this comment?
| |
27 #include "ui/ui_api.h" | |
28 | 28 |
29 class SkBitmap; | 29 class SkBitmap; |
30 | 30 |
31 namespace { | 31 namespace { |
32 class ImageTest; | 32 class ImageTest; |
33 class ImageMacTest; | 33 class ImageMacTest; |
34 } | 34 } |
35 | 35 |
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 UI_API Image { |
44 public: | 44 public: |
45 enum RepresentationType { | 45 enum RepresentationType { |
46 kImageRepGdk, | 46 kImageRepGdk, |
47 kImageRepCocoa, | 47 kImageRepCocoa, |
48 kImageRepSkia, | 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 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 // be cheaply copied. | 146 // be cheaply copied. |
147 scoped_refptr<internal::ImageStorage> storage_; | 147 scoped_refptr<internal::ImageStorage> storage_; |
148 | 148 |
149 friend class ::ImageTest; | 149 friend class ::ImageTest; |
150 friend class ::ImageMacTest; | 150 friend class ::ImageMacTest; |
151 }; | 151 }; |
152 | 152 |
153 } // namespace gfx | 153 } // namespace gfx |
154 | 154 |
155 #endif // UI_GFX_IMAGE_IMAGE_H_ | 155 #endif // UI_GFX_IMAGE_IMAGE_H_ |
OLD | NEW |