@@ -116,6 +116,8 @@ - (CCEffectPrepareStatus)prepareForRendering
116
116
CCEffectPrepareStatus result = CCEffectPrepareNothingToDo;
117
117
if (_passesDirty)
118
118
{
119
+ CGSize maxPadding = self.padding ;
120
+
119
121
// Start by populating the flattened list with this stack's effects.
120
122
NSMutableArray *flattenedEffects = [[NSMutableArray alloc ] initWithArray: _effects];
121
123
NSUInteger index = 0 ;
@@ -141,11 +143,22 @@ - (CCEffectPrepareStatus)prepareForRendering
141
143
}
142
144
}
143
145
144
- // Make sure all the contained effects are ready for rendering
145
- // before we do anything else.
146
146
for (CCEffect *effect in flattenedEffects)
147
147
{
148
+ // Make sure all the contained effects are ready for rendering
149
+ // before we do anything else.
148
150
[effect prepareForRendering ];
151
+
152
+ // And find the max padding values of all contained effects.
153
+ if (effect.padding .width > maxPadding.width )
154
+ {
155
+ maxPadding.width = effect.padding .width ;
156
+ }
157
+
158
+ if (effect.padding .height > maxPadding.height )
159
+ {
160
+ maxPadding.height = effect.padding .height ;
161
+ }
149
162
}
150
163
151
164
NSMutableArray *stitchedEffects = [[NSMutableArray alloc ] init ];
@@ -194,8 +207,9 @@ - (CCEffectPrepareStatus)prepareForRendering
194
207
}
195
208
self.renderPasses = [passes copy ];
196
209
self.shaderUniforms = uniforms;
197
- _passesDirty = NO ;
210
+ self. padding = maxPadding ;
198
211
212
+ _passesDirty = NO ;
199
213
result = CCEffectPrepareSuccess;
200
214
}
201
215
return result;
0 commit comments