Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-budiyev committed Mar 9, 2018
1 parent f6c9372 commit 578d931
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions src/main/java/com/budiyev/android/codescanner/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ final class Utils {
private static final float MIN_DISTORTION = 0.3f;
private static final float MAX_DISTORTION = 1f;
private static final float DISTORTION_STEP = 0.1f;
private static final float FRAME_THRESHOLD = 0.05f;
private static final int MIN_PREVIEW_PIXELS = 589824;

private Utils() {
Expand Down Expand Up @@ -211,14 +210,10 @@ public static Rect getImageFrameRect(int imageWidth, int imageHeight, @NonNull R
int hD = (previewHeight - viewHeight) / 2;
float wR = (float) imageWidth / (float) previewWidth;
float hR = (float) imageHeight / (float) previewHeight;
float left = (viewFrameRect.getLeft() + wD) * wR;
float top = (viewFrameRect.getTop() + hD) * hR;
float right = (viewFrameRect.getRight() + wD) * wR;
float bottom = (viewFrameRect.getBottom() + hD) * hR;
return new Rect(Math.max(Math.round(left - left * FRAME_THRESHOLD), 0),
Math.max(Math.round(top - top * FRAME_THRESHOLD), 0),
Math.min(Math.round(right + right * FRAME_THRESHOLD), imageWidth),
Math.min(Math.round(bottom + bottom * FRAME_THRESHOLD), imageHeight));
return new Rect(Math.max(Math.round((viewFrameRect.getLeft() + wD) * wR), 0),
Math.max(Math.round((viewFrameRect.getTop() + hD) * hR), 0),
Math.min(Math.round((viewFrameRect.getRight() + wD) * wR), imageWidth),
Math.min(Math.round((viewFrameRect.getBottom() + hD) * hR), imageHeight));
}

public static byte[] rotateNV21(byte[] source, int width, int height, int rotation) {
Expand Down

0 comments on commit 578d931

Please sign in to comment.