Add hook to manipulate SurfaceTexture transform

 Bug: 7302956

Change-Id: I32bdeb22630dbeba9f028e1c68167d10a5288a28
diff --git a/gallerycommon/src/com/android/gallery3d/common/Utils.java b/gallerycommon/src/com/android/gallery3d/common/Utils.java
index f5a2667..3a68745 100644
--- a/gallerycommon/src/com/android/gallery3d/common/Utils.java
+++ b/gallerycommon/src/com/android/gallery3d/common/Utils.java
@@ -76,7 +76,7 @@
     // Throws IllegalArgumentException if the input is <= 0 or
     // the answer overflows.
     public static int nextPowerOf2(int n) {
-        if (n <= 0 || n > (1 << 30)) throw new IllegalArgumentException();
+        if (n <= 0 || n > (1 << 30)) throw new IllegalArgumentException("n is invalid: " + n);
         n -= 1;
         n |= n >> 16;
         n |= n >> 8;
diff --git a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
index 1930e38..7cb8948 100644
--- a/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
+++ b/src/com/android/gallery3d/ui/SurfaceTextureScreenNail.java
@@ -109,6 +109,7 @@
             canvas.translate(cx, cy);
             canvas.scale(1, -1, 1);
             canvas.translate(-cx, -cy);
+            updateTransformMatrix(mTransform);
             canvas.drawTexture(mExtTexture, mTransform, x, y, width, height);
             canvas.restore();
         }
@@ -119,6 +120,8 @@
         throw new UnsupportedOperationException();
     }
 
+    protected void updateTransformMatrix(float[] matrix) {}
+
     @Override
     abstract public void noDraw();