diff options
author | Herb Derby <herb@google.com> | 2017-09-06 14:40:48 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-09-06 18:59:28 +0000 |
commit | 2c75957b0fc931a1376e613e29123bcd43d5f14f (patch) | |
tree | d1a3f63be43173962a66eb88a5ddb4e1904a53eb /src/core/SkMaskBlurFilter.h | |
parent | cc7f660a85204aadb6ba658bc905664bba4712ff (diff) |
Clean up mask blur code.
This code has interpolation for small radii like the old code.
This code is protected by the flag:
SK_LEGACY_SUPPORT_INTEGER_SMALL_RADII
In addition, I have improved the scale calculation for Gauss to be more
accurate, and it is also protected by the flag:
SK_LEGACY_SUPPORT_INTEGER_SMALL_RADII
When SK_LEGACY_SUPPORT_INTEGER_SMALL_RADII is defined, then there
is no difference.
Bug: skia:
Change-Id: I588299c3768dd009852ce41f33a6a8572d9f4ad3
Reviewed-on: https://skia-review.googlesource.com/41746
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core/SkMaskBlurFilter.h')
-rw-r--r-- | src/core/SkMaskBlurFilter.h | 59 |
1 files changed, 2 insertions, 57 deletions
diff --git a/src/core/SkMaskBlurFilter.h b/src/core/SkMaskBlurFilter.h index 26efe95de5..0a7895d95c 100644 --- a/src/core/SkMaskBlurFilter.h +++ b/src/core/SkMaskBlurFilter.h @@ -19,39 +19,6 @@ // https://drafts.fxtf.org/filters/#feGaussianBlurElement class SkMaskBlurFilter { public: - // Given a filter specified by sigma, generate various quantities. - class FilterInfo { - public: - explicit FilterInfo(double sigma); - - // The final weight to divide by given a box size calculated from sigma accumulated for - // all three passes. For example, if the box size is 5, then the final weight for all - // three passes is 5^3 or 125. - uint64_t weight() const; - - // The distance between the first value of the dst and the first value of the src. - uint32_t borderSize() const; - - // The size of the box filter. - size_t diameter(uint8_t) const; - - // A factor used to simulate division using multiplication and shift. - uint64_t scaledWeight() const; - - // Returned when sigma < 2. - bool isSmall() const; - - // Factors for interpolating box blur. - std::tuple<uint64_t, uint64_t> interpFactors() const; - - private: - const bool fIsSmall; - const uint32_t fFilterWindow; - const uint64_t fWeight; - const uint64_t fScaledWeight; - const std::tuple<uint64_t, uint64_t> fInterpFactors; - }; - // Create an object suitable for filtering an SkMask using a filter with width sigmaW and // height sigmaH. SkMaskBlurFilter(double sigmaW, double sigmaH); @@ -63,30 +30,8 @@ public: SkIPoint blur(const SkMask& src, SkMask* dst) const; private: - size_t bufferSize(uint8_t bufferPass) const; - - void blurOneScan(const FilterInfo& gen, size_t width, - const uint8_t* src, size_t srcStride, const uint8_t* srcEnd, - uint8_t* dst, size_t dstStride, uint8_t* dstEnd) const; - - void blurOneScanBox(const FilterInfo& gen, - const uint8_t* src, size_t srcStride, const uint8_t* srcEnd, - uint8_t* dst, size_t dstStride, uint8_t* dstEnd) const; - - void blurOneScanBoxInterp(const FilterInfo& gen, size_t width, - const uint8_t* src, size_t srcStride, const uint8_t* srcEnd, - uint8_t* dst, size_t dstStride, uint8_t* dstEnd) const; - - void blurOneScanGauss(const FilterInfo& gen, - const uint8_t* src, size_t srcStride, const uint8_t* srcEnd, - uint8_t* dst, size_t dstStride, uint8_t* dstEnd) const; - - - const FilterInfo fInfoW, - fInfoH; - std::unique_ptr<uint32_t[]> fBuffer0, - fBuffer1, - fBuffer2; + const double fSigmaW; + const double fSigmaH; }; #endif // SkBlurMaskFilter_DEFINED |