Chromium Code Reviews| Index: src/effects/SkAlphaThresholdFilter.cpp |
| diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp |
| index 6fcd2b4351e238b51ffc5588f58ad79a5c38c163..af3887359a4e6173e1dc69d4a556fc8599ba0eaa 100644 |
| --- a/src/effects/SkAlphaThresholdFilter.cpp |
| +++ b/src/effects/SkAlphaThresholdFilter.cpp |
| @@ -13,7 +13,8 @@ |
| class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { |
| public: |
| - SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold, SkScalar outerThreshold); |
| + SkAlphaThresholdFilterImpl(const SkRegion& region, const SkMatrix& transform, |
| + SkScalar innerThreshold, SkScalar outerThreshold); |
| SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl) |
| @@ -30,6 +31,7 @@ protected: |
| private: |
| SkRegion fRegion; |
| + SkMatrix fTransform; |
| SkScalar fInnerThreshold; |
| SkScalar fOuterThreshold; |
| typedef SkImageFilter INHERITED; |
| @@ -38,7 +40,16 @@ private: |
| SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, |
| SkScalar innerThreshold, |
| SkScalar outerThreshold) { |
| - return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, innerThreshold, outerThreshold)); |
| + SkMatrix transform; |
| + transform.reset(); |
| + return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, transform, innerThreshold, outerThreshold)); |
| +} |
| + |
| +SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, |
| + const SkMatrix& transform, |
|
Stephen White
2014/07/11 20:15:24
Is there a reason this needs to be a separate matr
|
| + SkScalar innerThreshold, |
| + SkScalar outerThreshold) { |
| + return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, transform, innerThreshold, outerThreshold)); |
| } |
| #if SK_SUPPORT_GPU |
| @@ -233,16 +244,19 @@ void AlphaThresholdEffect::getConstantColorComponents(GrColor* color, uint32_t* |
| SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(SkReadBuffer& buffer) |
| : INHERITED(1, buffer) { |
| + buffer.readMatrix(&fTransform); |
| fInnerThreshold = buffer.readScalar(); |
| fOuterThreshold = buffer.readScalar(); |
| buffer.readRegion(&fRegion); |
| } |
| SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, |
| + const SkMatrix& transform, |
| SkScalar innerThreshold, |
| SkScalar outerThreshold) |
| : INHERITED(0) |
| , fRegion(region) |
| + , fTransform(transform) |
| , fInnerThreshold(innerThreshold) |
| , fOuterThreshold(outerThreshold) { |
| } |
| @@ -278,6 +292,7 @@ bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffectRef** effect, GrTexture* te |
| SkMatrix old_matrix = context->getMatrix(); |
| context->setMatrix(in_matrix); |
| + context->concatMatrix(fTransform); |
| while (!iter.done()) { |
| SkRect rect = SkRect::Make(iter.rect()); |
| @@ -298,6 +313,7 @@ bool SkAlphaThresholdFilterImpl::asNewEffect(GrEffectRef** effect, GrTexture* te |
| void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const { |
| this->INHERITED::flatten(buffer); |
| + buffer.writeMatrix(fTransform); |
| buffer.writeScalar(fInnerThreshold); |
| buffer.writeScalar(fOuterThreshold); |
| buffer.writeRegion(fRegion); |