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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 | 738 |
739 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, | 739 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, |
740 float sigma) { | 740 float sigma) { |
741 GrSurfaceDesc texDesc; | 741 GrSurfaceDesc texDesc; |
742 | 742 |
743 unsigned int profileSize = SkScalarCeilToInt(6*sigma); | 743 unsigned int profileSize = SkScalarCeilToInt(6*sigma); |
744 | 744 |
745 texDesc.fWidth = profileSize; | 745 texDesc.fWidth = profileSize; |
746 texDesc.fHeight = 1; | 746 texDesc.fHeight = 1; |
747 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 747 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 748 texDesc.fIsMipMapped = false; |
748 | 749 |
749 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 750 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
750 GrUniqueKey key; | 751 GrUniqueKey key; |
751 GrUniqueKey::Builder builder(&key, kDomain, 1); | 752 GrUniqueKey::Builder builder(&key, kDomain, 1); |
752 builder[0] = profileSize; | 753 builder[0] = profileSize; |
753 builder.finish(); | 754 builder.finish(); |
754 | 755 |
755 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); | 756 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); |
756 | 757 |
757 if (!blurProfile) { | 758 if (!blurProfile) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 951 |
951 SkMask blurredMask; | 952 SkMask blurredMask; |
952 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, | 953 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, |
953 nullptr, true ); | 954 nullptr, true ); |
954 | 955 |
955 unsigned int texSide = smallRectSide + 2*blurRadius; | 956 unsigned int texSide = smallRectSide + 2*blurRadius; |
956 GrSurfaceDesc texDesc; | 957 GrSurfaceDesc texDesc; |
957 texDesc.fWidth = texSide; | 958 texDesc.fWidth = texSide; |
958 texDesc.fHeight = texSide; | 959 texDesc.fHeight = texSide; |
959 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 960 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 961 texDesc.fIsMipMapped = false; |
960 | 962 |
961 blurNinePatchTexture.reset( | 963 blurNinePatchTexture.reset( |
962 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); | 964 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); |
963 SkMask::FreeImage(blurredMask.fImage); | 965 SkMask::FreeImage(blurredMask.fImage); |
964 if (!blurNinePatchTexture) { | 966 if (!blurNinePatchTexture) { |
965 return nullptr; | 967 return nullptr; |
966 } | 968 } |
967 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); | 969 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
968 } | 970 } |
969 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); | 971 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 } else { | 1265 } else { |
1264 str->append("None"); | 1266 str->append("None"); |
1265 } | 1267 } |
1266 str->append("))"); | 1268 str->append("))"); |
1267 } | 1269 } |
1268 #endif | 1270 #endif |
1269 | 1271 |
1270 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1271 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |