Chromium Code Reviews| Index: src/gpu/GrProcessor.cpp |
| diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp |
| index b990f9b2859b8806b2370dc79acda30840c0340e..5f7f18f2ec80c6cdafde908d83abc708cc5ed7d9 100644 |
| --- a/src/gpu/GrProcessor.cpp |
| +++ b/src/gpu/GrProcessor.cpp |
| @@ -135,17 +135,38 @@ void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { |
| SkDEBUGCODE(transform->setInProcessor();) |
| } |
| -void GrFragmentProcessor::registerChildProcessor(GrFragmentProcessor* child) { |
| - fChildProcessors.push_back(child); |
| +int GrFragmentProcessor::registerChildProcessor(GrFragmentProcessor* child) { |
| + // Append the child's transforms to our transforms array and the child's textures array to our |
| + // textures array, and empty the child's arrays. |
| + if (!child->fCoordTransforms.empty()) { |
| + fCoordTransforms.push_back_n(child->fCoordTransforms.count(), |
| + child->fCoordTransforms.begin()); |
| + child->fCoordTransforms.reset(); |
|
joshualitt
2015/08/12 14:49:52
I think we don't want to reset the child's data be
wangyix
2015/08/12 15:09:24
Done.
bsalomon
2015/08/12 15:14:22
sgtm
|
| + } |
| + if (!child->fTextureAccesses.empty()) { |
| + fTextureAccesses.push_back_n(child->fTextureAccesses.count(), |
| + child->fTextureAccesses.begin()); |
| + child->fTextureAccesses.reset(); |
| + } |
| + |
| + int index = fChildProcessors.count(); |
| + fChildProcessors.push_back(GrFragmentStage(child)); |
| + |
| + SkDEBUGCODE(child->fIsChild = true); |
| + |
| + if (child->willReadFragmentPosition()) |
| + this->setWillReadFragmentPosition(); |
| + |
| + return index; |
| } |
| bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) const { |
| - if (fCoordTransforms.count() != that.fCoordTransforms.count()) { |
| + if (this->numTransforms() != that.numTransforms()) { |
| return false; |
| } |
| - int count = fCoordTransforms.count(); |
| + int count = this->numTransforms(); |
| for (int i = 0; i < count; ++i) { |
| - if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { |
| + if (this->coordTransform(i) != that.coordTransform(i)) { |
| return false; |
| } |
| } |