Revert of Moving SkBlurImageFilter into core (patchset #6 id:100001 of https://codere...
authormtklein <mtklein@google.com>
Mon, 22 Aug 2016 16:25:59 +0000 (09:25 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 22 Aug 2016 16:25:59 +0000 (09:25 -0700)
Reason for revert:
It looks like this breaks our roll into Google3:
https://test.corp.google.com/ui#id=OCL:130943857:BASE:130944046:1471881622765:61dbdd3

Original issue's description:
> Moving SkBlurImageFilter into core
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2255803003
>
> Committed: https://skia.googlesource.com/skia/+/dd3259eb95c3b47e11eefa3b176365a112a32b48

TBR=reed@google.com,fmalita@chromium.org,vjiaoblack@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review-Url: https://codereview.chromium.org/2263283002

gyp/core.gypi
gyp/effects.gypi
include/core/SkImageFilter.h
include/effects/SkBlurImageFilter.h
src/effects/SkBlurImageFilter.cpp [moved from src/core/SkBlurImageFilter.cpp with 82% similarity]
src/effects/SkGpuBlurUtils.cpp [moved from src/core/SkGpuBlurUtils.cpp with 100% similarity]
src/effects/SkGpuBlurUtils.h [moved from src/core/SkGpuBlurUtils.h with 100% similarity]
src/ports/SkGlobalInitialization_default.cpp

index 0a30618..8d1dc8d 100644 (file)
@@ -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',
         '<(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',
index 62c6bfd..45eced8 100644 (file)
@@ -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',
index 97f84dc..6210073 100644 (file)
@@ -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 {
index 085a13b..9bfa19b 100644 (file)
@@ -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
similarity index 82%
rename from src/core/SkBlurImageFilter.cpp
rename to src/effects/SkBlurImageFilter.cpp
index b190554..37584ab 100644 (file)
@@ -5,6 +5,8 @@
  * found in the LICENSE file.
  */
 
+#include "SkBlurImageFilter.h"
+
 #include "SkAutoPixmapStorage.h"
 #include "SkColorPriv.h"
 #include "SkGpuBlurUtils.h"
 #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 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)) {
index fdafd96..cc697ce 100644 (file)
@@ -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)