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" | |
16 #include "SkStringUtils.h" | 15 #include "SkStringUtils.h" |
17 #include "SkStrokeRec.h" | 16 #include "SkStrokeRec.h" |
18 | 17 |
19 #if SK_SUPPORT_GPU | 18 #if SK_SUPPORT_GPU |
20 #include "GrCircleBlurFragmentProcessor.h" | 19 #include "GrCircleBlurFragmentProcessor.h" |
21 #include "GrContext.h" | 20 #include "GrContext.h" |
22 #include "GrDrawContext.h" | 21 #include "GrDrawContext.h" |
23 #include "GrTexture.h" | 22 #include "GrTexture.h" |
24 #include "GrFragmentProcessor.h" | 23 #include "GrFragmentProcessor.h" |
25 #include "GrInvariantOutput.h" | 24 #include "GrInvariantOutput.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 static SkCachedData* add_cached_rects(SkMask* mask, SkScalar sigma, SkBlurStyle
style, | 296 static SkCachedData* add_cached_rects(SkMask* mask, SkScalar sigma, SkBlurStyle
style, |
298 SkBlurQuality quality, const SkRect rects[
], int count) { | 297 SkBlurQuality quality, const SkRect rects[
], int count) { |
299 SkCachedData* cache = copy_mask_to_cacheddata(mask); | 298 SkCachedData* cache = copy_mask_to_cacheddata(mask); |
300 if (cache) { | 299 if (cache) { |
301 SkMaskCache::Add(sigma, style, quality, rects, count, *mask, cache); | 300 SkMaskCache::Add(sigma, style, quality, rects, count, *mask, cache); |
302 } | 301 } |
303 return cache; | 302 return cache; |
304 } | 303 } |
305 | 304 |
306 #ifdef SK_IGNORE_FAST_RRECT_BLUR | 305 #ifdef SK_IGNORE_FAST_RRECT_BLUR |
307 SK_CONF_DECLARE(bool, c_analyticBlurRRect, "mask.filter.blur.analyticblurrrect",
false, "Use the faster analytic blur approach for ninepatch rects"); | 306 // Use the faster analytic blur approach for ninepatch round rects |
| 307 static const bool c_analyticBlurRRect{false}; |
308 #else | 308 #else |
309 SK_CONF_DECLARE(bool, c_analyticBlurRRect, "mask.filter.blur.analyticblurrrect",
true, "Use the faster analytic blur approach for ninepatch round rects"); | 309 static const bool c_analyticBlurRRect{true}; |
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 SK_CONF_DECLARE(bool, c_analyticBlurNinepatch, "mask.filter.analyticNinePatch",
true, "Use the faster analytic blur approach for ninepatch rects"); | 446 // Use the faster analytic blur approach for ninepatch rects |
| 447 static const bool c_analyticBlurNinepatch{true}; |
447 | 448 |
448 SkMaskFilter::FilterReturn | 449 SkMaskFilter::FilterReturn |
449 SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count, | 450 SkBlurMaskFilterImpl::filterRectsToNine(const SkRect rects[], int count, |
450 const SkMatrix& matrix, | 451 const SkMatrix& matrix, |
451 const SkIRect& clipBounds, | 452 const SkIRect& clipBounds, |
452 NinePatch* patch) const { | 453 NinePatch* patch) const { |
453 if (count < 1 || count > 2) { | 454 if (count < 1 || count > 2) { |
454 return kUnimplemented_FilterReturn; | 455 return kUnimplemented_FilterReturn; |
455 } | 456 } |
456 | 457 |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 } else { | 1310 } else { |
1310 str->append("None"); | 1311 str->append("None"); |
1311 } | 1312 } |
1312 str->append("))"); | 1313 str->append("))"); |
1313 } | 1314 } |
1314 #endif | 1315 #endif |
1315 | 1316 |
1316 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1317 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1317 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1318 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1318 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1319 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |