Project

General

Profile

« Previous | Next » 

Revision b0ebdf5e

Added by Leszek Koltunski about 7 years ago

Major:

1) in the Library, fix the fact that some applications (those that were creating their DistortedSurface objects outside of onSurfaceCreated or onSurfaceChanged) would not render after the activity went to background (press POWER to see that).
2) in the Apps, call the new 'Distorted.onPause()' API to fix the above problem

The above fixes the problem, but it still leaks memory if an App creates its Surface in onSurfaceCreated/Changed (precisely: it leaves the old Surface in the DistortedSurface Map). Thus

3) Fix the first 15 Apps to avoid the memory leak. Next Apps coming.

View differences:

src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java
42 42

  
43 43
import android.graphics.Bitmap;
44 44
import android.graphics.BitmapFactory;
45
import android.opengl.GLES30;
46 45
import android.opengl.GLSurfaceView;
47 46

  
48 47
///////////////////////////////////////////////////////////////////////////////////////////////////
......
53 52
   
54 53
   private GLSurfaceView mView;
55 54
   private DistortedEffects[] mEffects;
55
   private DistortedTexture mTexture;
56 56
   private DistortedScreen mScreen;
57 57
   private int bmpHeight, bmpWidth;
58 58
    
......
163 163
     bmpWidth  = bitmap.getWidth();
164 164

  
165 165
     MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
166
     DistortedTexture texture  = new DistortedTexture(bmpWidth,bmpHeight);
167
     texture.setTexture(bitmap);
166
     if( mTexture==null ) mTexture  = new DistortedTexture(bmpWidth,bmpHeight);
167
     mTexture.setTexture(bitmap);
168 168

  
169 169
     mScreen.detachAll();
170
     for(int i=NUM-1; i>=0; i--) mScreen.attach(texture, mEffects[i], mesh);
170
     for(int i=NUM-1; i>=0; i--) mScreen.attach(mTexture, mEffects[i], mesh);
171 171

  
172 172
     DistortedEffects.enableEffect(EffectNames.SINK);
173 173
     DistortedEffects.enableEffect(EffectNames.DISTORT);

Also available in: Unified diff