OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 GrDrawContext* drawContext, | 60 GrDrawContext* drawContext, |
61 GrPaint* grp, | 61 GrPaint* grp, |
62 const GrClip&, | 62 const GrClip&, |
63 const SkMatrix& viewMatrix, | 63 const SkMatrix& viewMatrix, |
64 const SkStrokeRec& strokeRec, | 64 const SkStrokeRec& strokeRec, |
65 const SkRRect& rrect) const override; | 65 const SkRRect& rrect) const override; |
66 bool filterMaskGPU(GrTexture* src, | 66 bool filterMaskGPU(GrTexture* src, |
67 const SkMatrix& ctm, | 67 const SkMatrix& ctm, |
68 const SkRect& maskRect, | 68 const SkRect& maskRect, |
69 GrTexture** result, | 69 GrTexture** result, |
70 bool canOverwriteSrc) const override; | 70 bool canOverwriteSrc, |
71 GrTextureProvider::SizeConstraint) const override; | |
71 #endif | 72 #endif |
72 | 73 |
73 void computeFastBounds(const SkRect&, SkRect*) const override; | 74 void computeFastBounds(const SkRect&, SkRect*) const override; |
74 bool asABlur(BlurRec*) const override; | 75 bool asABlur(BlurRec*) const override; |
75 | 76 |
76 SK_TO_STRING_OVERRIDE() | 77 SK_TO_STRING_OVERRIDE() |
77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) | 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurMaskFilterImpl) |
78 | 79 |
79 protected: | 80 protected: |
80 FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix&, | 81 FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix&, |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1215 srcRect.setEmpty(); | 1216 srcRect.setEmpty(); |
1216 } | 1217 } |
1217 *maskRect = srcRect; | 1218 *maskRect = srcRect; |
1218 return true; | 1219 return true; |
1219 } | 1220 } |
1220 | 1221 |
1221 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, | 1222 bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, |
1222 const SkMatrix& ctm, | 1223 const SkMatrix& ctm, |
1223 const SkRect& maskRect, | 1224 const SkRect& maskRect, |
1224 GrTexture** result, | 1225 GrTexture** result, |
1225 bool canOverwriteSrc) const { | 1226 bool canOverwriteSrc, |
1227 GrTextureProvider::SizeConstraint const raint) const { | |
1226 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); | 1228 SkRect clipRect = SkRect::MakeWH(maskRect.width(), maskRect.height()); |
1227 | 1229 |
1228 GrContext* context = src->getContext(); | 1230 GrContext* context = src->getContext(); |
1229 | 1231 |
1230 SkScalar xformedSigma = this->computeXformedSigma(ctm); | 1232 SkScalar xformedSigma = this->computeXformedSigma(ctm); |
1231 SkASSERT(xformedSigma > 0); | 1233 SkASSERT(xformedSigma > 0); |
1232 | 1234 |
1233 // If we're doing a normal blur, we can clobber the pathTexture in the | 1235 // If we're doing a normal blur, we can clobber the pathTexture in the |
1234 // gaussianBlur. Otherwise, we need to save it for later compositing. | 1236 // gaussianBlur. Otherwise, we need to save it for later compositing. |
1235 bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle); | 1237 bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle); |
1236 *result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOver writeSrc, | 1238 *result = SkGpuBlurUtils::GaussianBlur(context, src, isNormalBlur && canOver writeSrc, |
1237 clipRect, false, xformedSigma, xforme dSigma); | 1239 clipRect, false, xformedSigma, xforme dSigma, |
1240 constraint); | |
Stephen White
2015/10/22 15:25:04
Just hardcode this to kApproxMatch here, and avoid
reed1
2015/10/22 16:24:55
Doh, great catch. Didn't realize the output of thi
| |
1238 if (nullptr == *result) { | 1241 if (nullptr == *result) { |
1239 return false; | 1242 return false; |
1240 } | 1243 } |
1241 | 1244 |
1242 if (!isNormalBlur) { | 1245 if (!isNormalBlur) { |
1243 GrPaint paint; | 1246 GrPaint paint; |
1244 SkMatrix matrix; | 1247 SkMatrix matrix; |
1245 matrix.setIDiv(src->width(), src->height()); | 1248 matrix.setIDiv(src->width(), src->height()); |
1246 // Blend pathTexture over blurTexture. | 1249 // Blend pathTexture over blurTexture. |
1247 paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(src, ma trix))->unref(); | 1250 paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(src, ma trix))->unref(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1297 } else { | 1300 } else { |
1298 str->append("None"); | 1301 str->append("None"); |
1299 } | 1302 } |
1300 str->append("))"); | 1303 str->append("))"); |
1301 } | 1304 } |
1302 #endif | 1305 #endif |
1303 | 1306 |
1304 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1307 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1305 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1308 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1306 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1309 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |