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/catanddog/CatAndDogRenderer.java
41 41

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

  
47 46
///////////////////////////////////////////////////////////////////////////////////////////////////
......
51 50
    private GLSurfaceView mView;
52 51
    private DistortedEffects mEffects;
53 52
    private MeshFlat mMesh;
53
    private DistortedTexture mTexture;
54 54
    private DistortedScreen mScreen;
55 55
    private int bmpHeight, bmpWidth;
56 56

  
......
111 111
      bmpHeight = bitmap.getHeight();
112 112
      bmpWidth  = bitmap.getWidth();
113 113

  
114
      DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight);
115
      texture.setTexture(bitmap);
114
      if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
115
      mTexture.setTexture(bitmap);
116 116

  
117 117
      mScreen.detachAll();
118
      mScreen.attach(texture,mEffects,mMesh);
118
      mScreen.attach(mTexture,mEffects,mMesh);
119 119

  
120 120
      DistortedEffects.enableEffect(EffectNames.SMOOTH_CHROMA);
121 121
      DistortedEffects.enableEffect(EffectNames.ALPHA);

Also available in: Unified diff