Chromium Code Reviews| Index: include/core/SkImageFilter.h |
| diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h |
| index fe383ae9e316d632ce04eb15efdd0b40efeeb46c..f43ac35cc8823a134de4701e32f65aaf4098cc4c 100644 |
| --- a/include/core/SkImageFilter.h |
| +++ b/include/core/SkImageFilter.h |
| @@ -9,13 +9,13 @@ |
| #define SkImageFilter_DEFINED |
| #include "SkFlattenable.h" |
| +#include "SkRect.h" |
| class SkBitmap; |
| class SkColorFilter; |
| class SkDevice; |
| class SkMatrix; |
| struct SkIPoint; |
| -struct SkIRect; |
| class SkShader; |
| class GrEffectRef; |
| class GrTexture; |
| @@ -139,14 +139,25 @@ public: |
| return fInputs[i]; |
| } |
| + /** |
| + * Returns the crop rectangle of this filter. This is set at construction |
| + * time, and determines which pixels from the input image will |
| + * be processed. The size of this rectangle should be used as the size |
| + * of the destination image. The origin of this rect should be used to |
| + * offset access to the input images, and should also be added to the |
| + * "offset" parameter in onFilterImage and filterImageGPU(). (The latter |
| + * ensures that the resulting buffer is drawn in the correct location.) |
| + */ |
| + const SkIRect& cropRect() const { return fCropRect; } |
| + |
| protected: |
| - SkImageFilter(int inputCount, SkImageFilter** inputs); |
| + SkImageFilter(int inputCount, SkImageFilter** inputs, const SkIRect* cropRect = NULL); |
| // Convenience constructor for 1-input filters. |
| - explicit SkImageFilter(SkImageFilter* input); |
| + explicit SkImageFilter(SkImageFilter* input, const SkIRect* cropRect = NULL); |
|
reed1
2013/07/19 21:34:04
is explicit correct w/ more than one parameter?
Stephen White
2013/07/19 22:11:50
When you have default arguments, I think it is, si
|
| // Convenience constructor for 2-input filters. |
| - SkImageFilter(SkImageFilter* input1, SkImageFilter* input2); |
| + SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const SkIRect* cropRect = NULL); |
| virtual ~SkImageFilter(); |
| @@ -160,10 +171,13 @@ protected: |
| // Default impl copies src into dst and returns true |
| virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*); |
| + void applyCropRect(SkIRect* rect) const; |
| + |
| private: |
| typedef SkFlattenable INHERITED; |
| int fInputCount; |
| SkImageFilter** fInputs; |
| + SkIRect fCropRect; |
| }; |
| #endif |