@@ -97,6 +97,9 @@ void GrOpList::addDependency(GrOpList* dependedOn) {
97
97
}
98
98
99
99
fDependencies .push_back (dependedOn);
100
+ dependedOn->addDependent (this );
101
+
102
+ SkDEBUGCODE (this ->validate ());
100
103
}
101
104
102
105
// Convert from a GrSurface-based dependency to a GrOpList one
@@ -135,6 +138,31 @@ bool GrOpList::dependsOn(const GrOpList* dependedOn) const {
135
138
return false ;
136
139
}
137
140
141
+
142
+ void GrOpList::addDependent (GrOpList* dependent) {
143
+ fDependents .push_back (dependent);
144
+ }
145
+
146
+ #ifdef SK_DEBUG
147
+ bool GrOpList::isDependedent (const GrOpList* dependent) const {
148
+ for (int i = 0 ; i < fDependents .count (); ++i) {
149
+ if (fDependents [i] == dependent) {
150
+ return true ;
151
+ }
152
+ }
153
+
154
+ return false ;
155
+ }
156
+
157
+ void GrOpList::validate () const {
158
+ // TODO: check for loops and duplicates
159
+
160
+ for (int i = 0 ; i < fDependencies .count (); ++i) {
161
+ SkASSERT (fDependencies [i]->isDependedent (this ));
162
+ }
163
+ }
164
+ #endif
165
+
138
166
bool GrOpList::isInstantiated () const { return fTarget .get ()->isInstantiated (); }
139
167
140
168
bool GrOpList::isFullyInstantiated () const {
@@ -181,6 +209,12 @@ void GrOpList::dump(bool printDependencies) const {
181
209
SkDebugf (" %d, " , fDependencies [i]->fUniqueID );
182
210
}
183
211
SkDebugf (" \n " );
212
+
213
+ SkDebugf (" (%d) Rely On Me: " , fDependents .count ());
214
+ for (int i = 0 ; i < fDependents .count (); ++i) {
215
+ SkDebugf (" %d, " , fDependents [i]->fUniqueID );
216
+ }
217
+ SkDebugf (" \n " );
184
218
}
185
219
}
186
220
#endif
0 commit comments