diff options
author | Matt Sarett <msarett@google.com> | 2017-04-07 16:54:04 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-10 13:35:42 +0000 |
commit | 31abf1fc945c27755173b78037e62576cf2dd62e (patch) | |
tree | 659096eb43435b636fd617e66b5fdc0dbba2887d /include/core/SkImageFilter.h | |
parent | 1dd161c833927d61d436fed68a80b07e44c65226 (diff) |
Add SkImageFilter::makeColorSpace(SkColorSpaceXformer*)
Plus two sample implementations. Will fill out the
rest if the model looks ok.
Bug: skia:
Change-Id: Ie24ecd0cbc36263220cb1e506f7812c582554e50
Reviewed-on: https://skia-review.googlesource.com/12100
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'include/core/SkImageFilter.h')
-rw-r--r-- | include/core/SkImageFilter.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index ea2afa2f2e..74e8d80c31 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -20,6 +20,7 @@ class GrContext; class GrFragmentProcessor; class SkColorFilter; +class SkColorSpaceXformer; struct SkIPoint; class SkSpecialImage; class SkImageFilterCache; @@ -283,6 +284,10 @@ protected: void flatten(SkWriteBuffer&) const override; + const CropRect* getCropRectIfSet() const { + return this->cropRectIsSet() ? &fCropRect : nullptr; + } + /** * This is the virtual which should be overridden by the derived class * to perform image filtering. @@ -395,8 +400,21 @@ protected: static sk_sp<SkSpecialImage> ImageToColorSpace(SkSpecialImage* src, const OutputProperties&); #endif + /** + * Returns an image filter transformed into a new color space via the |xformer|. + */ + sk_sp<SkImageFilter> makeColorSpace(SkColorSpaceXformer* xformer) const { + return this->onMakeColorSpace(xformer); + } + virtual sk_sp<SkImageFilter> onMakeColorSpace(SkColorSpaceXformer*) const { + return sk_ref_sp(const_cast<SkImageFilter*>(this)); + } + private: + friend class ArithmeticImageFilterImpl; + friend class SkColorSpaceXformer; friend class SkGraphics; + static void PurgeCache(); void init(sk_sp<SkImageFilter>* inputs, int inputCount, const CropRect* cropRect); |