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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 &cornerRadiusName); | 1008 &cornerRadiusName); |
1009 fBlurRadiusUniform = builder->addUniform(GrGLShaderBuilder::kFragment_Visibi
lity, | 1009 fBlurRadiusUniform = builder->addUniform(GrGLShaderBuilder::kFragment_Visibi
lity, |
1010 kFloat_GrSLType, | 1010 kFloat_GrSLType, |
1011 "blurRadius", | 1011 "blurRadius", |
1012 &blurRadiusName); | 1012 &blurRadiusName); |
1013 const char* fragmentPos = builder->fragmentPosition(); | 1013 const char* fragmentPos = builder->fragmentPosition(); |
1014 | 1014 |
1015 // warp the fragment position to the appropriate part of the 9patch blur tex
ture | 1015 // warp the fragment position to the appropriate part of the 9patch blur tex
ture |
1016 | 1016 |
1017 builder->fsCodeAppendf("\t\tvec2 rectCenter = (%s.xy + %s.zw)/2.0;\n", rectN
ame, rectName); | 1017 builder->fsCodeAppendf("\t\tvec2 rectCenter = (%s.xy + %s.zw)/2.0;\n", rectN
ame, rectName); |
1018 builder->fsCodeAppendf("\t\tvec2 translatedFragPos = %s - %s.xy;\n", fragmen
tPos, rectName); | 1018 builder->fsCodeAppendf("\t\tvec2 translatedFragPos = %s.xy - %s.xy;\n", frag
mentPos, rectName); |
1019 builder->fsCodeAppendf("\t\tfloat threshold = %s + 2.0*%s;\n", cornerRadiusN
ame, blurRadiusName ); | 1019 builder->fsCodeAppendf("\t\tfloat threshold = %s + 2.0*%s;\n", cornerRadiusN
ame, blurRadiusName ); |
1020 builder->fsCodeAppendf("\t\tvec2 middle = %s.zw - %s.xy - 2.0*threshold;\n",
rectName, rectName ); | 1020 builder->fsCodeAppendf("\t\tvec2 middle = %s.zw - %s.xy - 2.0*threshold;\n",
rectName, rectName ); |
1021 | 1021 |
1022 builder->fsCodeAppendf("\t\tif (translatedFragPos.x >= threshold && translat
edFragPos.x < (middle.x+threshold)) {\n" ); | 1022 builder->fsCodeAppendf("\t\tif (translatedFragPos.x >= threshold && translat
edFragPos.x < (middle.x+threshold)) {\n" ); |
1023 builder->fsCodeAppendf("\t\t\ttranslatedFragPos.x = threshold;\n"); | 1023 builder->fsCodeAppendf("\t\t\ttranslatedFragPos.x = threshold;\n"); |
1024 builder->fsCodeAppendf("\t\t} else if (translatedFragPos.x >= (middle.x + th
reshold)) {\n"); | 1024 builder->fsCodeAppendf("\t\t} else if (translatedFragPos.x >= (middle.x + th
reshold)) {\n"); |
1025 builder->fsCodeAppendf("\t\t\ttranslatedFragPos.x -= middle.x - 1.0;\n"); | 1025 builder->fsCodeAppendf("\t\t\ttranslatedFragPos.x -= middle.x - 1.0;\n"); |
1026 builder->fsCodeAppendf("\t\t}\n"); | 1026 builder->fsCodeAppendf("\t\t}\n"); |
1027 | 1027 |
1028 builder->fsCodeAppendf("\t\tif (translatedFragPos.y > threshold && translate
dFragPos.y < (middle.y+threshold)) {\n" ); | 1028 builder->fsCodeAppendf("\t\tif (translatedFragPos.y > threshold && translate
dFragPos.y < (middle.y+threshold)) {\n" ); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 } else { | 1207 } else { |
1208 str->append("None"); | 1208 str->append("None"); |
1209 } | 1209 } |
1210 str->append("))"); | 1210 str->append("))"); |
1211 } | 1211 } |
1212 #endif | 1212 #endif |
1213 | 1213 |
1214 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) | 1214 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) |
1215 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) | 1215 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) |
1216 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1216 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |