aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-03-12 14:03:47 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-12 18:48:18 +0000
commit18e7556371506fd08bd0767a270c5db5a7804103 (patch)
treedbb3791194125d85970936ae37168770a0e8cc54 /include
parent05cb229e58efa052db5acf33be0441f4b4a28e7c (diff)
move blur impl into core
Ever since we added drawShadow to the public api, blurs have necessarily part of the core. This CL just formalizes that. This should also allow us to have builds that exclude all of /effects (for code size) and still be valid. Will follow-up with a change to deprecate SkBlurMaskFilter and SkBlurQuality (both no longer needed). Bug: skia: Change-Id: Ifbbd8b47a30a0386d215726b67bcf1e8b84fb8f5 Reviewed-on: https://skia-review.googlesource.com/113713 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/core/SkBlurTypes.h1
-rw-r--r--include/core/SkMaskFilter.h17
-rw-r--r--include/effects/SkBlurMaskFilter.h2
3 files changed, 18 insertions, 2 deletions
diff --git a/include/core/SkBlurTypes.h b/include/core/SkBlurTypes.h
index afbec19b6c..b87ad0823e 100644
--- a/include/core/SkBlurTypes.h
+++ b/include/core/SkBlurTypes.h
@@ -19,6 +19,7 @@ enum SkBlurStyle {
kLastEnum_SkBlurStyle = kInner_SkBlurStyle
};
+// DEPRECATED
enum SkBlurQuality {
kLow_SkBlurQuality, //!< e.g. box filter
kHigh_SkBlurQuality, //!< e.g. 3-pass similar to gaussian
diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h
index 8c6e5a9e51..b506779d01 100644
--- a/include/core/SkMaskFilter.h
+++ b/include/core/SkMaskFilter.h
@@ -8,10 +8,13 @@
#ifndef SkMaskFilter_DEFINED
#define SkMaskFilter_DEFINED
+#include "SkBlurTypes.h"
#include "SkCoverageMode.h"
#include "SkFlattenable.h"
+#include "SkScalar.h"
class SkMatrix;
+struct SkRect;
class SkString;
/** \class SkMaskFilter
@@ -21,6 +24,20 @@ class SkString;
*/
class SK_API SkMaskFilter : public SkFlattenable {
public:
+ /** Create a blur maskfilter.
+ * @param style The SkBlurStyle to use
+ * @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
+ * @param occluder The rect for which no pixels need be drawn (b.c. it will be overdrawn
+ * with some opaque object. This is just a hint which backends are free to
+ * ignore.
+ * @param respectCTM if true the blur's sigma is modified by the CTM.
+ * @return The new blur maskfilter
+ */
+ static sk_sp<SkMaskFilter> MakeBlur(SkBlurStyle style, SkScalar sigma, const SkRect& occluder,
+ bool respectCTM = true);
+ static sk_sp<SkMaskFilter> MakeBlur(SkBlurStyle style, SkScalar sigma,
+ bool respectCTM = true);
+
/**
* Construct a maskfilter whose effect is to first apply the inner filter and then apply
* the outer filter to the result of the inner's. Returns nullptr on failure.
diff --git a/include/effects/SkBlurMaskFilter.h b/include/effects/SkBlurMaskFilter.h
index bc5e1a2dcc..bc4ee8049f 100644
--- a/include/effects/SkBlurMaskFilter.h
+++ b/include/effects/SkBlurMaskFilter.h
@@ -58,8 +58,6 @@ public:
SkScalar ambient, SkScalar specular);
#endif
- SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
-
private:
SkBlurMaskFilter(); // can't be instantiated
};