OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkImageFilter_DEFINED | 8 #ifndef SkImageFilter_DEFINED |
9 #define SkImageFilter_DEFINED | 9 #define SkImageFilter_DEFINED |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 * should be used to offset access to the input images, and should also | 139 * should be used to offset access to the input images, and should also |
140 * be added to the "offset" parameter in onFilterImage and | 140 * be added to the "offset" parameter in onFilterImage and |
141 * filterImageGPU(). (The latter ensures that the resulting buffer is | 141 * filterImageGPU(). (The latter ensures that the resulting buffer is |
142 * drawn in the correct location.) | 142 * drawn in the correct location.) |
143 */ | 143 */ |
144 bool cropRectIsSet() const { return fCropRect.flags() != 0x0; } | 144 bool cropRectIsSet() const { return fCropRect.flags() != 0x0; } |
145 | 145 |
146 // Default impl returns union of all input bounds. | 146 // Default impl returns union of all input bounds. |
147 virtual void computeFastBounds(const SkRect&, SkRect*) const; | 147 virtual void computeFastBounds(const SkRect&, SkRect*) const; |
148 | 148 |
| 149 #ifdef SK_SUPPORT_GPU |
| 150 /** |
| 151 * Wrap the given texture in a texture-backed SkBitmap. |
| 152 */ |
| 153 static void WrapTexture(GrTexture* texture, int width, int height, SkBitmap*
result); |
| 154 |
| 155 /** |
| 156 * Recursively evaluate this filter on the GPU. If the filter has no GPU |
| 157 * implementation, it will be processed in software and uploaded to the GPU. |
| 158 */ |
| 159 bool getInputResultGPU(SkImageFilter::Proxy* proxy, const SkBitmap& src, con
st SkMatrix& ctm, |
| 160 SkBitmap* result, SkIPoint* offset) const; |
| 161 #endif |
| 162 |
149 SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter) | 163 SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter) |
150 | 164 |
151 protected: | 165 protected: |
152 SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRe
ct = NULL); | 166 SkImageFilter(int inputCount, SkImageFilter** inputs, const CropRect* cropRe
ct = NULL); |
153 | 167 |
154 // Convenience constructor for 1-input filters. | 168 // Convenience constructor for 1-input filters. |
155 explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL
); | 169 explicit SkImageFilter(SkImageFilter* input, const CropRect* cropRect = NULL
); |
156 | 170 |
157 // Convenience constructor for 2-input filters. | 171 // Convenience constructor for 2-input filters. |
158 SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect*
cropRect = NULL); | 172 SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const CropRect*
cropRect = NULL); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 * in the texture. "matrix" is a transformation to apply to filter | 229 * in the texture. "matrix" is a transformation to apply to filter |
216 * parameters before they are used in the effect. Note that this function | 230 * parameters before they are used in the effect. Note that this function |
217 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, | 231 * will be called with (NULL, NULL, SkMatrix::I()) to query for support, |
218 * so returning "true" indicates support for all possible matrices. | 232 * so returning "true" indicates support for all possible matrices. |
219 */ | 233 */ |
220 virtual bool asNewEffect(GrEffectRef** effect, | 234 virtual bool asNewEffect(GrEffectRef** effect, |
221 GrTexture*, | 235 GrTexture*, |
222 const SkMatrix& matrix, | 236 const SkMatrix& matrix, |
223 const SkIRect& bounds) const; | 237 const SkIRect& bounds) const; |
224 | 238 |
| 239 |
225 private: | 240 private: |
226 typedef SkFlattenable INHERITED; | 241 typedef SkFlattenable INHERITED; |
227 int fInputCount; | 242 int fInputCount; |
228 SkImageFilter** fInputs; | 243 SkImageFilter** fInputs; |
229 CropRect fCropRect; | 244 CropRect fCropRect; |
230 }; | 245 }; |
231 | 246 |
232 #endif | 247 #endif |
OLD | NEW |