| 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 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 775 |
| 777 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, | 776 GrTexture* GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* texture
Provider, |
| 778 float sigma) { | 777 float sigma) { |
| 779 GrSurfaceDesc texDesc; | 778 GrSurfaceDesc texDesc; |
| 780 | 779 |
| 781 unsigned int profileSize = SkScalarCeilToInt(6*sigma); | 780 unsigned int profileSize = SkScalarCeilToInt(6*sigma); |
| 782 | 781 |
| 783 texDesc.fWidth = profileSize; | 782 texDesc.fWidth = profileSize; |
| 784 texDesc.fHeight = 1; | 783 texDesc.fHeight = 1; |
| 785 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 784 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
| 785 texDesc.fIsMipMapped = false; |
| 786 | 786 |
| 787 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); | 787 static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
| 788 GrUniqueKey key; | 788 GrUniqueKey key; |
| 789 GrUniqueKey::Builder builder(&key, kDomain, 1); | 789 GrUniqueKey::Builder builder(&key, kDomain, 1); |
| 790 builder[0] = profileSize; | 790 builder[0] = profileSize; |
| 791 builder.finish(); | 791 builder.finish(); |
| 792 | 792 |
| 793 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); | 793 GrTexture *blurProfile = textureProvider->findAndRefTextureByUniqueKey(key); |
| 794 | 794 |
| 795 if (!blurProfile) { | 795 if (!blurProfile) { |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 | 989 |
| 990 SkMask blurredMask; | 990 SkMask blurredMask; |
| 991 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, | 991 SkBlurMask::BoxBlur(&blurredMask, mask, sigma, kNormal_SkBlurStyle, kHig
h_SkBlurQuality, |
| 992 nullptr, true); | 992 nullptr, true); |
| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 } else { | 1301 } else { |
| 1301 str->append("None"); | 1302 str->append("None"); |
| 1302 } | 1303 } |
| 1303 str->append("))"); | 1304 str->append("))"); |
| 1304 } | 1305 } |
| 1305 #endif | 1306 #endif |
| 1306 | 1307 |
| 1307 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1308 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
| 1308 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1309 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
| 1309 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1310 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |