public Size scaleFit(Size into) {
        if (width * into.height >= into.width * height) {
            // match width
            return new Size(into.width, height * into.width / width);
        } else {
            // match height
            return new Size(width * into.height / height, into.height);
        }
    }
Scales the dimensions so that it fits entirely inside the parent.One of width or height will
fit exactly. Aspect ratio is preserved.

@param into the parent to fit into
@return the scaled size
zxing-android-embedded/src/com/journeyapps/barcodescanner/Size.java