| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 if (!SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, | 989 if (!SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, |
| 990 kHigh_SkBlurQuality, nullptr, true)) { | 990 kHigh_SkBlurQuality, nullptr, true)) { |
| 991 return nullptr; | 991 return nullptr; |
| 992 } | 992 } |
| 993 | 993 |
| 994 unsigned int texSide = smallRectSide + 2*blurRadius; | 994 unsigned int texSide = smallRectSide + 2*blurRadius; |
| 995 GrSurfaceDesc texDesc; | 995 GrSurfaceDesc texDesc; |
| 996 texDesc.fWidth = texSide; | 996 texDesc.fWidth = texSide; |
| 997 texDesc.fHeight = texSide; | 997 texDesc.fHeight = texSide; |
| 998 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 998 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 999 texDesc.fIsMipMapped = false; |
| 999 | 1000 |
| 1000 blurNinePatchTexture.reset( | 1001 blurNinePatchTexture.reset( |
| 1001 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); | 1002 texProvider->createTexture(texDesc, true, blurredMask.fImage, 0)); |
| 1002 SkMask::FreeImage(blurredMask.fImage); | 1003 SkMask::FreeImage(blurredMask.fImage); |
| 1003 if (!blurNinePatchTexture) { | 1004 if (!blurNinePatchTexture) { |
| 1004 return nullptr; | 1005 return nullptr; |
| 1005 } | 1006 } |
| 1006 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); | 1007 texProvider->assignUniqueKeyToTexture(key, blurNinePatchTexture); |
| 1007 } | 1008 } |
| 1008 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); | 1009 return new GrRRectBlurEffect(sigma, rrect, blurNinePatchTexture); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 } else { | 1306 } else { |
| 1306 str->append("None"); | 1307 str->append("None"); |
| 1307 } | 1308 } |
| 1308 str->append("))"); | 1309 str->append("))"); |
| 1309 } | 1310 } |
| 1310 #endif | 1311 #endif |
| 1311 | 1312 |
| 1312 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1313 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1313 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1314 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1314 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1315 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |