Project

General

Profile

« Previous | Next » 

Revision 59540ba2

Added by Leszek Koltunski about 7 years ago

Convert (almost) all remaining Apps to the new API which avoids memory leaks with Surfaces.

Remaining problematic Apps: 15. FBO 16. Star Wars (both leak Tree FBOs) 22. SurfaceView (does not work at all after going to background)

View differences:

src/main/java/org/distorted/examples/starwars/StarWarsRenderer.java
204 204
    double angleA = (90.0f - FOV_ANGLE/2)*Math.PI/180;
205 205
    double angleB = (90.0f - FOV_ANGLE/2 +CRAWL_ANGLE)*Math.PI/180;
206 206

  
207
    if( mCrawlBackgroundTexture!=null ) mCrawlBackgroundTexture.markForDeletion();
207 208
    mCrawlBackgroundTexture = new DistortedTexture(w,(int)(h*Math.sin(angleA)/Math.sin(angleB)));
208 209
       
209 210
    int randomA, randomX, randomY, randomTime;
......
286 287
    paint.setTypeface(tf);     
287 288
 
288 289
    ///// create GFFA ///////////////////
289
    mGFFATexture  = new DistortedTexture(GFFA_WIDTH,GFFA_HEIGHT);
290
    if( mGFFATexture==null ) mGFFATexture  = new DistortedTexture(GFFA_WIDTH,GFFA_HEIGHT);
290 291
    bitmapGFFA = Bitmap.createBitmap(GFFA_WIDTH,GFFA_HEIGHT,Bitmap.Config.ARGB_8888);
291 292
    bitmapGFFA.eraseColor(0x00000000);
292 293
    Canvas gffaCanvas = new Canvas(bitmapGFFA);
......
299 300
    mGFFATexture.setTexture(bitmapGFFA);
300 301
      
301 302
    ///// create Logo ///////////////////
302
    mLogoTexture  = new DistortedTexture(bitmapLogo.getWidth(),bitmapLogo.getHeight());
303
    if( mLogoTexture==null ) mLogoTexture  = new DistortedTexture(bitmapLogo.getWidth(),bitmapLogo.getHeight());
303 304
    mLogoTexture.setTexture(bitmapLogo);
304 305

  
305 306
    ///// create CRAWL //////////////////
306
    mCrawlTexture = new DistortedTexture(CRAWL_WIDTH,CRAWL_HEIGHT);
307
    if( mCrawlTexture==null ) mCrawlTexture = new DistortedTexture(CRAWL_WIDTH,CRAWL_HEIGHT);
307 308
    bitmapText = Bitmap.createBitmap(CRAWL_WIDTH,CRAWL_HEIGHT,Bitmap.Config.ARGB_8888);
308 309
    bitmapText.eraseColor(0x00000000);
309 310
    Canvas textCanvas = new Canvas(bitmapText);
......
317 318
    mCrawlTexture.setTexture(bitmapText);
318 319
      
319 320
    ///// create Stars ///////////////////
320
    mStarTexture = new DistortedTexture(bitmapStar.getWidth(),bitmapStar.getHeight());
321
    if( mStarTexture==null ) mStarTexture = new DistortedTexture(bitmapStar.getWidth(),bitmapStar.getHeight());
321 322
    mStarTexture.setTexture(bitmapStar);
322 323

  
323 324
    gffaID = mGFFAEffects.getID();

Also available in: Unified diff