Use correct matrix to adjust blur radius for gpu
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 13 Jan 2014 16:39:39 +0000 (16:39 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 13 Jan 2014 16:39:39 +0000 (16:39 +0000)
BUG=skia:1998
R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/134973002

git-svn-id: http://skia.googlecode.com/svn/trunk@13047 2bbb7eff-a529-9590-31e7-b0007b416f81

expectations/gm/ignored-tests.txt
src/effects/SkBlurMaskFilter.cpp
src/gpu/SkGpuDevice.cpp

index 4e5f56c..6126953 100644 (file)
@@ -34,7 +34,9 @@
 #gradtext_gpu
 
 # Added for skbug.com/1998 by bsalomon. Will require rebaselining when changes are complete.
-bleed
+bleed_gpu
+blurrects_gpu
+simpleblurroundrect_gpu
 
 # Added by sugoi for added test in https://codereview.chromium.org/104853005
 displacement
index f4d032f..fa31743 100644 (file)
@@ -541,7 +541,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRect& srcBounds,
 }
 
 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
-                                         const SkMatrix& matrix,
+                                         const SkMatrix& ctm,
                                          const SkRect& maskRect,
                                          GrTexture** result,
                                          bool canOverwriteSrc) const {
@@ -551,8 +551,7 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
 
     GrContext::AutoWideOpenIdentityDraw awo(context, NULL);
 
-    // FIXME: This isn't the right matrix.
-    SkScalar xformedSigma = this->computeXformedSigma(context->getMatrix());
+    SkScalar xformedSigma = this->computeXformedSigma(ctm);
     SkASSERT(xformedSigma > 0);
 
     // If we're doing a normal blur, we can clobber the pathTexture in the
index 39f9ef3..36e76e9 100644 (file)
@@ -922,6 +922,10 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
                                                     draw.fClip->getBounds(),
                                                     fContext->getMatrix(),
                                                     &maskRect)) {
+            // The context's matrix may change while creating the mask, so save the CTM here to
+            // pass to filterMaskGPU.
+            const SkMatrix ctm = fContext->getMatrix();
+
             SkIRect finalIRect;
             maskRect.roundOut(&finalIRect);
             if (draw.fClip->quickReject(finalIRect)) {
@@ -940,8 +944,7 @@ void SkGpuDevice::drawPath(const SkDraw& draw, const SkPath& origSrcPath,
                 GrTexture* filtered;
 
                 if (paint.getMaskFilter()->filterMaskGPU(mask.texture(),
-                                                         fContext->getMatrix(), maskRect,
-                                                         &filtered, true)) {
+                                                         ctm, maskRect, &filtered, true)) {
                     // filterMaskGPU gives us ownership of a ref to the result
                     SkAutoTUnref<GrTexture> atu(filtered);