OLD | NEW |
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" |
11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
13 #include "SkMaskFilter.h" | 13 #include "SkMaskFilter.h" |
14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
| 15 #include "SkRTConf.h" |
15 #include "SkStringUtils.h" | 16 #include "SkStringUtils.h" |
16 #include "SkStrokeRec.h" | 17 #include "SkStrokeRec.h" |
17 | 18 |
18 #if SK_SUPPORT_GPU | 19 #if SK_SUPPORT_GPU |
19 #include "GrCircleBlurFragmentProcessor.h" | 20 #include "GrCircleBlurFragmentProcessor.h" |
20 #include "GrContext.h" | 21 #include "GrContext.h" |
21 #include "GrDrawContext.h" | 22 #include "GrDrawContext.h" |
22 #include "GrTexture.h" | 23 #include "GrTexture.h" |
23 #include "GrFragmentProcessor.h" | 24 #include "GrFragmentProcessor.h" |
24 #include "GrInvariantOutput.h" | 25 #include "GrInvariantOutput.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 static SkCachedData* add_cached_rects(SkMask* mask, SkScalar sigma, SkBlurStyle
style, | 297 static SkCachedData* add_cached_rects(SkMask* mask, SkScalar sigma, SkBlurStyle
style, |
297 SkBlurQuality quality, const SkRect rects[
], int count) { | 298 SkBlurQuality quality, const SkRect rects[
], int count) { |
298 SkCachedData* cache = copy_mask_to_cacheddata(mask); | 299 SkCachedData* cache = copy_mask_to_cacheddata(mask); |
299 if (cache) { | 300 if (cache) { |
300 SkMaskCache::Add(sigma, style, quality, rects, count, *mask, cache); | 301 SkMaskCache::Add(sigma, style, quality, rects, count, *mask, cache); |
301 } | 302 } |
302 return cache; | 303 return cache; |
303 } | 304 } |
304 | 305 |
305 #ifdef SK_IGNORE_FAST_RRECT_BLUR | 306 #ifdef SK_IGNORE_FAST_RRECT_BLUR |
306 // Use the faster analytic blur approach for ninepatch round rects | 307 SK_CONF_DECLARE(bool, c_analyticBlurRRect, "mask.filter.blur.analyticblurrrect",
false, "Use the faster analytic blur approach for ninepatch rects"); |
307 static const bool c_analyticBlurRRect{false}; | |
308 #else | 308 #else |
309 static const bool c_analyticBlurRRect{true}; | 309 SK_CONF_DECLARE(bool, c_analyticBlurRRect, "mask.filter.blur.analyticblurrrect",
true, "Use the faster analytic blur approach for ninepatch round rects"); |
310 #endif | 310 #endif |
311 | 311 |
312 SkMaskFilter::FilterReturn | 312 SkMaskFilter::FilterReturn |
313 SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
trix, | 313 SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
trix, |
314 const SkIRect& clipBounds, | 314 const SkIRect& clipBounds, |
315 NinePatch* patch) const { | 315 NinePatch* patch) const { |
316 SkASSERT(patch != nullptr); | 316 SkASSERT(patch != nullptr); |
317 switch (rrect.getType()) { | 317 switch (rrect.getType()) { |
318 case SkRRect::kEmpty_Type: | 318 case SkRRect::kEmpty_Type: |
319 // Nothing to draw. | 319 // Nothing to draw. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 | 436 |
437 patch->fMask.fBounds.offsetTo(0, 0); | 437 patch->fMask.fBounds.offsetTo(0, 0); |
438 patch->fOuterRect = dstM.fBounds; | 438 patch->fOuterRect = dstM.fBounds; |
439 patch->fCenter.fX = SkScalarCeilToInt(leftUnstretched) + 1; | 439 patch->fCenter.fX = SkScalarCeilToInt(leftUnstretched) + 1; |
440 patch->fCenter.fY = SkScalarCeilToInt(topUnstretched) + 1; | 440 patch->fCenter.fY = SkScalarCeilToInt(topUnstretched) + 1; |
441 SkASSERT(nullptr == patch->fCache); | 441 SkASSERT(nullptr == patch->fCache); |
442 patch->fCache = cache; // transfer ownership to patch | 442 patch->fCache = cache; // transfer ownership to patch |
443 return kTrue_FilterReturn; | 443 return kTrue_FilterReturn; |
444 } | 444 } |
445 | 445 |
446 // Use the faster analytic blur approach for ninepatch rects | 446 SK_CONF_DECLARE(bool, c_analyticBlurNinepatch, "mask.filter.analyticNinePatch",
true, "Use the faster analytic blur approach for ninepatch rects"); |
447 static const bool c_analyticBlurNinepatch{true}; | |
448 | 447 |
449 SkMaskFilter::FilterReturn | 448 SkMaskFilter::FilterReturn |
450 SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count, | 449 SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count, |
451 const SkMatrix& matrix, | 450 const SkMatrix& matrix, |
452 const SkIRect& clipBounds, | 451 const SkIRect& clipBounds, |
453 NinePatch* patch) const { | 452 NinePatch* patch) const { |
454 if (count < 1 || count > 2) { | 453 if (count < 1 || count > 2) { |
455 return kUnimplemented_FilterReturn; | 454 return kUnimplemented_FilterReturn; |
456 } | 455 } |
457 | 456 |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 } else { | 1309 } else { |
1311 str->append("None"); | 1310 str->append("None"); |
1312 } | 1311 } |
1313 str->append("))"); | 1312 str->append("))"); |
1314 } | 1313 } |
1315 #endif | 1314 #endif |
1316 | 1315 |
1317 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1316 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1318 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1317 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1319 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1318 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |