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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 SkBitmap* result, SkIPoint* offset) const; | 216 SkBitmap* result, SkIPoint* offset) const; |
217 // Given the bounds of the destination rect to be filled in device | 217 // Given the bounds of the destination rect to be filled in device |
218 // coordinates (first parameter), and the CTM, compute (conservatively) | 218 // coordinates (first parameter), and the CTM, compute (conservatively) |
219 // which rect of the source image would be required (third parameter). | 219 // which rect of the source image would be required (third parameter). |
220 // Used for clipping and temp-buffer allocations, so the result need not | 220 // Used for clipping and temp-buffer allocations, so the result need not |
221 // be exact, but should never be smaller than the real answer. The default | 221 // be exact, but should never be smaller than the real answer. The default |
222 // implementation recursively unions all input bounds, or returns false if | 222 // implementation recursively unions all input bounds, or returns false if |
223 // no inputs. | 223 // no inputs. |
224 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const
; | 224 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*) const
; |
225 | 225 |
226 /** Computes source bounds as the src bitmap bounds offset by srcOffset. | 226 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of |
227 * Apply the transformed crop rect to the bounds if any of the | 227 // "rect" and the transformed crop rect. If there is no overlap, returns |
228 * corresponding edge flags are set. Intersects the result against the | 228 // false and leaves "rect" unchanged. |
229 * context's clipBounds, and returns the result in "bounds". If there is | 229 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; |
230 * no intersection, returns false and leaves "bounds" unchanged. | |
231 */ | |
232 bool applyCropRect(const Context&, const SkBitmap& src, const SkIPoint& srcO
ffset, | |
233 SkIRect* bounds) const; | |
234 | |
235 /** Same as the above call, except that if the resulting crop rect is not | |
236 * entirely contained by the source bitmap's bounds, it creates a new | |
237 * bitmap in "result" and pads the edges with transparent black. In that | |
238 * case, the srcOffset is modified to be the same as the bounds, since no | |
239 * further adjustment is needed by the caller. This version should only | |
240 * be used by filters which are not capable of processing a smaller | |
241 * source bitmap into a larger destination. | |
242 */ | |
243 bool applyCropRect(const Context&, Proxy* proxy, const SkBitmap& src, SkIPoi
nt* srcOffset, | |
244 SkIRect* bounds, SkBitmap* result) const; | |
245 | 230 |
246 /** | 231 /** |
247 * Returns true if the filter can be expressed a single-pass | 232 * Returns true if the filter can be expressed a single-pass |
248 * GrEffect, used to process this filter on the GPU, or false if | 233 * GrEffect, used to process this filter on the GPU, or false if |
249 * not. | 234 * not. |
250 * | 235 * |
251 * If effect is non-NULL, a new GrEffect instance is stored | 236 * If effect is non-NULL, a new GrEffect instance is stored |
252 * in it. The caller assumes ownership of the stage, and it is up to the | 237 * in it. The caller assumes ownership of the stage, and it is up to the |
253 * caller to unref it. | 238 * caller to unref it. |
254 * | 239 * |
(...skipping 10 matching lines...) Expand all Loading... |
265 | 250 |
266 | 251 |
267 private: | 252 private: |
268 typedef SkFlattenable INHERITED; | 253 typedef SkFlattenable INHERITED; |
269 int fInputCount; | 254 int fInputCount; |
270 SkImageFilter** fInputs; | 255 SkImageFilter** fInputs; |
271 CropRect fCropRect; | 256 CropRect fCropRect; |
272 }; | 257 }; |
273 | 258 |
274 #endif | 259 #endif |
OLD | NEW |