Fix up flags to SkGpuBlurUtils::GaussianBlur
authorrobertphillips <robertphillips@google.com>
Mon, 27 Jun 2016 18:11:05 +0000 (11:11 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 27 Jun 2016 18:11:05 +0000 (11:11 -0700)
This fixes a bug introduced in: https://codereview.chromium.org/1961953002/ (Reland of Simplify SkGpuBlurUtils::GaussianBlur method)

Although the 'canOverwriteSrc' flag is/was being used I still believe we're better off re-adding it after the mask-blur refactoring finishes.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2100873002

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

include/core/SkMaskFilter.h
src/core/SkMaskFilter.cpp
src/effects/SkBlurMaskFilter.cpp
src/gpu/GrBlurUtils.cpp

index fbd749e837f856115fe4682daad657df1aeb8db6..908226c8adf2444d99c6a54b7b2783acdb804bbc 100644 (file)
@@ -133,16 +133,14 @@ public:
     /**
      * This function is used to implement filters that require an explicit src mask. It should only
      * be called if canFilterMaskGPU returned true and the maskRect param should be the output from
-     * that call. canOverwriteSrc indicates whether the implementation may treat src as a scratch
-     * texture and overwrite its contents. When true it is also legal to return src as the result.
+     * that call.
      * Implementations are free to get the GrContext from the src texture in order to create
      * additional textures and perform multiple passes.
      */
     virtual bool filterMaskGPU(GrTexture* src,
                                const SkMatrix& ctm,
                                const SkIRect& maskRect,
-                               GrTexture** result,
-                               bool canOverwriteSrc) const;
+                               GrTexture** result) const;
 #endif
 
     /**
index 86fc40ebacc3edaec3ee9a45cd55a0c74f60a339..fccce45a7705ece4e6b39c749df211c75c1ec94f 100644 (file)
@@ -337,8 +337,7 @@ bool SkMaskFilter::directFilterRRectMaskGPU(GrTextureProvider* texProvider,
 bool SkMaskFilter::filterMaskGPU(GrTexture* src,
                                  const SkMatrix& ctm,
                                  const SkIRect& maskRect,
-                                 GrTexture** result,
-                                 bool canOverwriteSrc) const {
+                                 GrTexture** result) const {
     return false;
 }
 #endif
index 1d277f8d7657f21c7be5d50e17cfc3aa57e0f501..6a20d48c758cd1f64f5fe4ab38d2fca93bece2be 100644 (file)
@@ -67,8 +67,7 @@ public:
     bool filterMaskGPU(GrTexture* src,
                        const SkMatrix& ctm,
                        const SkIRect& maskRect,
-                       GrTexture** result,
-                       bool canOverwriteSrc) const override;
+                       GrTexture** result) const override;
 #endif
 
     void computeFastBounds(const SkRect&, SkRect*) const override;
@@ -1235,8 +1234,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRRect& devRRect,
 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
                                          const SkMatrix& ctm,
                                          const SkIRect& maskRect,
-                                         GrTexture** result,
-                                         bool canOverwriteSrc) const {
+                                         GrTexture** result) const {
     // 'maskRect' isn't snapped to the UL corner but the mask in 'src' is.
     const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height());
 
@@ -1247,9 +1245,10 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
 
     // If we're doing a normal blur, we can clobber the pathTexture in the
     // gaussianBlur.  Otherwise, we need to save it for later compositing.
+    static const bool kIsGammaCorrect = false;
     bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
     sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src,
-                                                                  isNormalBlur && canOverwriteSrc,
+                                                                  kIsGammaCorrect,
                                                                   clipRect, nullptr,
                                                                   xformedSigma, xformedSigma));
     if (!drawContext) {
index 94c6ea066926712720eb8e23bb69625c6a313bb6..371f7fb0bab7917811b3c830e30c529fe4a586cd 100644 (file)
@@ -220,7 +220,7 @@ static void draw_path_with_mask_filter(GrContext* context,
         if (mask) {
             GrTexture* filtered;
 
-            if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered, true)) {
+            if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered)) {
                 // filterMaskGPU gives us ownership of a ref to the result
                 SkAutoTUnref<GrTexture> atu(filtered);
                 if (draw_mask(drawContext, clip, viewMatrix, finalIRect, paint, filtered)) {