| 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 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 | 748 |
| 749 bool GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* textureProvid
er, float sigma, | 749 bool GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* textureProvid
er, float sigma, |
| 750 GrTexture **blurProfileTexture)
{ | 750 GrTexture **blurProfileTexture)
{ |
| 751 GrSurfaceDesc texDesc; | 751 GrSurfaceDesc texDesc; |
| 752 | 752 |
| 753 unsigned int profileSize = SkScalarCeilToInt(6*sigma); | 753 unsigned int profileSize = SkScalarCeilToInt(6*sigma); |
| 754 | 754 |
| 755 texDesc.fWidth = profileSize; | 755 texDesc.fWidth = profileSize; |
| 756 texDesc.fHeight = 1; | 756 texDesc.fHeight = 1; |
| 757 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 757 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 758 texDesc.fIsMipMapped = false; |
| 758 | 759 |
| 759 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 760 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
| 760 GrUniqueKey key; | 761 GrUniqueKey key; |
| 761 GrUniqueKey::Builder builder(&key, kDomain, 1); | 762 GrUniqueKey::Builder builder(&key, kDomain, 1); |
| 762 builder[0] = profileSize; | 763 builder[0] = profileSize; |
| 763 builder.finish(); | 764 builder.finish(); |
| 764 | 765 |
| 765 uint8_t *profile = nullptr; | 766 uint8_t *profile = nullptr; |
| 766 SkAutoTDeleteArray<uint8_t> ada(nullptr); | 767 SkAutoTDeleteArray<uint8_t> ada(nullptr); |
| 767 | 768 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 | 957 |
| 957 SkMask blurredMask; | 958 SkMask blurredMask; |
| 958 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, | 959 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, |
| 959 nullptr, true ); | 960 nullptr, true ); |
| 960 | 961 |
| 961 unsigned int texSide = smallRectSide + 2*blurRadius; | 962 unsigned int texSide = smallRectSide + 2*blurRadius; |
| 962 GrSurfaceDesc texDesc; | 963 GrSurfaceDesc texDesc; |
| 963 texDesc.fWidth = texSide; | 964 texDesc.fWidth = texSide; |
| 964 texDesc.fHeight = texSide; | 965 texDesc.fHeight = texSide; |
| 965 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 966 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 967 texDesc.fIsMipMapped = false; |
| 966 | 968 |
| 967 blurNinePatchTexture.reset( | 969 blurNinePatchTexture.reset( |
| 968 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); | 970 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); |
| 969 SkMask::FreeImage(blurredMask.fImage); | 971 SkMask::FreeImage(blurredMask.fImage); |
| 970 if (!blurNinePatchTexture) { | 972 if (!blurNinePatchTexture) { |
| 971 return nullptr; | 973 return nullptr; |
| 972 } | 974 } |
| 973 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); | 975 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
| 974 } | 976 } |
| 975 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); | 977 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 } else { | 1268 } else { |
| 1267 str->append("None"); | 1269 str->append("None"); |
| 1268 } | 1270 } |
| 1269 str->append("))"); | 1271 str->append("))"); |
| 1270 } | 1272 } |
| 1271 #endif | 1273 #endif |
| 1272 | 1274 |
| 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1275 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1276 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1275 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1277 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |