Index: src/core/SkImageFilter.cpp |
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp |
index ddd6449490ba0c0734cfaa925a610f24f704485b..94fe834cffc50b7fb7eece0617f06878fcd925fd 100644 |
--- a/src/core/SkImageFilter.cpp |
+++ b/src/core/SkImageFilter.cpp |
@@ -18,22 +18,22 @@ |
SK_DEFINE_INST_COUNT(SkImageFilter) |
-SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs) |
- : fInputCount(inputCount), fInputs(new SkImageFilter*[inputCount]) { |
+SkImageFilter::SkImageFilter(int inputCount, SkImageFilter** inputs, const SkIRect* cropRect) |
reed1
2013/07/19 21:34:04
line-wrap
|
+ : fInputCount(inputCount), fInputs(new SkImageFilter*[inputCount]), fCropRect(cropRect ? *cropRect : SkIRect::MakeLargest()) { |
for (int i = 0; i < inputCount; ++i) { |
fInputs[i] = inputs[i]; |
SkSafeRef(fInputs[i]); |
} |
} |
-SkImageFilter::SkImageFilter(SkImageFilter* input) |
- : fInputCount(1), fInputs(new SkImageFilter*[1]) { |
+SkImageFilter::SkImageFilter(SkImageFilter* input, const SkIRect* cropRect) |
+ : fInputCount(1), fInputs(new SkImageFilter*[1]), fCropRect(cropRect ? *cropRect : SkIRect::MakeLargest()) { |
fInputs[0] = input; |
SkSafeRef(fInputs[0]); |
} |
-SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2) |
- : fInputCount(2), fInputs(new SkImageFilter*[2]) { |
+SkImageFilter::SkImageFilter(SkImageFilter* input1, SkImageFilter* input2, const SkIRect* cropRect) |
+ : fInputCount(2), fInputs(new SkImageFilter*[2]), fCropRect(cropRect ? *cropRect : SkIRect::MakeLargest()) { |
fInputs[0] = input1; |
fInputs[1] = input2; |
SkSafeRef(fInputs[0]); |
@@ -56,6 +56,7 @@ SkImageFilter::SkImageFilter(SkFlattenableReadBuffer& buffer) |
fInputs[i] = NULL; |
} |
} |
+ buffer.readIRect(&fCropRect); |
} |
void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
@@ -67,6 +68,7 @@ void SkImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { |
buffer.writeFlattenable(input); |
} |
} |
+ buffer.writeIRect(fCropRect); |
} |
bool SkImageFilter::filterImage(Proxy* proxy, const SkBitmap& src, |
@@ -137,6 +139,10 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitmap* |
#endif |
} |
+void SkImageFilter::applyCropRect(SkIRect* rect) const { |
reed1
2013/07/19 21:34:04
How is this documented to behave if rect and fCrop
Stephen White
2013/07/19 22:11:50
That's a good point!
The SVG spec doesn't call ou
|
+ rect->intersect(fCropRect); |
+} |
+ |
bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm, |
SkIRect* dst) { |
*dst = src; |