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 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of | 226 /** Computes source bounds as the src bitmap bounds offset by srcOffset. |
227 // "rect" and the transformed crop rect. If there is no overlap, returns | 227 * Apply the transformed crop rect to the bounds if any of the |
228 // false and leaves "rect" unchanged. | 228 * corresponding edge flags are set. Intersects the result against the |
229 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; | 229 * context's clipBounds, and returns the result in "bounds". If there is |
| 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; |
230 | 245 |
231 /** | 246 /** |
232 * Returns true if the filter can be expressed a single-pass | 247 * Returns true if the filter can be expressed a single-pass |
233 * GrEffect, used to process this filter on the GPU, or false if | 248 * GrEffect, used to process this filter on the GPU, or false if |
234 * not. | 249 * not. |
235 * | 250 * |
236 * If effect is non-NULL, a new GrEffect instance is stored | 251 * If effect is non-NULL, a new GrEffect instance is stored |
237 * in it. The caller assumes ownership of the stage, and it is up to the | 252 * in it. The caller assumes ownership of the stage, and it is up to the |
238 * caller to unref it. | 253 * caller to unref it. |
239 * | 254 * |
(...skipping 10 matching lines...) Expand all Loading... |
250 | 265 |
251 | 266 |
252 private: | 267 private: |
253 typedef SkFlattenable INHERITED; | 268 typedef SkFlattenable INHERITED; |
254 int fInputCount; | 269 int fInputCount; |
255 SkImageFilter** fInputs; | 270 SkImageFilter** fInputs; |
256 CropRect fCropRect; | 271 CropRect fCropRect; |
257 }; | 272 }; |
258 | 273 |
259 #endif | 274 #endif |
OLD | NEW |