diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkGaussFilter.cpp | 7 | ||||
-rw-r--r-- | src/core/SkGaussFilter.h | 16 | ||||
-rw-r--r-- | src/core/SkMaskBlurFilter.cpp | 4 |
3 files changed, 7 insertions, 20 deletions
diff --git a/src/core/SkGaussFilter.cpp b/src/core/SkGaussFilter.cpp index c0d612ddec..5bbdc05f43 100644 --- a/src/core/SkGaussFilter.cpp +++ b/src/core/SkGaussFilter.cpp @@ -142,10 +142,3 @@ SkGaussFilter::SkGaussFilter(double sigma, Type type) { fN = calculate_gauss_factors(sigma, fBasis); } } - -int SkGaussFilter::filterDouble(double values[5]) const { - for (int i = 0; i < fN; i++) { - values[i] = fBasis[i]; - } - return fN; -} diff --git a/src/core/SkGaussFilter.h b/src/core/SkGaussFilter.h index be00cf2cc0..8ad0831e9f 100644 --- a/src/core/SkGaussFilter.h +++ b/src/core/SkGaussFilter.h @@ -8,7 +8,7 @@ #ifndef SkGaussFilter_DEFINED #define SkGaussFilter_DEFINED -#include <cstdint> +#include <cstddef> // Define gaussian filters for values of sigma < 2. Produce values good to 1 part in 1,000,000. // Gaussian produces values as defined in the SVG 1.1 spec: @@ -16,6 +16,7 @@ // Bessel produces values as defined in "Scale-Space for Discrete Signals" by Tony Lindeberg class SkGaussFilter { public: + static constexpr int kGaussArrayMax = 5; enum class Type : bool { Gaussian, Bessel @@ -24,24 +25,17 @@ public: // Type selects which method is used to calculate the gaussian factors. SkGaussFilter(double sigma, Type type); + size_t size() const { return fN; } int radius() const { return fN - 1; } - int width() const { return 2 * this->radius() + 1; } - - // TODO: remove filterDouble and use the ranged-for loop interface. - - // Take an array of values where the gaussian factors will be placed. Return the number of - // values filled. - int filterDouble(double values[5]) const; + int width() const { return 2 * this->radius() + 1; } // Allow a filter to be used in a C++ ranged-for loop. const double* begin() const { return &fBasis[0]; } const double* end() const { return &fBasis[fN]; } private: - double fBasis[5]; + double fBasis[kGaussArrayMax]; int fN; }; #endif // SkGaussFilter_DEFINED - - diff --git a/src/core/SkMaskBlurFilter.cpp b/src/core/SkMaskBlurFilter.cpp index 9de68fcedc..dac21ee60c 100644 --- a/src/core/SkMaskBlurFilter.cpp +++ b/src/core/SkMaskBlurFilter.cpp @@ -1159,8 +1159,8 @@ static SkIPoint small_blur(double sigmaX, double sigmaY, const SkMask& src, SkMa } }; - uint16_t gaussFactorsX[5], - gaussFactorsY[5]; + uint16_t gaussFactorsX[SkGaussFilter::kGaussArrayMax], + gaussFactorsY[SkGaussFilter::kGaussArrayMax]; prepareGauss(filterX, gaussFactorsX); prepareGauss(filterY, gaussFactorsY); |