@Override
  protected void onLayout(boolean changed, int l, int t, int r, int b) {

    super.onLayout(changed, l, t, r, b);

    if (mLayoutWidth > 0 && mLayoutHeight > 0) {
      // Gets original parameters, and creates the new parameters
      ViewGroup.LayoutParams origParams = this.getLayoutParams();
      origParams.width = mLayoutWidth;
      origParams.height = mLayoutHeight;
      setLayoutParams(origParams);

      if (mBitmap != null) {
        applyImageMatrix(r - l, b - t, true, false);

        // after state restore we want to restore the window crop, possible only after widget size
        // is known
        if (mRestoreCropWindowRect != null) {
          if (mRestoreDegreesRotated != mInitialDegreesRotated) {
            mDegreesRotated = mRestoreDegreesRotated;
            applyImageMatrix(r - l, b - t, true, false);
          }
          mImageMatrix.mapRect(mRestoreCropWindowRect);
          mCropOverlayView.setCropWindowRect(mRestoreCropWindowRect);
          handleCropWindowChanged(false, false);
          mCropOverlayView.fixCurrentCropWindowRect();
          mRestoreCropWindowRect = null;
        } else if (mSizeChanged) {
          mSizeChanged = false;
          handleCropWindowChanged(false, false);
        }
      } else {
        updateImageBounds(true);
      }
    } else {
      updateImageBounds(true);
    }
  }
Gets the cropped image based on the current crop window.<br>
If (reqWidth,reqHeight) is given AND image is loaded from URI cropping will try to use sample
size to fit in the requested width and height down-sampling if possible - optimization to get
best size to quality.<br>
The result will be invoked to listener set by {@link
#setOnCropImageCompleteListener(OnCropImageCompleteListener)}.

@param reqWidth the width to resize the cropped image to (see options)
@param reqHeight the height to resize the cropped image to (see options)
@param options the resize method to use on the cropped bitmap
@param saveUri optional: to save the cropped image to
@param saveCompressFormat if saveUri is given, the given compression will be used for saving
    the image
@param saveCompressQuality if saveUri is given, the given quality will be used for the
    compression.
core/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java