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