Revision 2f1f7570
Added by Leszek Koltunski over 5 years ago
src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
---|---|---|
23 | 23 |
import org.distorted.library.main.DistortedMaster; |
24 | 24 |
import org.distorted.library.program.DistortedProgram; |
25 | 25 |
|
26 |
import java.lang.reflect.Method; |
|
26 | 27 |
import java.nio.ByteBuffer; |
27 | 28 |
import java.nio.ByteOrder; |
28 | 29 |
import java.nio.FloatBuffer; |
... | ... | |
188 | 189 |
} |
189 | 190 |
} |
190 | 191 |
|
192 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
193 |
|
|
194 |
static void destroyStatics() |
|
195 |
{ |
|
196 |
mPrograms.clear(); |
|
197 |
mSources.clear(); |
|
198 |
mNumSources = 0; |
|
199 |
|
|
200 |
Method method=null; |
|
201 |
|
|
202 |
for(EffectName name: EffectName.values()) |
|
203 |
{ |
|
204 |
if( name.getType() == EffectType.POSTPROCESS ) |
|
205 |
{ |
|
206 |
Class<? extends Effect> cls = name.getEffectClass(); |
|
207 |
|
|
208 |
try |
|
209 |
{ |
|
210 |
method = cls.getMethod("destroyStatics"); |
|
211 |
} |
|
212 |
catch(NoSuchMethodException ex) |
|
213 |
{ |
|
214 |
android.util.Log.e("postprocess", "exception getting method: "+ex.getMessage()); |
|
215 |
} |
|
216 |
|
|
217 |
try |
|
218 |
{ |
|
219 |
method.invoke(null); |
|
220 |
} |
|
221 |
catch(Exception ex) |
|
222 |
{ |
|
223 |
android.util.Log.e("postprocess", "exception invoking method: "+ex.getMessage()); |
|
224 |
} |
|
225 |
} |
|
226 |
} |
|
227 |
} |
|
228 |
|
|
191 | 229 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
192 | 230 |
|
193 | 231 |
PostprocessEffect(EffectName name) |
Also available in: Unified diff
Properly clean up static varaibles in the Effect classes!