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

Side by Side Diff: src/gpu/GrFragmentProcessor.cpp

Issue 2106893003: Fixed crash when RunInSeriesFP's color input is nil (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 5 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 | « no previous file | no next file » | 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 "GrFragmentProcessor.h" 8 #include "GrFragmentProcessor.h"
9 #include "GrCoordTransform.h" 9 #include "GrCoordTransform.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 this->registerChildProcessor(std::move(children[i])); 303 this->registerChildProcessor(std::move(children[i]));
304 } 304 }
305 } 305 }
306 306
307 const char* name() const override { return "Series"; } 307 const char* name() const override { return "Series"; }
308 308
309 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 309 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
310 class GLFP : public GrGLSLFragmentProcessor { 310 class GLFP : public GrGLSLFragmentProcessor {
311 public: 311 public:
312 void emitCode(EmitArgs& args) override { 312 void emitCode(EmitArgs& args) override {
313 SkString input(args.fInputColor); 313 // First guy's input might be nil.
314 for (int i = 0; i < this->numChildProcessors() - 1; ++i) { 314 SkString temp("out0");
315 SkString temp; 315 this->emitChild(0, args.fInputColor, &temp, args);
316 SkString input = temp;
317 for (int i = 1; i < this->numChildProcessors() - 1; ++i) {
316 temp.printf("out%d", i); 318 temp.printf("out%d", i);
317 this->emitChild(i, input.c_str(), &temp, args); 319 this->emitChild(i, input.c_str(), &temp, args);
318 input = temp; 320 input = temp;
319 } 321 }
320 // Last guy writes to our output variable. 322 // Last guy writes to our output variable.
321 this->emitChild(this->numChildProcessors() - 1, input.c_str( ), args); 323 this->emitChild(this->numChildProcessors() - 1, input.c_str( ), args);
322 } 324 }
323 }; 325 };
324 return new GLFP; 326 return new GLFP;
325 } 327 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } else { 370 } else {
369 series += firstIdx; 371 series += firstIdx;
370 cnt -= firstIdx; 372 cnt -= firstIdx;
371 } 373 }
372 374
373 if (1 == cnt) { 375 if (1 == cnt) {
374 return series[0]; 376 return series[0];
375 } 377 }
376 return sk_sp<GrFragmentProcessor>(new SeriesFragmentProcessor(series, cnt)); 378 return sk_sp<GrFragmentProcessor>(new SeriesFragmentProcessor(series, cnt));
377 } 379 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698