OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 #include "SkBlurMaskFilter.h" | 8 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
11 #include "SkGpuBlurUtils.h" | 10 #include "SkGpuBlurUtils.h" |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 774 |
776 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, | 775 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, |
777 float sigma) { | 776 float sigma) { |
778 GrSurfaceDesc texDesc; | 777 GrSurfaceDesc texDesc; |
779 | 778 |
780 unsigned int profileSize = SkScalarCeilToInt(6*sigma); | 779 unsigned int profileSize = SkScalarCeilToInt(6*sigma); |
781 | 780 |
782 texDesc.fWidth = profileSize; | 781 texDesc.fWidth = profileSize; |
783 texDesc.fHeight = 1; | 782 texDesc.fHeight = 1; |
784 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 783 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 784 texDesc.fIsMipMapped = false; |
785 | 785 |
786 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 786 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
787 GrUniqueKey key; | 787 GrUniqueKey key; |
788 GrUniqueKey::Builder builder(&key, kDomain, 1); | 788 GrUniqueKey::Builder builder(&key, kDomain, 1); |
789 builder[0] = profileSize; | 789 builder[0] = profileSize; |
790 builder.finish(); | 790 builder.finish(); |
791 | 791 |
792 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); | 792 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); |
793 | 793 |
794 if (!blurProfile) { | 794 if (!blurProfile) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 if (!SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, | 990 if (!SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, |
991 kHigh_SkBlurQuality, nullptr, true)) { | 991 kHigh_SkBlurQuality, nullptr, true)) { |
992 return nullptr; | 992 return nullptr; |
993 } | 993 } |
994 | 994 |
995 unsigned int texSide = smallRectSide + 2*blurRadius; | 995 unsigned int texSide = smallRectSide + 2*blurRadius; |
996 GrSurfaceDesc texDesc; | 996 GrSurfaceDesc texDesc; |
997 texDesc.fWidth = texSide; | 997 texDesc.fWidth = texSide; |
998 texDesc.fHeight = texSide; | 998 texDesc.fHeight = texSide; |
999 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 999 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 1000 texDesc.fIsMipMapped = false; |
1000 | 1001 |
1001 blurNinePatchTexture.reset( | 1002 blurNinePatchTexture.reset( |
1002 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); | 1003 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); |
1003 SkMask::FreeImage(blurredMask.fImage); | 1004 SkMask::FreeImage(blurredMask.fImage); |
1004 if (!blurNinePatchTexture) { | 1005 if (!blurNinePatchTexture) { |
1005 return nullptr; | 1006 return nullptr; |
1006 } | 1007 } |
1007 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); | 1008 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
1008 } | 1009 } |
1009 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); | 1010 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 } else { | 1308 } else { |
1308 str->append("None"); | 1309 str->append("None"); |
1309 } | 1310 } |
1310 str->append("))"); | 1311 str->append("))"); |
1311 } | 1312 } |
1312 #endif | 1313 #endif |
1313 | 1314 |
1314 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1315 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1315 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1316 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1316 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1317 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |