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

Unified Diff: src/gpu/GrProcessor.cpp

Issue 1275853005: All child GrFragmentProcs' transforms and textures will be stored in the root GrFragmentProc in pre… (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: use GrFragmentStage array for children Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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;
}
}

Powered by Google App Engine
This is Rietveld 408576698