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

Side by Side Diff: src/gpu/effects/GrXfermodeFragmentProcessor.cpp

Issue 1709153002: Add more specialized fragment builders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make MSVC happy Created 4 years, 10 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/gpu/effects/GrTextureDomain.cpp ('k') | src/gpu/effects/GrYUVEffect.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 "effects/GrXfermodeFragmentProcessor.h" 8 #include "effects/GrXfermodeFragmentProcessor.h"
9 9
10 #include "GrFragmentProcessor.h" 10 #include "GrFragmentProcessor.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 GrGLSLFragmentProcessor* ComposeTwoFragmentProcessor::onCreateGLSLInstance() con st{ 82 GrGLSLFragmentProcessor* ComposeTwoFragmentProcessor::onCreateGLSLInstance() con st{
83 return new GLComposeTwoFragmentProcessor; 83 return new GLComposeTwoFragmentProcessor;
84 } 84 }
85 85
86 ///////////////////////////////////////////////////////////////////// 86 /////////////////////////////////////////////////////////////////////
87 87
88 void GLComposeTwoFragmentProcessor::emitCode(EmitArgs& args) { 88 void GLComposeTwoFragmentProcessor::emitCode(EmitArgs& args) {
89 89
90 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 90 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
91 const ComposeTwoFragmentProcessor& cs = args.fFp.cast<ComposeTwoFragmentProc essor>(); 91 const ComposeTwoFragmentProcessor& cs = args.fFp.cast<ComposeTwoFragmentProc essor>();
92 92
93 const char* inputColor = nullptr; 93 const char* inputColor = nullptr;
94 if (args.fInputColor) { 94 if (args.fInputColor) {
95 inputColor = "inputColor"; 95 inputColor = "inputColor";
96 fragBuilder->codeAppendf("vec4 inputColor = vec4(%s.rgb, 1.0);", args.fI nputColor); 96 fragBuilder->codeAppendf("vec4 inputColor = vec4(%s.rgb, 1.0);", args.fI nputColor);
97 } 97 }
98 98
99 // declare outputColor and emit the code for each of the two children 99 // declare outputColor and emit the code for each of the two children
100 SkString srcColor("src"); 100 SkString srcColor("src");
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 221 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
222 222
223 typedef GrFragmentProcessor INHERITED; 223 typedef GrFragmentProcessor INHERITED;
224 }; 224 };
225 225
226 ////////////////////////////////////////////////////////////////////////////// 226 //////////////////////////////////////////////////////////////////////////////
227 227
228 class GLComposeOneFragmentProcessor : public GrGLSLFragmentProcessor { 228 class GLComposeOneFragmentProcessor : public GrGLSLFragmentProcessor {
229 public: 229 public:
230 void emitCode(EmitArgs& args) override { 230 void emitCode(EmitArgs& args) override {
231 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 231 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
232 SkXfermode::Mode mode = args.fFp.cast<ComposeOneFragmentProcessor>().mod e(); 232 SkXfermode::Mode mode = args.fFp.cast<ComposeOneFragmentProcessor>().mod e();
233 ComposeOneFragmentProcessor::Child child = 233 ComposeOneFragmentProcessor::Child child =
234 args.fFp.cast<ComposeOneFragmentProcessor>().child(); 234 args.fFp.cast<ComposeOneFragmentProcessor>().child();
235 SkString childColor("child"); 235 SkString childColor("child");
236 this->emitChild(0, nullptr, &childColor, args); 236 this->emitChild(0, nullptr, &childColor, args);
237 237
238 const char* inputColor = args.fInputColor; 238 const char* inputColor = args.fInputColor;
239 // We don't try to optimize for this case at all 239 // We don't try to optimize for this case at all
240 if (!inputColor) { 240 if (!inputColor) {
241 fragBuilder->codeAppendf("const vec4 ones = vec4(1);"); 241 fragBuilder->codeAppendf("const vec4 ones = vec4(1);");
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 case SkXfermode::kClear_Mode: 299 case SkXfermode::kClear_Mode:
300 return GrConstColorProcessor::Create(GrColor_TRANSPARENT_BLACK, 300 return GrConstColorProcessor::Create(GrColor_TRANSPARENT_BLACK,
301 GrConstColorProcessor::kIgnore_ InputMode); 301 GrConstColorProcessor::kIgnore_ InputMode);
302 case SkXfermode::kDst_Mode: 302 case SkXfermode::kDst_Mode:
303 return nullptr; 303 return nullptr;
304 default: 304 default:
305 return new ComposeOneFragmentProcessor(src, mode, 305 return new ComposeOneFragmentProcessor(src, mode,
306 ComposeOneFragmentProcessor:: kSrc_Child); 306 ComposeOneFragmentProcessor:: kSrc_Child);
307 } 307 }
308 } 308 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.cpp ('k') | src/gpu/effects/GrYUVEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698