diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-27 16:14:03 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-27 16:14:03 +0000 |
commit | 7ce661d19c5cf4484305a1b20c44bd111f129847 (patch) | |
tree | f92424e3d513b3f002481b2c66985113725cf488 /include/effects | |
parent | 45891b8e37e131b8298f64ff81b80999ba23b8d6 (diff) |
Blur refactoring
https://codereview.chromium.org/21835004/
git-svn-id: http://skia.googlecode.com/svn/trunk@10936 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects')
-rw-r--r-- | include/effects/SkBlurDrawLooper.h | 6 | ||||
-rw-r--r-- | include/effects/SkBlurMaskFilter.h | 24 | ||||
-rw-r--r-- | include/effects/SkEmbossMaskFilter.h | 5 |
3 files changed, 28 insertions, 7 deletions
diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h index e968857889..8e0c2dd001 100644 --- a/include/effects/SkBlurDrawLooper.h +++ b/include/effects/SkBlurDrawLooper.h @@ -35,6 +35,10 @@ public: kAll_BlurFlag = 0x07 }; + SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, + uint32_t flags = kNone_BlurFlag); + + // DEPRECATED - radius-based SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags = kNone_BlurFlag); virtual ~SkBlurDrawLooper(); @@ -64,6 +68,8 @@ private: }; State fState; + void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags); + typedef SkDrawLooper INHERITED; }; diff --git a/include/effects/SkBlurMaskFilter.h b/include/effects/SkBlurMaskFilter.h index 2ab321aa7a..81c0ceb80d 100644 --- a/include/effects/SkBlurMaskFilter.h +++ b/include/effects/SkBlurMaskFilter.h @@ -33,27 +33,39 @@ public: kAll_BlurFlag = 0x03 }; + /** + * DEPRECATED - radius-based + */ + static SkMaskFilter* Create(SkScalar radius, BlurStyle style, + uint32_t flags = kNone_BlurFlag); + /** Create a blur maskfilter. - @param radius The radius to extend the blur from the original mask. Must be > 0. @param style The BlurStyle to use + @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0. @param flags Flags to use - defaults to none @return The new blur maskfilter */ - static SkMaskFilter* Create(SkScalar radius, BlurStyle style, + static SkMaskFilter* Create(BlurStyle style, SkScalar sigma, uint32_t flags = kNone_BlurFlag); /** Create an emboss maskfilter + @param blurSigma standard deviation of the Gaussian blur to apply + before applying lighting (e.g. 3) @param direction array of 3 scalars [x, y, z] specifying the direction of the light source @param ambient 0...1 amount of ambient light @param specular coefficient for specular highlights (e.g. 8) - @param blurRadius amount to blur before applying lighting (e.g. 3) @return the emboss maskfilter */ - static SkMaskFilter* CreateEmboss( const SkScalar direction[3], - SkScalar ambient, SkScalar specular, - SkScalar blurRadius); + static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar direction[3], + SkScalar ambient, SkScalar specular); + + // DEPRECATED - radius-based + static SkMaskFilter* CreateEmboss(const SkScalar direction[3], + SkScalar ambient, SkScalar specular, + SkScalar blurRadius); SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() + private: SkBlurMaskFilter(); // can't be instantiated }; diff --git a/include/effects/SkEmbossMaskFilter.h b/include/effects/SkEmbossMaskFilter.h index c6679200b3..4b5bd6f983 100644 --- a/include/effects/SkEmbossMaskFilter.h +++ b/include/effects/SkEmbossMaskFilter.h @@ -23,6 +23,9 @@ public: uint8_t fSpecular; // exponent, 4.4 right now }; + SkEmbossMaskFilter(SkScalar blurSigma, const Light& light); + + // DEPRECATED - radius-based SkEmbossMaskFilter(const Light& light, SkScalar blurRadius); // overrides from SkMaskFilter @@ -41,7 +44,7 @@ protected: private: Light fLight; - SkScalar fBlurRadius; + SkScalar fBlurSigma; typedef SkMaskFilter INHERITED; }; |