Chromium Code Reviews| Index: src/effects/SkAlphaThresholdFilter.cpp |
| diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp |
| index 6fcd2b4351e238b51ffc5588f58ad79a5c38c163..38f742694d52dcee4ee375c6eb0636e5e62590d8 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& scale, |
| + SkScalar innerThreshold, SkScalar outerThreshold); |
| SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkAlphaThresholdFilterImpl) |
| @@ -30,6 +31,7 @@ protected: |
| private: |
| SkRegion fRegion; |
| + SkMatrix fScale; |
| 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 scale; |
| + scale.setScale(1.f, 1.f); |
|
bsalomon
2014/07/11 13:00:25
SkMatrix has a reset() function that will set it t
garykac
2014/07/11 19:10:59
Done.
|
| + return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, scale, innerThreshold, outerThreshold)); |
| +} |
| + |
| +SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region, |
| + const SkMatrix& scale, |
| + SkScalar innerThreshold, |
| + SkScalar outerThreshold) { |
| + return SkNEW_ARGS(SkAlphaThresholdFilterImpl, (region, scale, 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(&fScale); |
| fInnerThreshold = buffer.readScalar(); |
| fOuterThreshold = buffer.readScalar(); |
| buffer.readRegion(&fRegion); |
| } |
| SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region, |
| + const SkMatrix& scale, |
| SkScalar innerThreshold, |
| SkScalar outerThreshold) |
| : INHERITED(0) |
| , fRegion(region) |
| + , fScale(scale) |
| , 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(fScale); |
| 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(fScale); |
| buffer.writeScalar(fInnerThreshold); |
| buffer.writeScalar(fOuterThreshold); |
| buffer.writeRegion(fRegion); |