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 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_H_ | 5 #ifndef UI_GFX_IMAGE_IMAGE_SKIA_H_ |
6 #define UI_GFX_IMAGE_IMAGE_SKIA_H_ | 6 #define UI_GFX_IMAGE_IMAGE_SKIA_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Returns true if this is a null object. | 97 // Returns true if this is a null object. |
98 // TODO(pkotwicz): Merge this function into empty(). | 98 // TODO(pkotwicz): Merge this function into empty(). |
99 bool isNull() const { return storage_ == NULL; } | 99 bool isNull() const { return storage_ == NULL; } |
100 | 100 |
101 // Width and height of image in DIP coordinate system. | 101 // Width and height of image in DIP coordinate system. |
102 int width() const; | 102 int width() const; |
103 int height() const; | 103 int height() const; |
104 gfx::Size size() const; | 104 gfx::Size size() const; |
105 | 105 |
106 // Wrapper function for SkBitmap::extractBitmap. | 106 // Wrapper function for SkBitmap::extractBitmap. |
107 // Operates on each stored image rep. Note that it may not have | 107 // Deprecated, use ImageSkiaOperations::ExtractSubset instead. |
108 // all image reps for supported scale factors. | 108 // TODO(pkotwicz): Remove this function. |
109 // TODO(oshima|pkotwicz): Investigate if this can be eliminated | |
110 // after ImageSkiaSource conversion. | |
111 bool extractSubset(ImageSkia* dst, const SkIRect& subset) const; | 109 bool extractSubset(ImageSkia* dst, const SkIRect& subset) const; |
112 | 110 |
113 // Returns pointer to 1x bitmap contained by this object. If there is no 1x | 111 // Returns pointer to 1x bitmap contained by this object. If there is no 1x |
114 // bitmap, the bitmap whose scale factor is closest to 1x is returned. | 112 // bitmap, the bitmap whose scale factor is closest to 1x is returned. |
115 // This function should only be used in unittests and on platforms which do | 113 // This function should only be used in unittests and on platforms which do |
116 // not support scale factors other than 1x. | 114 // not support scale factors other than 1x. |
117 // TODO(pkotwicz): Return null SkBitmap when the object has no 1x bitmap. | 115 // TODO(pkotwicz): Return null SkBitmap when the object has no 1x bitmap. |
118 const SkBitmap* bitmap() const; | 116 const SkBitmap* bitmap() const; |
119 | 117 |
120 // Returns a vector with the image reps contained in this object. | 118 // Returns a vector with the image reps contained in this object. |
121 // There is no guarantee that this will return all images rep for | 119 // There is no guarantee that this will return all images rep for |
122 // supported scale factors. | 120 // supported scale factors. |
123 // TODO(oshima): Update all use of this API and make this to fail | 121 // TODO(oshima): Update all use of this API and make this to fail |
124 // when source is used. | 122 // when source is used. |
125 std::vector<gfx::ImageSkiaRep> image_reps() const; | 123 std::vector<gfx::ImageSkiaRep> image_reps() const; |
126 | 124 |
127 private: | 125 private: |
128 // Initialize ImageSkiaStorage with passed in parameters. | 126 // Initialize ImageSkiaStorage with passed in parameters. |
129 // If the image rep's bitmap is empty, ImageStorage is set to NULL. | 127 // If the image rep's bitmap is empty, ImageStorage is set to NULL. |
130 void Init(const gfx::ImageSkiaRep& image_rep); | 128 void Init(const gfx::ImageSkiaRep& image_rep); |
131 | 129 |
132 // A refptr so that ImageRepSkia can be copied cheaply. | 130 // A refptr so that ImageRepSkia can be copied cheaply. |
133 scoped_refptr<internal::ImageSkiaStorage> storage_; | 131 scoped_refptr<internal::ImageSkiaStorage> storage_; |
134 }; | 132 }; |
135 | 133 |
136 } // namespace gfx | 134 } // namespace gfx |
137 | 135 |
138 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ | 136 #endif // UI_GFX_IMAGE_IMAGE_SKIA_H_ |
OLD | NEW |