pull/421/head
Giacomo Randazzo 6 years ago
parent 3d0c7ffacb
commit 37c1e49b95
  1. 8
      cameraview/src/main/java/com/otaliastudios/cameraview/OverlayLayout.java

@ -53,9 +53,11 @@ class OverlayLayout extends FrameLayout implements SurfaceDrawer {
try { try {
final Canvas surfaceCanvas = outputSurface.lockCanvas(null); final Canvas surfaceCanvas = outputSurface.lockCanvas(null);
float xScale = surfaceCanvas.getWidth() / (float) getWidth(); // scale factor between canvas width and this View's width
float yScale = surfaceCanvas.getHeight() / (float) getHeight(); float widthScale = surfaceCanvas.getWidth() / (float) getWidth();
surfaceCanvas.scale(xScale, yScale); // scale factor between canvas height and this View's height
float heightScale = surfaceCanvas.getHeight() / (float) getHeight();
surfaceCanvas.scale(widthScale, heightScale);
surfaceCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); surfaceCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
for (int i = 0; i < getChildCount(); i++) { for (int i = 0; i < getChildCount(); i++) {

Loading…
Cancel
Save