aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gyp/core.gypi3
-rw-r--r--gyp/effects.gypi3
-rw-r--r--include/core/SkImageFilter.h5
-rw-r--r--include/effects/SkBlurImageFilter.h32
-rw-r--r--src/effects/SkBlurImageFilter.cpp (renamed from src/core/SkBlurImageFilter.cpp)62
-rw-r--r--src/effects/SkGpuBlurUtils.cpp (renamed from src/core/SkGpuBlurUtils.cpp)0
-rw-r--r--src/effects/SkGpuBlurUtils.h (renamed from src/core/SkGpuBlurUtils.h)0
-rw-r--r--src/ports/SkGlobalInitialization_default.cpp2
8 files changed, 46 insertions, 61 deletions
diff --git a/gyp/core.gypi b/gyp/core.gypi
index 0a30618da3..8d1dc8d177 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -60,7 +60,6 @@
'<(skia_src_path)/core/SkBlitter_PM4f.cpp',
'<(skia_src_path)/core/SkBlitter_RGB16.cpp',
'<(skia_src_path)/core/SkBlitter_Sprite.cpp',
- '<(skia_src_path)/core/SkBlurImageFilter.cpp',
'<(skia_src_path)/core/SkBuffer.cpp',
'<(skia_src_path)/core/SkCachedData.cpp',
'<(skia_src_path)/core/SkCanvas.cpp',
@@ -140,8 +139,6 @@
'<(skia_src_path)/core/SkGlyphCache.cpp',
'<(skia_src_path)/core/SkGlyphCache.h',
'<(skia_src_path)/core/SkGlyphCache_Globals.h',
- '<(skia_src_path)/core/SkGpuBlurUtils.h',
- '<(skia_src_path)/core/SkGpuBlurUtils.cpp',
'<(skia_src_path)/core/SkGraphics.cpp',
'<(skia_src_path)/core/SkHalf.cpp',
'<(skia_src_path)/core/SkHalf.h',
diff --git a/gyp/effects.gypi b/gyp/effects.gypi
index 62c6bfdec4..45eced88e2 100644
--- a/gyp/effects.gypi
+++ b/gyp/effects.gypi
@@ -26,6 +26,7 @@
'<(skia_src_path)/effects/SkBlurDrawLooper.cpp',
'<(skia_src_path)/effects/SkBlurMask.cpp',
'<(skia_src_path)/effects/SkBlurMask.h',
+ '<(skia_src_path)/effects/SkBlurImageFilter.cpp',
'<(skia_src_path)/effects/SkBlurMaskFilter.cpp',
'<(skia_src_path)/effects/SkColorCubeFilter.cpp',
'<(skia_src_path)/effects/SkColorFilterImageFilter.cpp',
@@ -44,6 +45,8 @@
'<(skia_src_path)/effects/SkImageSource.cpp',
'<(skia_src_path)/effects/SkGammaColorFilter.cpp',
'<(skia_src_path)/effects/SkGaussianEdgeShader.cpp',
+ '<(skia_src_path)/effects/SkGpuBlurUtils.h',
+ '<(skia_src_path)/effects/SkGpuBlurUtils.cpp',
'<(skia_src_path)/effects/SkLayerDrawLooper.cpp',
'<(skia_src_path)/effects/SkLayerRasterizer.cpp',
'<(skia_src_path)/effects/SkLightingImageFilter.cpp',
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index 97f84dc596..6210073bf4 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -152,10 +152,6 @@ public:
return this->isColorFilterNode(filterPtr);
}
- static sk_sp<SkImageFilter> MakeBlur(SkScalar sigmaX, SkScalar sigmaY,
- sk_sp<SkImageFilter> input,
- const CropRect* cropRect = nullptr);
-
/**
* Returns true (and optionally returns a ref'd filter) if this imagefilter can be completely
* replaced by the returned colorfilter. i.e. the two effects will affect drawing in the
@@ -233,7 +229,6 @@ public:
SK_TO_STRING_PUREVIRT()
SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter)
- SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
protected:
class Common {
diff --git a/include/effects/SkBlurImageFilter.h b/include/effects/SkBlurImageFilter.h
index 085a13b5b3..9bfa19b875 100644
--- a/include/effects/SkBlurImageFilter.h
+++ b/include/effects/SkBlurImageFilter.h
@@ -9,14 +9,40 @@
#define SkBlurImageFilter_DEFINED
#include "SkImageFilter.h"
+#include "SkSize.h"
-class SK_API SkBlurImageFilter {
+class SK_API SkBlurImageFilter : public SkImageFilter {
public:
static sk_sp<SkImageFilter> Make(SkScalar sigmaX, SkScalar sigmaY,
sk_sp<SkImageFilter> input,
- const SkImageFilter::CropRect* cropRect = nullptr) {
- return SkImageFilter::MakeBlur(sigmaX, sigmaY, input, cropRect);
+ const CropRect* cropRect = nullptr);
+
+ SkRect computeFastBounds(const SkRect&) const override;
+
+ SK_TO_STRING_OVERRIDE()
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilter)
+
+#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
+ static SkImageFilter* Create(SkScalar sigmaX, SkScalar sigmaY, SkImageFilter* input = nullptr,
+ const CropRect* cropRect = nullptr) {
+ return Make(sigmaX, sigmaY, sk_ref_sp<SkImageFilter>(input), cropRect).release();
}
+#endif
+
+protected:
+ void flatten(SkWriteBuffer&) const override;
+ sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
+ SkIPoint* offset) const override;
+ SkIRect onFilterNodeBounds(const SkIRect& src, const SkMatrix&, MapDirection) const override;
+
+private:
+ SkBlurImageFilter(SkScalar sigmaX,
+ SkScalar sigmaY,
+ sk_sp<SkImageFilter> input,
+ const CropRect* cropRect);
+
+ SkSize fSigma;
+ typedef SkImageFilter INHERITED;
};
#endif
diff --git a/src/core/SkBlurImageFilter.cpp b/src/effects/SkBlurImageFilter.cpp
index c82837b3fe..37584ab3ad 100644
--- a/src/core/SkBlurImageFilter.cpp
+++ b/src/effects/SkBlurImageFilter.cpp
@@ -5,6 +5,8 @@
* found in the LICENSE file.
*/
+#include "SkBlurImageFilter.h"
+
#include "SkAutoPixmapStorage.h"
#include "SkColorPriv.h"
#include "SkGpuBlurUtils.h"
@@ -18,51 +20,13 @@
#include "SkGr.h"
#endif
-class SkBlurImageFilterImpl : public SkImageFilter {
-public:
- SkBlurImageFilterImpl(SkScalar sigmaX,
- SkScalar sigmaY,
- sk_sp<SkImageFilter> input,
- const CropRect* cropRect);
-
- SkRect computeFastBounds(const SkRect&) const override;
-
- SK_TO_STRING_OVERRIDE()
- SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurImageFilterImpl)
-
-#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR
- static SkImageFilter* Create(SkScalar sigmaX, SkScalar sigmaY, SkImageFilter* input = nullptr,
- const CropRect* cropRect = nullptr) {
- return SkImageInfo::Make(sigmaX, sigmaY, sk_ref_sp<SkImageFilter>(input), cropRect).release();
- }
-#endif
-
-protected:
- void flatten(SkWriteBuffer&) const override;
- sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
- SkIPoint* offset) const override;
- SkIRect onFilterNodeBounds(const SkIRect& src, const SkMatrix&, MapDirection) const override;
-
-private:
- SkSize fSigma;
- typedef SkImageFilter INHERITED;
-
- friend class SkImageFilter;
-};
-
-SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkImageFilter)
- SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilterImpl)
-SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
-
-///////////////////////////////////////////////////////////////////////////////
-
-sk_sp<SkImageFilter> SkImageFilter::MakeBlur(SkScalar sigmaX, SkScalar sigmaY,
+sk_sp<SkImageFilter> SkBlurImageFilter::Make(SkScalar sigmaX, SkScalar sigmaY,
sk_sp<SkImageFilter> input,
const CropRect* cropRect) {
if (0 == sigmaX && 0 == sigmaY && !cropRect) {
return input;
}
- return sk_sp<SkImageFilter>(new SkBlurImageFilterImpl(sigmaX, sigmaY, input, cropRect));
+ return sk_sp<SkImageFilter>(new SkBlurImageFilter(sigmaX, sigmaY, input, cropRect));
}
// This rather arbitrary-looking value results in a maximum box blur kernel size
@@ -80,7 +44,7 @@ static SkVector map_sigma(const SkSize& localSigma, const SkMatrix& ctm) {
return sigma;
}
-SkBlurImageFilterImpl::SkBlurImageFilterImpl(SkScalar sigmaX,
+SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX,
SkScalar sigmaY,
sk_sp<SkImageFilter> input,
const CropRect* cropRect)
@@ -88,14 +52,14 @@ SkBlurImageFilterImpl::SkBlurImageFilterImpl(SkScalar sigmaX,
, fSigma(SkSize::Make(sigmaX, sigmaY)) {
}
-sk_sp<SkFlattenable> SkBlurImageFilterImpl::CreateProc(SkReadBuffer& buffer) {
+sk_sp<SkFlattenable> SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
SkScalar sigmaX = buffer.readScalar();
SkScalar sigmaY = buffer.readScalar();
- return SkImageFilter::MakeBlur(sigmaX, sigmaY, common.getInput(0), &common.cropRect());
+ return Make(sigmaX, sigmaY, common.getInput(0), &common.cropRect());
}
-void SkBlurImageFilterImpl::flatten(SkWriteBuffer& buffer) const {
+void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
buffer.writeScalar(fSigma.fWidth);
buffer.writeScalar(fSigma.fHeight);
@@ -116,7 +80,7 @@ static void get_box3_params(SkScalar s, int *kernelSize, int* kernelSize3, int *
}
}
-sk_sp<SkSpecialImage> SkBlurImageFilterImpl::onFilterImage(SkSpecialImage* source,
+sk_sp<SkSpecialImage> SkBlurImageFilter::onFilterImage(SkSpecialImage* source,
const Context& ctx,
SkIPoint* offset) const {
SkIPoint inputOffset = SkIPoint::Make(0, 0);
@@ -267,14 +231,14 @@ sk_sp<SkSpecialImage> SkBlurImageFilterImpl::onFilterImage(SkSpecialImage* sourc
}
-SkRect SkBlurImageFilterImpl::computeFastBounds(const SkRect& src) const {
+SkRect SkBlurImageFilter::computeFastBounds(const SkRect& src) const {
SkRect bounds = this->getInput(0) ? this->getInput(0)->computeFastBounds(src) : src;
bounds.outset(SkScalarMul(fSigma.width(), SkIntToScalar(3)),
SkScalarMul(fSigma.height(), SkIntToScalar(3)));
return bounds;
}
-SkIRect SkBlurImageFilterImpl::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
+SkIRect SkBlurImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix& ctm,
MapDirection) const {
SkVector sigma = map_sigma(fSigma, ctm);
return src.makeOutset(SkScalarCeilToInt(SkScalarMul(sigma.x(), SkIntToScalar(3))),
@@ -282,8 +246,8 @@ SkIRect SkBlurImageFilterImpl::onFilterNodeBounds(const SkIRect& src, const SkMa
}
#ifndef SK_IGNORE_TO_STRING
-void SkBlurImageFilterImpl::toString(SkString* str) const {
- str->appendf("SkBlurImageFilterImpl: (");
+void SkBlurImageFilter::toString(SkString* str) const {
+ str->appendf("SkBlurImageFilter: (");
str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight);
if (this->getInput(0)) {
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp
index ca762e88e3..ca762e88e3 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/effects/SkGpuBlurUtils.cpp
diff --git a/src/core/SkGpuBlurUtils.h b/src/effects/SkGpuBlurUtils.h
index a12a08873c..a12a08873c 100644
--- a/src/core/SkGpuBlurUtils.h
+++ b/src/effects/SkGpuBlurUtils.h
diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp
index fdafd9609a..cc697ce0ba 100644
--- a/src/ports/SkGlobalInitialization_default.cpp
+++ b/src/ports/SkGlobalInitialization_default.cpp
@@ -102,7 +102,7 @@ void SkFlattenable::PrivateInitializer::InitEffects() {
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSumPathEffect)
// ImageFilter
- SkImageFilter::InitializeFlattenables();
+ SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDilateImageFilter)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDisplacementMapEffect)
SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDropShadowImageFilter)