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" |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
795 SkAutoTDeleteArray<uint8_t> profile(SkBlurMask::ComputeBlurProfile(sigma
)); | 795 SkAutoTDeleteArray<uint8_t> profile(SkBlurMask::ComputeBlurProfile(sigma
)); |
796 | 796 |
797 blurProfile = textureProvider->createTexture(texDesc, true, profile.get(
), 0); | 797 blurProfile = textureProvider->createTexture(texDesc, SkBudgeted::kYes,
profile.get(), 0); |
798 if (blurProfile) { | 798 if (blurProfile) { |
799 textureProvider->assignUniqueKeyToTexture(key, blurProfile); | 799 textureProvider->assignUniqueKeyToTexture(key, blurProfile); |
800 } | 800 } |
801 } | 801 } |
802 | 802 |
803 return blurProfile; | 803 return blurProfile; |
804 } | 804 } |
805 | 805 |
806 GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b
lurProfile, | 806 GrRectBlurEffect::GrRectBlurEffect(const SkRect& rect, float sigma, GrTexture *b
lurProfile, |
807 GrSLPrecision precision) | 807 GrSLPrecision precision) |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 1000 |
1001 blurNinePatchTexture.reset( | 1001 blurNinePatchTexture.reset( |
1002 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); | 1002 texProvider->createTexture(texDesc, SkBudgeted::kYes , blurredMask.f
Image, 0)); |
1003 SkMask::FreeImage(blurredMask.fImage); | 1003 SkMask::FreeImage(blurredMask.fImage); |
1004 if (!blurNinePatchTexture) { | 1004 if (!blurNinePatchTexture) { |
1005 return nullptr; | 1005 return nullptr; |
1006 } | 1006 } |
1007 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); | 1007 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
1008 } | 1008 } |
1009 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); | 1009 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); |
1010 } | 1010 } |
1011 | 1011 |
1012 void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
{ | 1012 void GrRRectBlurEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const
{ |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 } else { | 1304 } else { |
1305 str->append("None"); | 1305 str->append("None"); |
1306 } | 1306 } |
1307 str->append("))"); | 1307 str->append("))"); |
1308 } | 1308 } |
1309 #endif | 1309 #endif |
1310 | 1310 |
1311 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1311 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1312 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1312 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1313 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1313 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |