| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (mirror) { | 251 if (mirror) { |
| 252 scaleX *= -1; | 252 scaleX *= -1; |
| 253 } | 253 } |
| 254 final float matrix[] = new float[16]; | 254 final float matrix[] = new float[16]; |
| 255 Matrix.setIdentityM(matrix, 0); | 255 Matrix.setIdentityM(matrix, 0); |
| 256 Matrix.scaleM(matrix, 0, scaleX, scaleY, 1); | 256 Matrix.scaleM(matrix, 0, scaleX, scaleY, 1); |
| 257 adjustOrigin(matrix); | 257 adjustOrigin(matrix); |
| 258 return matrix; | 258 return matrix; |
| 259 } | 259 } |
| 260 | 260 |
| 261 /** Converts a float[16] matrix array to android.graphics.Matrix. */ |
| 262 public static android.graphics.Matrix convertMatrixToAndroidGraphicsMatrix(flo
at[] matrix4x4) { |
| 263 // clang-format off |
| 264 float[] values = { |
| 265 matrix4x4[0 * 4 + 0], matrix4x4[1 * 4 + 0], matrix4x4[3 * 4 + 0], |
| 266 matrix4x4[0 * 4 + 1], matrix4x4[1 * 4 + 1], matrix4x4[3 * 4 + 1], |
| 267 matrix4x4[0 * 4 + 3], matrix4x4[1 * 4 + 3], matrix4x4[3 * 4 + 3], |
| 268 }; |
| 269 // clang-format on |
| 270 |
| 271 android.graphics.Matrix matrix = new android.graphics.Matrix(); |
| 272 matrix.setValues(values); |
| 273 return matrix; |
| 274 } |
| 275 |
| 261 /** | 276 /** |
| 262 * Calculate display size based on scaling type, video aspect ratio, and maxim
um display size. | 277 * Calculate display size based on scaling type, video aspect ratio, and maxim
um display size. |
| 263 */ | 278 */ |
| 264 public static Point getDisplaySize( | 279 public static Point getDisplaySize( |
| 265 ScalingType scalingType, float videoAspectRatio, int maxDisplayWidth, int
maxDisplayHeight) { | 280 ScalingType scalingType, float videoAspectRatio, int maxDisplayWidth, int
maxDisplayHeight) { |
| 266 return getDisplaySize(convertScalingTypeToVisibleFraction(scalingType), vide
oAspectRatio, | 281 return getDisplaySize(convertScalingTypeToVisibleFraction(scalingType), vide
oAspectRatio, |
| 267 maxDisplayWidth, maxDisplayHeight); | 282 maxDisplayWidth, maxDisplayHeight); |
| 268 } | 283 } |
| 269 | 284 |
| 270 /** | 285 /** |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 return new Point(maxDisplayWidth, maxDisplayHeight); | 324 return new Point(maxDisplayWidth, maxDisplayHeight); |
| 310 } | 325 } |
| 311 // Each dimension is constrained on max display size and how much we are all
owed to crop. | 326 // Each dimension is constrained on max display size and how much we are all
owed to crop. |
| 312 final int width = Math.min( | 327 final int width = Math.min( |
| 313 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide
oAspectRatio)); | 328 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide
oAspectRatio)); |
| 314 final int height = Math.min( | 329 final int height = Math.min( |
| 315 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide
oAspectRatio)); | 330 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide
oAspectRatio)); |
| 316 return new Point(width, height); | 331 return new Point(width, height); |
| 317 } | 332 } |
| 318 } | 333 } |
| OLD | NEW |