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/sink/SinkRenderer.java
40 40

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

  
46 45
///////////////////////////////////////////////////////////////////////////////////////////////////
......
50 49
  private GLSurfaceView mView;
51 50
  private DistortedEffects mEffects;
52 51
  private DistortedScreen mScreen;
52
  private DistortedTexture mTexture;
53 53
  private int bmpHeight, bmpWidth;
54 54
    
55 55
///////////////////////////////////////////////////////////////////////////////////////////////////
......
124 124
    bmpHeight = bitmap.getHeight();
125 125
    bmpWidth  = bitmap.getWidth();
126 126

  
127
    MeshFlat mesh = new MeshFlat(30,30*bmpHeight/bmpWidth);
128
    DistortedTexture texture = new DistortedTexture(bmpWidth,bmpHeight);
129
    texture.setTexture(bitmap);
127
    if( mTexture==null ) mTexture = new DistortedTexture(bmpWidth,bmpHeight);
128
    mTexture.setTexture(bitmap);
130 129

  
131 130
    mScreen.detachAll();
132
    mScreen.attach(texture,mEffects,mesh);
131
    mScreen.attach(mTexture,mEffects,new MeshFlat(30,30*bmpHeight/bmpWidth));
133 132

  
134 133
    DistortedEffects.enableEffect(EffectNames.SINK);
135 134

  

Also available in: Unified diff