Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Side by Side Diff: webrtc/api/android/java/src/org/webrtc/RendererCommon.java

Issue 2392373002: Android: Split out EGL rendering from SurfaceViewRenderer to separate class (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Calculate max allowed layout size. 130 // Calculate max allowed layout size.
131 final int maxWidth = View.getDefaultSize(Integer.MAX_VALUE, widthSpec); 131 final int maxWidth = View.getDefaultSize(Integer.MAX_VALUE, widthSpec);
132 final int maxHeight = View.getDefaultSize(Integer.MAX_VALUE, heightSpec); 132 final int maxHeight = View.getDefaultSize(Integer.MAX_VALUE, heightSpec);
133 if (frameWidth == 0 || frameHeight == 0 || maxWidth == 0 || maxHeight == 0 ) { 133 if (frameWidth == 0 || frameHeight == 0 || maxWidth == 0 || maxHeight == 0 ) {
134 return new Point(maxWidth, maxHeight); 134 return new Point(maxWidth, maxHeight);
135 } 135 }
136 // Calculate desired display size based on scaling type, video aspect rati o, 136 // Calculate desired display size based on scaling type, video aspect rati o,
137 // and maximum layout size. 137 // and maximum layout size.
138 final float frameAspect = frameWidth / (float) frameHeight; 138 final float frameAspect = frameWidth / (float) frameHeight;
139 final float displayAspect = maxWidth / (float) maxHeight; 139 final float displayAspect = maxWidth / (float) maxHeight;
140 final RendererCommon.ScalingType scalingType = (frameAspect > 1.0f) == (di splayAspect > 1.0f) 140 final ScalingType scalingType = (frameAspect > 1.0f) == (displayAspect > 1 .0f)
141 ? scalingTypeMatchOrientation 141 ? scalingTypeMatchOrientation
142 : scalingTypeMismatchOrientation; 142 : scalingTypeMismatchOrientation;
143 final Point layoutSize = 143 final Point layoutSize = getDisplaySize(scalingType, frameAspect, maxWidth , maxHeight);
144 RendererCommon.getDisplaySize(scalingType, frameAspect, maxWidth, maxH eight);
145 144
146 // If the measure specification is forcing a specific size - yield. 145 // If the measure specification is forcing a specific size - yield.
147 if (View.MeasureSpec.getMode(widthSpec) == View.MeasureSpec.EXACTLY) { 146 if (View.MeasureSpec.getMode(widthSpec) == View.MeasureSpec.EXACTLY) {
148 layoutSize.x = maxWidth; 147 layoutSize.x = maxWidth;
149 } 148 }
150 if (View.MeasureSpec.getMode(heightSpec) == View.MeasureSpec.EXACTLY) { 149 if (View.MeasureSpec.getMode(heightSpec) == View.MeasureSpec.EXACTLY) {
151 layoutSize.y = maxHeight; 150 layoutSize.y = maxHeight;
152 } 151 }
153 return layoutSize; 152 return layoutSize;
154 } 153 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 return new Point(maxDisplayWidth, maxDisplayHeight); 289 return new Point(maxDisplayWidth, maxDisplayHeight);
291 } 290 }
292 // Each dimension is constrained on max display size and how much we are all owed to crop. 291 // Each dimension is constrained on max display size and how much we are all owed to crop.
293 final int width = Math.min( 292 final int width = Math.min(
294 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide oAspectRatio)); 293 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide oAspectRatio));
295 final int height = Math.min( 294 final int height = Math.min(
296 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide oAspectRatio)); 295 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide oAspectRatio));
297 return new Point(width, height); 296 return new Point(width, height);
298 } 297 }
299 } 298 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698