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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 | 773 |
775 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, | 774 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, |
776 float sigma) { | 775 float sigma) { |
777 GrSurfaceDesc texDesc; | 776 GrSurfaceDesc texDesc; |
778 | 777 |
779 unsigned int profileSize = SkScalarCeilToInt(6*sigma); | 778 unsigned int profileSize = SkScalarCeilToInt(6*sigma); |
780 | 779 |
781 texDesc.fWidth = profileSize; | 780 texDesc.fWidth = profileSize; |
782 texDesc.fHeight = 1; | 781 texDesc.fHeight = 1; |
783 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 782 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 783 texDesc.fIsMipMapped = false; |
784 | 784 |
785 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 785 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
786 GrUniqueKey key; | 786 GrUniqueKey key; |
787 GrUniqueKey::Builder builder(&key, kDomain, 1); | 787 GrUniqueKey::Builder builder(&key, kDomain, 1); |
788 builder[0] = profileSize; | 788 builder[0] = profileSize; |
789 builder.finish(); | 789 builder.finish(); |
790 | 790 |
791 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); | 791 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); |
792 | 792 |
793 if (!blurProfile) { | 793 if (!blurProfile) { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
987 | 987 |
988 SkMask blurredMask; | 988 SkMask blurredMask; |
989 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, | 989 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, |
990 nullptr, true); | 990 nullptr, true); |
991 | 991 |
992 unsigned int texSide = smallRectSide + 2*blurRadius; | 992 unsigned int texSide = smallRectSide + 2*blurRadius; |
993 GrSurfaceDesc texDesc; | 993 GrSurfaceDesc texDesc; |
994 texDesc.fWidth = texSide; | 994 texDesc.fWidth = texSide; |
995 texDesc.fHeight = texSide; | 995 texDesc.fHeight = texSide; |
996 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 996 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 997 texDesc.fIsMipMapped = false; |
997 | 998 |
998 blurNinePatchTexture.reset( | 999 blurNinePatchTexture.reset( |
999 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); | 1000 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); |
1000 SkMask::FreeImage(blurredMask.fImage); | 1001 SkMask::FreeImage(blurredMask.fImage); |
1001 if (!blurNinePatchTexture) { | 1002 if (!blurNinePatchTexture) { |
1002 return nullptr; | 1003 return nullptr; |
1003 } | 1004 } |
1004 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); | 1005 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
1005 } | 1006 } |
1006 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); | 1007 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 } else { | 1299 } else { |
1299 str->append("None"); | 1300 str->append("None"); |
1300 } | 1301 } |
1301 str->append("))"); | 1302 str->append("))"); |
1302 } | 1303 } |
1303 #endif | 1304 #endif |
1304 | 1305 |
1305 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1306 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1306 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1307 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1307 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1308 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |