commit e8bf2663ba144b1f4c31685e03211f06be27f559
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Fri May 8 00:53:42 2020 +0100

    Convert Save to stretchless API.

diff --git a/src/main/java/org/distorted/examples/save/SaveRenderer.java b/src/main/java/org/distorted/examples/save/SaveRenderer.java
index ae7c8bb..ab210bc 100644
--- a/src/main/java/org/distorted/examples/save/SaveRenderer.java
+++ b/src/main/java/org/distorted/examples/save/SaveRenderer.java
@@ -31,6 +31,7 @@ import javax.microedition.khronos.opengles.GL10;
 import org.distorted.examples.R;
 
 import org.distorted.library.effect.MatrixEffectScale;
+import org.distorted.library.effect.VertexEffectScale;
 import org.distorted.library.effect.VertexEffectSink;
 import org.distorted.library.main.DistortedLibrary;
 import org.distorted.library.main.DistortedEffects;
@@ -60,7 +61,7 @@ class SaveRenderer implements GLSurfaceView.Renderer
   private MeshRectangles mMesh;
   private DistortedScreen mScreen;
   private Static1D s0;
-  private Static3D mScaleFactor, mScaleMain;
+  private Static3D mScaleFactor, mScaleMain, mScaleVertex;
 
   private float mScale;
   private int bmpHeight, bmpWidth;
@@ -89,9 +90,11 @@ class SaveRenderer implements GLSurfaceView.Renderer
 
     mScale = 1.0f;
     mScaleFactor = new Static3D(mScale,mScale,1.0f);
-    mScaleMain = new Static3D(1,1,1);
+    mScaleMain   = new Static3D(1,1,1);
+    mScaleVertex = new Static3D(1,1,1);
 
     mEffects = new DistortedEffects();
+    mEffects.apply( new VertexEffectScale(mScaleVertex));
     mEffects.apply( new VertexEffectSink(diSink, pLeft , sinkRegion) );
     mEffects.apply( new VertexEffectSink(diSink, pRight, sinkRegion) );
     mEffects.apply( new MatrixEffectScale(mScaleMain));
@@ -190,9 +193,9 @@ class SaveRenderer implements GLSurfaceView.Renderer
 
   private void applyMatrixEffects(int width, int height)
     {
-    float horiRatio = (float)width / mMesh.getStretchX();
-    float vertRatio = (float)height/ mMesh.getStretchY();
-    float factor    = horiRatio > vertRatio ? vertRatio : horiRatio;
+    float horiRatio = (float)width / mScaleVertex.get0();
+    float vertRatio = (float)height/ mScaleVertex.get1();
+    float factor    = Math.min(horiRatio, vertRatio);
     mScaleMain.set(factor,factor,factor);
     }
 
@@ -223,17 +226,15 @@ class SaveRenderer implements GLSurfaceView.Renderer
         {
         is.close();
         }
-      catch(IOException e) { }
+      catch(IOException ignored) { }
       }
       
     bmpHeight = bitmap.getHeight();
     bmpWidth  = bitmap.getWidth();
 
-    if( mMesh==null )
-      {
-      mMesh = new MeshRectangles(30,30*bmpHeight/bmpWidth);
-      mMesh.setStretch(bmpWidth,bmpHeight,0);
-      }
+    mScaleVertex.set(bmpWidth,bmpHeight,0);
+
+    if( mMesh   ==null ) mMesh = new MeshRectangles(30,30*bmpHeight/bmpWidth);
     if( mTexture==null ) mTexture = new DistortedTexture();
     mTexture.setTexture(bitmap);
 
@@ -245,6 +246,7 @@ class SaveRenderer implements GLSurfaceView.Renderer
     mScreen.detachAll();
     mScreen.attach(mTexture,mEffects,mMesh);
 
+    VertexEffectScale.enable();
     VertexEffectSink.enable();
 
     try
