当前位置: 首页>>代码示例>>Java>>正文


Java RendererCommon.getDisplaySize方法代码示例

本文整理汇总了Java中org.webrtc.RendererCommon.getDisplaySize方法的典型用法代码示例。如果您正苦于以下问题:Java RendererCommon.getDisplaySize方法的具体用法?Java RendererCommon.getDisplaySize怎么用?Java RendererCommon.getDisplaySize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.webrtc.RendererCommon的用法示例。


在下文中一共展示了RendererCommon.getDisplaySize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDesiredLayoutSize

import org.webrtc.RendererCommon; //导入方法依赖的package包/类
private Point getDesiredLayoutSize(int widthSpec, int heightSpec) {
  synchronized (layoutLock) {
    final int maxWidth = getDefaultSize(Integer.MAX_VALUE, widthSpec);
    final int maxHeight = getDefaultSize(Integer.MAX_VALUE, heightSpec);
    final Point size =
        RendererCommon.getDisplaySize(scalingType, frameAspectRatio(), maxWidth, maxHeight);
    if (MeasureSpec.getMode(widthSpec) == MeasureSpec.EXACTLY) {
      size.x = maxWidth;
    }
    if (MeasureSpec.getMode(heightSpec) == MeasureSpec.EXACTLY) {
      size.y = maxHeight;
    }
    return size;
  }
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:16,代码来源:SurfaceViewRenderer.java

示例2: onLayout

import org.webrtc.RendererCommon; //导入方法依赖的package包/类
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int height = b - t;
    int width = r - l;
    if (height == 0 || width == 0) {
        l = t = r = b = 0;
    } else {
        int videoHeight;
        int videoWidth;
        synchronized (layoutSync) {
            videoHeight = this.videoHeight;
            videoWidth = this.videoWidth;
        }

        if (videoHeight == 0 || videoWidth == 0) {
            // These are Twilio defaults.
            videoHeight = 480;
            videoWidth = 640;
        }

        Point displaySize = RendererCommon.getDisplaySize(
                this.scalingType,
                videoWidth / (float) videoHeight,
                width,
                height
        );

        l = (width - displaySize.x) / 2;
        t = (height - displaySize.y) / 2;
        r = l + displaySize.x;
        b = t + displaySize.y;
    }
    surfaceViewRenderer.layout(l, t, r, b);
}
 
开发者ID:blackuy,项目名称:react-native-twilio-video-webrtc,代码行数:35,代码来源:RNVideoViewGroup.java

示例3: onLayout

import org.webrtc.RendererCommon; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int height = b - t;
    int width = r - l;

    if (height == 0 || width == 0) {
        l = t = r = b = 0;
    } else {
        int frameHeight;
        int frameRotation;
        int frameWidth;
        ScalingType scalingType;

        synchronized (layoutSyncRoot) {
            frameHeight = this.frameHeight;
            frameRotation = this.frameRotation;
            frameWidth = this.frameWidth;
            scalingType = this.scalingType;
        }

        SurfaceViewRenderer surfaceViewRenderer = getSurfaceViewRenderer();

        switch (scalingType) {
        case SCALE_ASPECT_FILL:
            // Fill this ViewGroup with surfaceViewRenderer and the latter
            // will take care of filling itself with the video similarly to
            // the cover value the CSS property object-fit.
            r = width;
            l = 0;
            b = height;
            t = 0;
            break;
        case SCALE_ASPECT_FIT:
        default:
            // Lay surfaceViewRenderer out inside this ViewGroup in accord
            // with the contain value of the CSS property object-fit.
            // SurfaceViewRenderer will fill itself with the video similarly
            // to the cover or contain value of the CSS property object-fit
            // (which will not matter, eventually).
            if (frameHeight == 0 || frameWidth == 0) {
                l = t = r = b = 0;
            } else {
                float frameAspectRatio
                    = (frameRotation % 180 == 0)
                        ? frameWidth / (float) frameHeight
                        : frameHeight / (float) frameWidth;
                Point frameDisplaySize
                    = RendererCommon.getDisplaySize(
                            scalingType,
                            frameAspectRatio,
                            width, height);

                l = (width - frameDisplaySize.x) / 2;
                t = (height - frameDisplaySize.y) / 2;
                r = l + frameDisplaySize.x;
                b = t + frameDisplaySize.y;
            }
            break;
        }
    }
    surfaceViewRenderer.layout(l, t, r, b);
}
 
开发者ID:angellsl10,项目名称:react-native-webrtc,代码行数:66,代码来源:WebRTCView.java

示例4: onLayout

import org.webrtc.RendererCommon; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int height = b - t;
    int width = r - l;

    if (height == 0 || width == 0) {
        l = t = r = b = 0;
    } else {
        int frameHeight;
        int frameRotation;
        int frameWidth;
        ScalingType scalingType;

        synchronized (layoutSyncRoot) {
            frameHeight = this.frameHeight;
            frameRotation = this.frameRotation;
            frameWidth = this.frameWidth;
            scalingType = this.scalingType;
        }

        SurfaceViewRenderer surfaceViewRenderer = getSurfaceViewRenderer();

        switch (scalingType) {
            case SCALE_ASPECT_FILL:
                // Fill this ViewGroup with surfaceViewRenderer and the latter
                // will take care of filling itself with the video similarly to
                // the cover value the CSS property object-fit.
                r = width;
                l = 0;
                b = height;
                t = 0;
                break;
            case SCALE_ASPECT_FIT:
            default:
                // Lay surfaceViewRenderer out inside this ViewGroup in accord
                // with the contain value of the CSS property object-fit.
                // SurfaceViewRenderer will fill itself with the video similarly
                // to the cover or contain value of the CSS property object-fit
                // (which will not matter, eventually).
                if (frameHeight == 0 || frameWidth == 0) {
                    l = t = r = b = 0;
                } else {
                    float frameAspectRatio
                            = (frameRotation % 180 == 0)
                            ? frameWidth / (float) frameHeight
                            : frameHeight / (float) frameWidth;
                    Point frameDisplaySize
                            = RendererCommon.getDisplaySize(
                            scalingType,
                            frameAspectRatio,
                            width, height);

                    l = (width - frameDisplaySize.x) / 2;
                    t = (height - frameDisplaySize.y) / 2;
                    r = l + frameDisplaySize.x;
                    b = t + frameDisplaySize.y;
                }
                break;
        }
    }
    surfaceViewRenderer.layout(l, t, r, b);
}
 
开发者ID:matrix-org,项目名称:matrix-android-sdk,代码行数:66,代码来源:MXWebRtcView.java


注:本文中的org.webrtc.RendererCommon.getDisplaySize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。