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/check/CheckRenderer.java
58 58

  
59 59
    private GLSurfaceView mView;
60 60
    private DistortedEffects mEffects;
61
    private DistortedTexture mTexture;
61 62
    private DistortedScreen mScreen;
62 63
    private int bmpHeight, bmpWidth;
63 64

  
......
132 133
      bmpHeight = bitmap.getHeight();
133 134
      bmpWidth  = bitmap.getWidth();
134 135

  
135
      DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight);
136
      texture.setTexture(bitmap);
137
      MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
136
      if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
137
      mTexture.setTexture(bitmap);
138 138

  
139 139
      mScreen.detachAll();
140
      mScreen.attach(texture,mEffects,mesh);
140
      mScreen.attach(mTexture,mEffects,new MeshFlat(30,30*bmpHeight/bmpWidth));
141

  
142
      mEffects.abortEffects(EffectTypes.VERTEX);
143
      mEffects.abortEffects(EffectTypes.FRAGMENT);
141 144

  
142 145
      // Try adding 2 Vertex Effects to the Bitmap.
143 146
      // This will fail if we have set maxVertexEffects to something < 2.

Also available in: Unified diff