mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 08:47:46 +00:00
parent
d5bd7bcf5f
commit
3bfb123b33
@ -541,7 +541,8 @@ public class CameraView extends FrameLayout {
|
||||
previewSize.width,
|
||||
previewSize.height,
|
||||
rotation,
|
||||
croppingRect);
|
||||
croppingRect,
|
||||
cameraId == CameraInfo.CAMERA_FACING_FRONT);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
return null;
|
||||
|
@ -157,10 +157,11 @@ public class BitmapUtil {
|
||||
final int width,
|
||||
final int height,
|
||||
int rotation,
|
||||
final Rect croppingRect)
|
||||
final Rect croppingRect,
|
||||
final boolean flipHorizontal)
|
||||
throws IOException
|
||||
{
|
||||
byte[] rotated = rotateNV21(data, width, height, rotation);
|
||||
byte[] rotated = rotateNV21(data, width, height, rotation, flipHorizontal);
|
||||
final int rotatedWidth = rotation % 180 > 0 ? height : width;
|
||||
final int rotatedHeight = rotation % 180 > 0 ? width : height;
|
||||
YuvImage previewImage = new YuvImage(rotated, ImageFormat.NV21,
|
||||
@ -183,7 +184,8 @@ public class BitmapUtil {
|
||||
public static byte[] rotateNV21(@NonNull final byte[] yuv,
|
||||
final int width,
|
||||
final int height,
|
||||
final int rotation)
|
||||
final int rotation,
|
||||
final boolean flipHorizontal)
|
||||
throws IOException
|
||||
{
|
||||
if (rotation == 0) return yuv;
|
||||
@ -196,7 +198,7 @@ public class BitmapUtil {
|
||||
final byte[] output = new byte[yuv.length];
|
||||
final int frameSize = width * height;
|
||||
final boolean swap = rotation % 180 != 0;
|
||||
final boolean xflip = rotation % 270 != 0;
|
||||
final boolean xflip = flipHorizontal ? rotation % 270 == 0 : rotation % 270 != 0;
|
||||
final boolean yflip = rotation >= 180;
|
||||
|
||||
for (int j = 0; j < height; j++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user