VideoStreamView.java 文件源码

java
阅读 45 收藏 0 点赞 0 评论 0

项目:material-camera 作者:
@Size(value = 2)
private int[] getDimensions(int orientation, float videoWidth, float videoHeight) {
  final float aspectRatio = videoWidth / videoHeight;
  int width;
  int height;
  if (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
      || orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT) {
    width = getMeasuredWidth();
    height = (int) ((float) width / aspectRatio);
    if (height > getMeasuredHeight()) {
      height = getMeasuredHeight();
      width = (int) ((float) height * aspectRatio);
    }
  } else {
    height = getMeasuredHeight();
    width = (int) ((float) height * aspectRatio);
    if (width > getMeasuredWidth()) {
      width = getMeasuredWidth();
      height = (int) ((float) width / aspectRatio);
    }
  }
  return new int[] {width, height};
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号