|
|
@ -67,19 +67,21 @@ public abstract class PreviewImpl { |
|
|
|
this.mTrueWidth = width; |
|
|
|
this.mTrueWidth = width; |
|
|
|
this.mTrueHeight = height; |
|
|
|
this.mTrueHeight = height; |
|
|
|
|
|
|
|
|
|
|
|
AspectRatio aspectRatio = AspectRatio.of(width, height); |
|
|
|
if (width != 0 && height != 0) { |
|
|
|
int targetHeight = (int) (getView().getWidth() * aspectRatio.toFloat()); |
|
|
|
AspectRatio aspectRatio = AspectRatio.of(width, height); |
|
|
|
float scaleY; |
|
|
|
int targetHeight = (int) (getView().getWidth() * aspectRatio.toFloat()); |
|
|
|
if (getView().getHeight() > 0) { |
|
|
|
float scaleY; |
|
|
|
scaleY = (float) targetHeight / (float) getView().getHeight(); |
|
|
|
if (getView().getHeight() > 0) { |
|
|
|
} else { |
|
|
|
scaleY = (float) targetHeight / (float) getView().getHeight(); |
|
|
|
scaleY = 1; |
|
|
|
} else { |
|
|
|
} |
|
|
|
scaleY = 1; |
|
|
|
|
|
|
|
} |
|
|
|
if (scaleY > 1) { |
|
|
|
|
|
|
|
getView().setScaleY(scaleY); |
|
|
|
if (scaleY > 1) { |
|
|
|
} else { |
|
|
|
getView().setScaleY(scaleY); |
|
|
|
getView().setScaleX(1 / scaleY); |
|
|
|
} else { |
|
|
|
|
|
|
|
getView().setScaleX(1 / scaleY); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|