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

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

Issue 1110033004: Make XPFragmentBuilder only Builder with access to DstCopy. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months 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_gpu.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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 671
672 private: 672 private:
673 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 673 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
674 674
675 UniformHandle fProxyRectUniform; 675 UniformHandle fProxyRectUniform;
676 UniformHandle fProfileSizeUniform; 676 UniformHandle fProfileSizeUniform;
677 677
678 typedef GrGLFragmentProcessor INHERITED; 678 typedef GrGLFragmentProcessor INHERITED;
679 }; 679 };
680 680
681 void OutputRectBlurProfileLookup(GrGLFPFragmentBuilder* fsBuilder, 681 void OutputRectBlurProfileLookup(GrGLFragmentBuilder* fsBuilder,
682 const GrGLShaderBuilder::TextureSampler& sample r, 682 const GrGLShaderBuilder::TextureSampler& sample r,
683 const char *output, 683 const char *output,
684 const char *profileSize, const char *loc, 684 const char *profileSize, const char *loc,
685 const char *blurred_width, 685 const char *blurred_width,
686 const char *sharp_width) { 686 const char *sharp_width) {
687 fsBuilder->codeAppendf("\tfloat %s;\n", output); 687 fsBuilder->codeAppendf("\tfloat %s;\n", output);
688 fsBuilder->codeAppendf("\t\t{\n"); 688 fsBuilder->codeAppendf("\t\t{\n");
689 fsBuilder->codeAppendf("\t\t\tfloat coord = (0.5 * (abs(2.0*%s - %s) - %s))/ %s;\n", 689 fsBuilder->codeAppendf("\t\t\tfloat coord = (0.5 * (abs(2.0*%s - %s) - %s))/ %s;\n",
690 loc, blurred_width, sharp_width, profileSize); 690 loc, blurred_width, sharp_width, profileSize);
691 fsBuilder->codeAppendf("\t\t\t%s = ", output); 691 fsBuilder->codeAppendf("\t\t\t%s = ", output);
(...skipping 16 matching lines...) Expand all
708 kVec4f_GrSLType, 708 kVec4f_GrSLType,
709 kDefault_GrSLPrecision, 709 kDefault_GrSLPrecision,
710 "proxyRect", 710 "proxyRect",
711 &rectName); 711 &rectName);
712 fProfileSizeUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visi bility, 712 fProfileSizeUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visi bility,
713 kFloat_GrSLType, 713 kFloat_GrSLType,
714 kDefault_GrSLPrecision, 714 kDefault_GrSLPrecision,
715 "profileSize", 715 "profileSize",
716 &profileSizeName); 716 &profileSizeName);
717 717
718 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 718 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
719 const char *fragmentPos = fsBuilder->fragmentPosition(); 719 const char *fragmentPos = fsBuilder->fragmentPosition();
720 720
721 if (inputColor) { 721 if (inputColor) {
722 fsBuilder->codeAppendf("\tvec4 src=%s;\n", inputColor); 722 fsBuilder->codeAppendf("\tvec4 src=%s;\n", inputColor);
723 } else { 723 } else {
724 fsBuilder->codeAppendf("\tvec4 src=vec4(1)\n;"); 724 fsBuilder->codeAppendf("\tvec4 src=vec4(1)\n;");
725 } 725 }
726 726
727 fsBuilder->codeAppendf("\tvec2 translatedPos = %s.xy - %s.xy;\n", fragmentPo s, rectName ); 727 fsBuilder->codeAppendf("\tvec2 translatedPos = %s.xy - %s.xy;\n", fragmentPo s, rectName );
728 fsBuilder->codeAppendf("\tfloat width = %s.z - %s.x;\n", rectName, rectName) ; 728 fsBuilder->codeAppendf("\tfloat width = %s.z - %s.x;\n", rectName, rectName) ;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 kFloat_GrSLType, 1053 kFloat_GrSLType,
1054 kDefault_GrSLPrecision, 1054 kDefault_GrSLPrecision,
1055 "cornerRadius", 1055 "cornerRadius",
1056 &cornerRadiusName); 1056 &cornerRadiusName);
1057 fBlurRadiusUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility, 1057 fBlurRadiusUniform = builder->addUniform(GrGLProgramBuilder::kFragment_Visib ility,
1058 kFloat_GrSLType, 1058 kFloat_GrSLType,
1059 kDefault_GrSLPrecision, 1059 kDefault_GrSLPrecision,
1060 "blurRadius", 1060 "blurRadius",
1061 &blurRadiusName); 1061 &blurRadiusName);
1062 1062
1063 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 1063 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
1064 const char* fragmentPos = fsBuilder->fragmentPosition(); 1064 const char* fragmentPos = fsBuilder->fragmentPosition();
1065 1065
1066 // warp the fragment position to the appropriate part of the 9patch blur tex ture 1066 // warp the fragment position to the appropriate part of the 9patch blur tex ture
1067 1067
1068 fsBuilder->codeAppendf("\t\tvec2 rectCenter = (%s.xy + %s.zw)/2.0;\n", rectN ame, rectName); 1068 fsBuilder->codeAppendf("\t\tvec2 rectCenter = (%s.xy + %s.zw)/2.0;\n", rectN ame, rectName);
1069 fsBuilder->codeAppendf("\t\tvec2 translatedFragPos = %s.xy - %s.xy;\n", frag mentPos, rectName); 1069 fsBuilder->codeAppendf("\t\tvec2 translatedFragPos = %s.xy - %s.xy;\n", frag mentPos, rectName);
1070 fsBuilder->codeAppendf("\t\tfloat threshold = %s + 2.0*%s;\n", cornerRadiusN ame, blurRadiusName ); 1070 fsBuilder->codeAppendf("\t\tfloat threshold = %s + 2.0*%s;\n", cornerRadiusN ame, blurRadiusName );
1071 fsBuilder->codeAppendf("\t\tvec2 middle = %s.zw - %s.xy - 2.0*threshold;\n", rectName, rectName ); 1071 fsBuilder->codeAppendf("\t\tvec2 middle = %s.zw - %s.xy - 2.0*threshold;\n", rectName, rectName );
1072 1072
1073 fsBuilder->codeAppendf("\t\tif (translatedFragPos.x >= threshold && translat edFragPos.x < (middle.x+threshold)) {\n" ); 1073 fsBuilder->codeAppendf("\t\tif (translatedFragPos.x >= threshold && translat edFragPos.x < (middle.x+threshold)) {\n" );
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 } else { 1265 } else {
1266 str->append("None"); 1266 str->append("None");
1267 } 1267 }
1268 str->append("))"); 1268 str->append("))");
1269 } 1269 }
1270 #endif 1270 #endif
1271 1271
1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter) 1272 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkBlurMaskFilter)
1273 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl) 1273 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBlurMaskFilterImpl)
1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1274 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.cpp ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698