Commit f2b8b314 by claincly Committed by Tofunmi Adigun-Hameed

Use the designated UNSET value for aspect ratio

PiperOrigin-RevId: 536770380
(cherry picked from commit 11c52d2de1e07b5c497438ee86651e0bd399b3d2)
parent f07e5c50
......@@ -117,9 +117,7 @@ public final class Presentation implements MatrixTransformation {
*/
public static Presentation createForAspectRatio(
@FloatRange(from = 0, fromInclusive = false) float aspectRatio, @Layout int layout) {
checkArgument(
aspectRatio == C.LENGTH_UNSET || aspectRatio > 0,
"aspect ratio " + aspectRatio + " must be positive or unset");
checkArgument(aspectRatio > 0, "aspect ratio " + aspectRatio + " must be positive");
checkLayout(layout);
return new Presentation(
/* width= */ C.LENGTH_UNSET, /* height= */ C.LENGTH_UNSET, aspectRatio, layout);
......@@ -167,7 +165,7 @@ public final class Presentation implements MatrixTransformation {
private Presentation(int width, int height, float aspectRatio, @Layout int layout) {
checkArgument(
(aspectRatio == C.LENGTH_UNSET) || (width == C.LENGTH_UNSET),
(aspectRatio == ASPECT_RATIO_UNSET) || (width == C.LENGTH_UNSET),
"width and aspect ratio should not both be set");
this.requestedWidthPixels = width;
......@@ -193,7 +191,7 @@ public final class Presentation implements MatrixTransformation {
requestedAspectRatio = (float) requestedWidthPixels / requestedHeightPixels;
}
if (requestedAspectRatio != C.LENGTH_UNSET) {
if (requestedAspectRatio != ASPECT_RATIO_UNSET) {
applyAspectRatio();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment