diff options
author | Matt Sarett <msarett@google.com> | 2017-03-28 15:27:06 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-28 19:29:00 +0000 |
commit | 56ea77ac5f782d0165b2992b9575b4e3b9b15715 (patch) | |
tree | 57a6f6f05d505e9638136023422f19c92475e902 /include/effects | |
parent | 8cb66485e54feefe499cae182edd3ef70130dfb1 (diff) |
Implement SkBlurDrawLooper with SkLayerDrawLooper
This allows us to delete SkBlurDrawLooper (and leave only one draw
looper implementation).
BUG=skia:
Change-Id: I549af86b81babf19e3649bdffffe2fdb0b308d5a
Reviewed-on: https://skia-review.googlesource.com/10101
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'include/effects')
-rw-r--r-- | include/effects/SkBlurDrawLooper.h | 60 |
1 files changed, 6 insertions, 54 deletions
diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h index 415018a2ad..45289c8941 100644 --- a/include/effects/SkBlurDrawLooper.h +++ b/include/effects/SkBlurDrawLooper.h @@ -10,61 +10,13 @@ #define SkBlurDrawLooper_DEFINED #include "SkDrawLooper.h" -#include "SkColor.h" -class SkArenaAlloc; -class SkMaskFilter; -class SkColorFilter; - -/** \class SkBlurDrawLooper - This class draws a shadow of the object (possibly offset), and then draws - the original object in its original position. - should there be an option to just draw the shadow/blur layer? webkit? -*/ -class SK_API SkBlurDrawLooper : public SkDrawLooper { -public: - static sk_sp<SkDrawLooper> Make(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy) { - return sk_sp<SkDrawLooper>(new SkBlurDrawLooper(color, sigma, dx, dy)); - } - - SkDrawLooper::Context* makeContext(SkCanvas*, SkArenaAlloc*) const override; - - SK_TO_STRING_OVERRIDE() - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) - -protected: - SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy); - - void flatten(SkWriteBuffer&) const override; - - bool asABlurShadow(BlurShadowRec*) const override; - -private: - sk_sp<SkMaskFilter> fBlur; - SkScalar fDx, fDy, fSigma; - SkColor fBlurColor; - - enum State { - kBeforeEdge, - kAfterEdge, - kDone - }; - - class BlurDrawLooperContext : public SkDrawLooper::Context { - public: - explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper); - - bool next(SkCanvas* canvas, SkPaint* paint) override; - - private: - const SkBlurDrawLooper* fLooper; - State fState; - }; - - void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color); - void initEffects(); - - typedef SkDrawLooper INHERITED; +/** + * Draws a shadow of the object (possibly offset), and then draws the original object in + * its original position. + */ +namespace SkBlurDrawLooper { + sk_sp<SkDrawLooper> Make(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy); }; #endif |