diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2015-02-13 01:33:42 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-02-13 01:33:42 +0000 |
commit | fb7c14c5f974cad8b74e51cc8fab86c276626780 (patch) | |
tree | 2eff3c7aa50d08ffd398a4d25e385c9fbfd93ee8 /core/java | |
parent | 96a99bc3c1f57298c551254fcb8854410ff4e53f (diff) | |
parent | 41af9d592efbae88ed95ab77a856dd4e8fbab998 (diff) | |
download | frameworks_base-fb7c14c5f974cad8b74e51cc8fab86c276626780.zip frameworks_base-fb7c14c5f974cad8b74e51cc8fab86c276626780.tar.gz frameworks_base-fb7c14c5f974cad8b74e51cc8fab86c276626780.tar.bz2 |
am 41af9d59: Merge "camera2: Fix legacy scaling factor application." into lmp-mr1-dev automerge: d2ccbd4
* commit '41af9d592efbae88ed95ab77a856dd4e8fbab998':
camera2: Fix legacy scaling factor application.
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java index a0a0716..615b2c8 100644 --- a/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java +++ b/core/java/android/hardware/camera2/legacy/SurfaceTextureRenderer.java @@ -269,21 +269,23 @@ public class SurfaceTextureRenderer { throw new IllegalStateException("Illegal intermediate texture with dimension of 0"); } - // Letterbox or pillerbox output dimensions into intermediate dimensions. + // Letterbox or pillar-box output dimensions into intermediate dimensions. RectF intermediate = new RectF(/*left*/0, /*top*/0, /*right*/texWidth, /*bottom*/texHeight); RectF output = new RectF(/*left*/0, /*top*/0, /*right*/width, /*bottom*/height); android.graphics.Matrix boxingXform = new android.graphics.Matrix(); boxingXform.setRectToRect(output, intermediate, android.graphics.Matrix.ScaleToFit.CENTER); boxingXform.mapRect(output); - // Find scaling factor from pillerboxed/letterboxed output dimensions to intermediate + // Find scaling factor from pillar-boxed/letter-boxed output dimensions to intermediate // buffer dimensions. float scaleX = intermediate.width() / output.width(); float scaleY = intermediate.height() / output.height(); - // Scale opposite dimension in clip coordinates so output is letterboxed/pillerboxed into - // the intermediate dimensions (rather than vice-versa). - Matrix.scaleM(mMVPMatrix, /*offset*/0, /*x*/scaleY, /*y*/scaleX, /*z*/1); + // Intermediate texture is implicitly scaled to 'fill' the output dimensions in clip space + // coordinates in the shader. To avoid stretching, we need to scale the larger dimension + // of the intermediate buffer so that the output buffer is actually letter-boxed + // or pillar-boxed into the intermediate buffer after clipping. + Matrix.scaleM(mMVPMatrix, /*offset*/0, /*x*/scaleX, /*y*/scaleY, /*z*/1); if (DEBUG) { Log.d(TAG, "Scaling factors (S_x = " + scaleX + ",S_y = " + scaleY + ") used for " + |