diff options
author | Herbert Derby <herb@google.com> | 2017-10-20 14:53:45 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-16 18:06:22 +0000 |
commit | 5e18cdea0a0a3f23d8e8b8140c82a4b54e121402 (patch) | |
tree | 20df99a3ea7ed5cb80eac3fcb0438b167cf028ec /src/core/SkGaussFilter.h | |
parent | 3b2f5b60ff9a82ade01746d7e7cbbcc9348d6c03 (diff) |
Direct evaluation of gaussian
The SVG(CSS) standard allows the 3 pass algorithm for sigma >= 2. But
sigma < 2, the code must evaluate to the convolution. The old code used
an interpolation scheme between windowed filters. This code directly
evaluates the gaussian kernel for sigma < 2.
This code produces cleaner results, is 25% faster, and does not use a
temporary memory buffer.
Change-Id: Ibd0caa73cadd06b637f55ba7bd4fefcfe7ac73db
Reviewed-on: https://skia-review.googlesource.com/62540
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Diffstat (limited to 'src/core/SkGaussFilter.h')
-rw-r--r-- | src/core/SkGaussFilter.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/SkGaussFilter.h b/src/core/SkGaussFilter.h index 9af45c875b..be00cf2cc0 100644 --- a/src/core/SkGaussFilter.h +++ b/src/core/SkGaussFilter.h @@ -27,10 +27,16 @@ public: 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; + // 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]; int fN; |