优化代码

main
Matthew 8 months ago
parent 280f0055f6
commit afefe0027f

@ -706,9 +706,11 @@ public class Camera2RawFragment extends Fragment
CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
// For still image captures, we use the largest available size.
Size largestJpeg = Collections.max(
Arrays.asList(map.getOutputSizes(ImageFormat.JPEG)),
new CompareSizesByArea());
Size[] resolutions = map.getHighResolutionOutputSizes(ImageFormat.JPEG);
if (resolutions == null) {
resolutions = map.getOutputSizes(ImageFormat.JPEG);
}
Size largestJpeg = Collections.max(Arrays.asList(resolutions), new CompareSizesByArea());
synchronized (mCameraStateLock) {
// Set up ImageReaders for JPEG and RAW outputs. Place these in a reference
@ -1057,13 +1059,11 @@ public class Camera2RawFragment extends Fragment
}
// Find the best preview size for these view dimensions and configured JPEG size.
final Size previewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class),
rotatedViewWidth, rotatedViewHeight, maxPreviewWidth, maxPreviewHeight,
largestJpeg);
mMessageHandler.postDelayed(new Runnable() {
@Override
public void run() {
if (swappedDimensions) {
mTextureView.setAspectRatio(
previewSize.getHeight(), previewSize.getWidth());
@ -1071,8 +1071,6 @@ public class Camera2RawFragment extends Fragment
mTextureView.setAspectRatio(
previewSize.getWidth(), previewSize.getHeight());
}
}
}, 0);

Loading…
Cancel
Save