Skip to content

Commit 729e4d1

Browse files
committed
fix not using sampling in small images that were fully loaded and samling is requested
1 parent 50a0ddc commit 729e4d1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cropper/src/main/java/com/theartofdev/edmodo/cropper/CropImageView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ public Bitmap getCroppedImage(int reqWidth, int reqHeight, RequestSizeOptions op
626626
reqWidth = options != RequestSizeOptions.NONE ? reqWidth : 0;
627627
reqHeight = options != RequestSizeOptions.NONE ? reqHeight : 0;
628628

629-
if (mLoadedImageUri != null && mLoadedSampleSize > 1) {
629+
if (mLoadedImageUri != null && (mLoadedSampleSize > 1 || options == RequestSizeOptions.SAMPLING)) {
630630
int orgWidth = mBitmap.getWidth() * mLoadedSampleSize;
631631
int orgHeight = mBitmap.getHeight() * mLoadedSampleSize;
632632
BitmapUtils.BitmapSampled bitmapSampled =
@@ -1066,7 +1066,7 @@ public void startCropWorkerTask(int reqWidth, int reqHeight, RequestSizeOptions
10661066

10671067
int orgWidth = mBitmap.getWidth() * mLoadedSampleSize;
10681068
int orgHeight = mBitmap.getHeight() * mLoadedSampleSize;
1069-
if (mLoadedImageUri != null && mLoadedSampleSize > 1) {
1069+
if (mLoadedImageUri != null && (mLoadedSampleSize > 1 || options == RequestSizeOptions.SAMPLING)) {
10701070
mBitmapCroppingWorkerTask = new WeakReference<>(new BitmapCroppingWorkerTask(this, mLoadedImageUri, getCropPoints(),
10711071
mDegreesRotated, orgWidth, orgHeight,
10721072
mCropOverlayView.isFixAspectRatio(), mCropOverlayView.getAspectRatioX(), mCropOverlayView.getAspectRatioY(),

0 commit comments

Comments
 (0)