mirror of
https://github.com/status-im/react-native-camera.git
synced 2025-02-24 01:38:18 +00:00
rename variables and add check
This commit is contained in:
parent
236758147d
commit
56c807bdeb
@ -363,10 +363,14 @@ class RCTCameraViewFinder extends TextureView implements TextureView.SurfaceText
|
||||
|
||||
private void rotateImage(int width, int height) {
|
||||
byte[] rotated = new byte[imageData.length];
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
rotated[x * height + height - y - 1] = imageData[x + y * width];
|
||||
}
|
||||
for (int y = 0; y < width; y++) {
|
||||
for (int x = 0; x < height; x++) {
|
||||
int sourceIx = x + y * height;
|
||||
int destIx = x * width + width - y - 1;
|
||||
if (sourceIx >= 0 && sourceIx < imageData.length && destIx >= 0 && destIx < imageData.length) {
|
||||
rotated[destIx] = imageData[sourceIx];
|
||||
}
|
||||
}
|
||||
}
|
||||
imageData = rotated;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user