fix GB half-screen cropping

Closes #3848
// FREEBIE
This commit is contained in:
Jake McGinty 2015-07-30 15:00:47 -07:00 committed by Moxie Marlinspike
parent 27aabbc4d9
commit 0c14639f9c

View File

@ -8,6 +8,7 @@ import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.Size;
import android.os.AsyncTask;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.support.annotation.NonNull;
import android.util.AttributeSet;
@ -122,8 +123,14 @@ import java.util.List;
}
final float newWidth = visibleRect.width() * scale;
final float newHeight = visibleRect.height() * scale;
final float centerX = previewWidth / 2;
final float centerX;
final float centerY = previewHeight / 2;
if (VERSION.SDK_INT < VERSION_CODES.ICE_CREAM_SANDWICH) {
centerX = previewWidth - newWidth / 2;
} else {
centerX = previewWidth / 2;
}
visibleRect.set((int) (centerX - newWidth / 2),
(int) (centerY - newHeight / 2),
(int) (centerX + newWidth / 2),