Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Side by Side Diff: src/effects/SkBlurMaskFilter.cpp

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 const char* outputColor, 700 const char* outputColor,
701 const char* inputColor, 701 const char* inputColor,
702 const TransformedCoordsArray& coords, 702 const TransformedCoordsArray& coords,
703 const TextureSamplerArray& samplers) { 703 const TextureSamplerArray& samplers) {
704 704
705 const char *rectName; 705 const char *rectName;
706 const char *profileSizeName; 706 const char *profileSizeName;
707 707
708 fProxyRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi lity, 708 fProxyRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi lity,
709 kVec4f_GrSLType, 709 kVec4f_GrSLType,
710 kDefault_GrSLPrecision,
710 "proxyRect", 711 "proxyRect",
711 &rectName); 712 &rectName);
712 fProfileSizeUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visi bility, 713 fProfileSizeUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visi bility,
713 kFloat_GrSLType, 714 kFloat_GrSLType,
715 kDefault_GrSLPrecision,
714 "profileSize", 716 "profileSize",
715 &profileSizeName); 717 &profileSizeName);
716 718
717 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 719 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
718 const char *fragmentPos = fsBuilder->fragmentPosition(); 720 const char *fragmentPos = fsBuilder->fragmentPosition();
719 721
720 if (inputColor) { 722 if (inputColor) {
721 fsBuilder->codeAppendf("\tvec4 src=%s;\n", inputColor); 723 fsBuilder->codeAppendf("\tvec4 src=%s;\n", inputColor);
722 } else { 724 } else {
723 fsBuilder->codeAppendf("\tvec4 src=vec4(1)\n;"); 725 fsBuilder->codeAppendf("\tvec4 src=vec4(1)\n;");
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 const TextureSamplerArray& samplers) { 1042 const TextureSamplerArray& samplers) {
1041 const char *rectName; 1043 const char *rectName;
1042 const char *cornerRadiusName; 1044 const char *cornerRadiusName;
1043 const char *blurRadiusName; 1045 const char *blurRadiusName;
1044 1046
1045 // The proxy rect has left, top, right, and bottom edges correspond to 1047 // The proxy rect has left, top, right, and bottom edges correspond to
1046 // components x, y, z, and w, respectively. 1048 // components x, y, z, and w, respectively.
1047 1049
1048 fProxyRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi lity, 1050 fProxyRectUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi lity,
1049 kVec4f_GrSLType, 1051 kVec4f_GrSLType,
1052 kDefault_GrSLPrecision,
1050 "proxyRect", 1053 "proxyRect",
1051 &rectName); 1054 &rectName);
1052 fCornerRadiusUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Vis ibility, 1055 fCornerRadiusUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Vis ibility,
1053 kFloat_GrSLType, 1056 kFloat_GrSLType,
1054 "cornerRadius", 1057 kDefault_GrSLPrecision,
1055 &cornerRadiusName); 1058 "cornerRadius",
1059 &cornerRadiusName);
1056 fBlurRadiusUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility, 1060 fBlurRadiusUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility,
1057 kFloat_GrSLType, 1061 kFloat_GrSLType,
1058 "blurRadius", 1062 kDefault_GrSLPrecision,
1059 &blurRadiusName); 1063 "blurRadius",
1064 &blurRadiusName);
1060 1065
1061 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 1066 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
1062 const char* fragmentPos = fsBuilder->fragmentPosition(); 1067 const char* fragmentPos = fsBuilder->fragmentPosition();
1063 1068
1064 // warp the fragment position to the appropriate part of the 9patch blur tex ture 1069 // warp the fragment position to the appropriate part of the 9patch blur tex ture
1065 1070
1066 fsBuilder->codeAppendf("\t\tvec2 rectCenter = (%s.xy + %s.zw)/2.0;\n", rectN ame, rectName); 1071 fsBuilder->codeAppendf("\t\tvec2 rectCenter = (%s.xy + %s.zw)/2.0;\n", rectN ame, rectName);
1067 fsBuilder->codeAppendf("\t\tvec2 translatedFragPos = %s.xy - %s.xy;\n", frag mentPos, rectName); 1072 fsBuilder->codeAppendf("\t\tvec2 translatedFragPos = %s.xy - %s.xy;\n", frag mentPos, rectName);
1068 fsBuilder->codeAppendf("\t\tfloat threshold = %s + 2.0*%s;\n", cornerRadiusN ame, blurRadiusName ); 1073 fsBuilder->codeAppendf("\t\tfloat threshold = %s + 2.0*%s;\n", cornerRadiusN ame, blurRadiusName );
1069 fsBuilder->codeAppendf("\t\tvec2 middle = %s.zw - %s.xy - 2.0*threshold;\n", rectName, rectName ); 1074 fsBuilder->codeAppendf("\t\tvec2 middle = %s.zw - %s.xy - 2.0*threshold;\n", rectName, rectName );
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 } else { 1267 } else {
1263 str->append("None"); 1268 str->append("None");
1264 } 1269 }
1265 str->append("))"); 1270 str->append("))");
1266 } 1271 }
1267 #endif 1272 #endif
1268 1273
1269 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1270 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1275 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1271 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1276 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698