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