Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 2100873002: Fix up flags to SkGpuBlurUtils::GaussianBlur (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/gpu/GrBlurUtils.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBlurMaskFilter.h" 8 #include "SkBlurMaskFilter.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkGpuBlurUtils.h" 10 #include "SkGpuBlurUtils.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 bool directFilterRRectMaskGPU(GrTextureProvider* texProvider, 60 bool directFilterRRectMaskGPU(GrTextureProvider* texProvider,
61 GrDrawContext* drawContext, 61 GrDrawContext* drawContext,
62 GrPaint* grp, 62 GrPaint* grp,
63 const GrClip&, 63 const GrClip&,
64 const SkMatrix& viewMatrix, 64 const SkMatrix& viewMatrix,
65 const SkStrokeRec& strokeRec, 65 const SkStrokeRec& strokeRec,
66 const SkRRect& rrect) const override; 66 const SkRRect& rrect) const override;
67 bool filterMaskGPU(GrTexture* src, 67 bool filterMaskGPU(GrTexture* src,
68 const SkMatrix& ctm, 68 const SkMatrix& ctm,
69 const SkIRect& maskRect, 69 const SkIRect& maskRect,
70 GrTexture** result, 70 GrTexture** result) const override;
71 bool canOverwriteSrc) const override;
72 #endif 71 #endif
73 72
74 void computeFastBounds(const SkRect&, SkRect*) const override; 73 void computeFastBounds(const SkRect&, SkRect*) const override;
75 bool asABlur(BlurRec*) const override; 74 bool asABlur(BlurRec*) const override;
76 75
77 SK_TO_STRING_OVERRIDE() 76 SK_TO_STRING_OVERRIDE()
78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) 77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl)
79 78
80 protected: 79 protected:
81 FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix&, 80 FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix&,
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 if (!srcRect.intersect(clipRect)) { 1227 if (!srcRect.intersect(clipRect)) {
1229 srcRect.setEmpty(); 1228 srcRect.setEmpty();
1230 } 1229 }
1231 *maskRect = srcRect; 1230 *maskRect = srcRect;
1232 return true; 1231 return true;
1233 } 1232 }
1234 1233
1235 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, 1234 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
1236 const SkMatrix& ctm, 1235 const SkMatrix& ctm,
1237 const SkIRect& maskRect, 1236 const SkIRect& maskRect,
1238 GrTexture** result, 1237 GrTexture** result) const {
1239 bool canOverwriteSrc) const {
1240 // 'maskRect' isn't snapped to the UL corner but the mask in 'src' is. 1238 // 'maskRect' isn't snapped to the UL corner but the mask in 'src' is.
1241 const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height() ); 1239 const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height() );
1242 1240
1243 GrContext* context = src->getContext(); 1241 GrContext* context = src->getContext();
1244 1242
1245 SkScalar xformedSigma = this->computeXformedSigma(ctm); 1243 SkScalar xformedSigma = this->computeXformedSigma(ctm);
1246 SkASSERT(xformedSigma > 0); 1244 SkASSERT(xformedSigma > 0);
1247 1245
1248 // If we're doing a normal blur, we can clobber the pathTexture in the 1246 // If we're doing a normal blur, we can clobber the pathTexture in the
1249 // gaussianBlur. Otherwise, we need to save it for later compositing. 1247 // gaussianBlur. Otherwise, we need to save it for later compositing.
1248 static const bool kIsGammaCorrect = false;
1250 bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle); 1249 bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
1251 sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src, 1250 sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src,
1252 isNormalBlur & & canOverwriteSrc, 1251 kIsGammaCorrec t,
1253 clipRect, null ptr, 1252 clipRect, null ptr,
1254 xformedSigma, xformedSigma)); 1253 xformedSigma, xformedSigma));
1255 if (!drawContext) { 1254 if (!drawContext) {
1256 return false; 1255 return false;
1257 } 1256 }
1258 1257
1259 if (!isNormalBlur) { 1258 if (!isNormalBlur) {
1260 GrPaint paint; 1259 GrPaint paint;
1261 SkMatrix matrix; 1260 SkMatrix matrix;
1262 matrix.setIDiv(src->width(), src->height()); 1261 matrix.setIDiv(src->width(), src->height());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 } else { 1311 } else {
1313 str->append("None"); 1312 str->append("None");
1314 } 1313 }
1315 str->append("))"); 1314 str->append("))");
1316 } 1315 }
1317 #endif 1316 #endif
1318 1317
1319 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1318 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1320 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1319 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1321 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1320 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkMaskFilter.cpp ('k') | src/gpu/GrBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698