commit aa6e92f2e13b6a50b9cf2e6abfa24d0a1c01b25c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Jul 28 23:46:30 2020 +0100

    Improve debugging in DistortedScreen

diff --git a/src/main/java/org/distorted/library/main/DistortedScreen.java b/src/main/java/org/distorted/library/main/DistortedScreen.java
index 6c4129f..a4cd9f5 100644
--- a/src/main/java/org/distorted/library/main/DistortedScreen.java
+++ b/src/main/java/org/distorted/library/main/DistortedScreen.java
@@ -40,8 +40,8 @@ public class DistortedScreen extends DistortedFramebuffer
   {
   ///// DEBUGGING ONLY /////////////////////////
   private static final int NUM_FRAMES  = 100;
-  private static final int DEBUG_W     = 150;
-  private static final int DEBUG_H     =  70;
+  private static final float DEBUG_SCR_FRAC = 0.15f;
+  private static final float DEBUG_FRAC     = 0.5f;
 
   private static final int DEBUG_MODE_NONE = 0;
   private static final int DEBUG_MODE_FPS  = 1;
@@ -89,31 +89,6 @@ public class DistortedScreen extends DistortedFramebuffer
     mQueueSize = -1;
     }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-   private void allocateDebug()
-     {
-     if( !mDebugAllocated )
-       {
-       mDebugAllocated = true;
-
-       debugString = "";
-       debugBitmap = Bitmap.createBitmap(DEBUG_W, DEBUG_H, Bitmap.Config.ARGB_8888);
-       debugMesh = new MeshQuad();
-       debugTexture = new DistortedTexture();
-       debugTexture.setTexture(debugBitmap);
-       debugCanvas = new Canvas(debugBitmap);
-       debugEffects = new DistortedEffects();
-       debugEffects.apply( new MatrixEffectScale( new Static3D(DEBUG_W,DEBUG_H,1) ) );
-       debugEffects.apply(mMoveEffect);
-
-       mPaint = new Paint();
-       mPaint.setAntiAlias(true);
-       mPaint.setTextAlign(Paint.Align.CENTER);
-       mPaint.setTextSize(0.7f * DEBUG_H);
-       }
-     }
-
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Draws all the attached children to this OutputSurface.
@@ -144,13 +119,36 @@ public class DistortedScreen extends DistortedFramebuffer
         frameNumber++;
         }
 
+      int width = (int)(mWidth*DEBUG_SCR_FRAC);
+      int height= (int)(mWidth*DEBUG_SCR_FRAC*DEBUG_FRAC);
+
+      if( !mDebugAllocated )
+       {
+       mDebugAllocated = true;
+       debugString = "";
+
+       debugBitmap = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888);
+       debugMesh = new MeshQuad();
+       debugTexture = new DistortedTexture();
+       debugTexture.setTexture(debugBitmap);
+       debugCanvas = new Canvas(debugBitmap);
+       debugEffects = new DistortedEffects();
+       debugEffects.apply( new MatrixEffectScale( new Static3D(width,height,1) ) );
+       debugEffects.apply(mMoveEffect);
+
+       mPaint = new Paint();
+       mPaint.setAntiAlias(true);
+       mPaint.setTextAlign(Paint.Align.CENTER);
+       mPaint.setTextSize(0.7f*height);
+       }
+
       mPaint.setColor(0xffffffff);
-      debugCanvas.drawRect(0, 0, DEBUG_W, DEBUG_H, mPaint);
+      debugCanvas.drawRect(0, 0, width, height, mPaint);
       mPaint.setColor(0xff000000);
-      debugCanvas.drawText(debugString, 0.5f*DEBUG_W, 0.75f*DEBUG_H, mPaint);
+      debugCanvas.drawText(debugString, 0.5f*width, 0.75f*height, mPaint);
       debugTexture.setTexture(debugBitmap);
 
-      mMoveVector.set( (-mWidth+DEBUG_W)/2 +5, (mHeight-DEBUG_H)/2 -5, 0);
+      mMoveVector.set( (-mWidth+width)*0.5f +5, (mHeight-height)*0.5f -5, 0);
 
       lastTime = time;
       }
@@ -206,7 +204,6 @@ public class DistortedScreen extends DistortedFramebuffer
     {
     if( mDebugMode!=DEBUG_MODE_FPS )
       {
-      allocateDebug();
       mDebugMode = DEBUG_MODE_FPS;
 
       durations = new long[NUM_FRAMES + 1];
@@ -226,7 +223,6 @@ public class DistortedScreen extends DistortedFramebuffer
     {
     if( mDebugMode!=DEBUG_MODE_FRAME )
       {
-      allocateDebug();
       mDebugMode = DEBUG_MODE_FRAME;
       frameNumber = 0;
       }
