OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkBlurMaskFilter.h" | 9 #include "SkBlurMaskFilter.h" |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 const GrRectBlurEffect& rbe = proc.cast<GrRectBlurEffect>(); | 760 const GrRectBlurEffect& rbe = proc.cast<GrRectBlurEffect>(); |
761 SkRect rect = rbe.getRect(); | 761 SkRect rect = rbe.getRect(); |
762 | 762 |
763 pdman.set4f(fProxyRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBot
tom); | 763 pdman.set4f(fProxyRectUniform, rect.fLeft, rect.fTop, rect.fRight, rect.fBot
tom); |
764 pdman.set1f(fProfileSizeUniform, SkScalarCeilToScalar(6*rbe.getSigma())); | 764 pdman.set1f(fProfileSizeUniform, SkScalarCeilToScalar(6*rbe.getSigma())); |
765 } | 765 } |
766 | 766 |
767 bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, | 767 bool GrRectBlurEffect::CreateBlurProfileTexture(GrContext *context, float sigma, |
768 GrTexture **blurProfileTexture) { | 768 GrTexture **blurProfileTexture) { |
769 GrTextureParams params; | 769 GrTextureParams params; |
770 GrTextureDesc texDesc; | 770 GrSurfaceDesc texDesc; |
771 | 771 |
772 unsigned int profile_size = SkScalarCeilToInt(6*sigma); | 772 unsigned int profile_size = SkScalarCeilToInt(6*sigma); |
773 | 773 |
774 texDesc.fWidth = profile_size; | 774 texDesc.fWidth = profile_size; |
775 texDesc.fHeight = 1; | 775 texDesc.fHeight = 1; |
776 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 776 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
777 | 777 |
778 static const GrCacheID::Domain gBlurProfileDomain = GrCacheID::GenerateDomai
n(); | 778 static const GrCacheID::Domain gBlurProfileDomain = GrCacheID::GenerateDomai
n(); |
779 GrCacheID::Key key; | 779 GrCacheID::Key key; |
780 memset(&key, 0, sizeof(key)); | 780 memset(&key, 0, sizeof(key)); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 memset(&key, 0, sizeof(key)); | 937 memset(&key, 0, sizeof(key)); |
938 key.fData32[0] = blurRadius; | 938 key.fData32[0] = blurRadius; |
939 key.fData32[1] = cornerRadius; | 939 key.fData32[1] = cornerRadius; |
940 GrCacheID blurRRectNinePatchID(gRRectBlurDomain, key); | 940 GrCacheID blurRRectNinePatchID(gRRectBlurDomain, key); |
941 | 941 |
942 GrTextureParams params; | 942 GrTextureParams params; |
943 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); | 943 params.setFilterMode(GrTextureParams::kBilerp_FilterMode); |
944 | 944 |
945 unsigned int smallRectSide = 2*(blurRadius + cornerRadius) + 1; | 945 unsigned int smallRectSide = 2*(blurRadius + cornerRadius) + 1; |
946 unsigned int texSide = smallRectSide + 2*blurRadius; | 946 unsigned int texSide = smallRectSide + 2*blurRadius; |
947 GrTextureDesc texDesc; | 947 GrSurfaceDesc texDesc; |
948 texDesc.fWidth = texSide; | 948 texDesc.fWidth = texSide; |
949 texDesc.fHeight = texSide; | 949 texDesc.fHeight = texSide; |
950 texDesc.fConfig = kAlpha_8_GrPixelConfig; | 950 texDesc.fConfig = kAlpha_8_GrPixelConfig; |
951 | 951 |
952 GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, blurRR
ectNinePatchID, ¶ms); | 952 GrTexture *blurNinePatchTexture = context->findAndRefTexture(texDesc, blurRR
ectNinePatchID, ¶ms); |
953 | 953 |
954 if (NULL == blurNinePatchTexture) { | 954 if (NULL == blurNinePatchTexture) { |
955 SkMask mask; | 955 SkMask mask; |
956 | 956 |
957 mask.fBounds = SkIRect::MakeWH(smallRectSide, smallRectSide); | 957 mask.fBounds = SkIRect::MakeWH(smallRectSide, smallRectSide); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 } else { | 1278 } else { |
1279 str->append("None"); | 1279 str->append("None"); |
1280 } | 1280 } |
1281 str->append("))"); | 1281 str->append("))"); |
1282 } | 1282 } |
1283 #endif | 1283 #endif |
1284 | 1284 |
1285 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1285 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1286 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1286 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1287 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1287 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |