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