Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b50b2af0 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Wallpaper: Fuzzy screen"

parents 392b71a5 2eec5923
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
@@ -632,9 +633,29 @@ public class WallpaperCropActivity extends Activity {
                    return false;
                }

                // Get screen dimensions.
                bounds = getImageBounds();
                if (bounds == null) {
                    Log.w(LOGTAG, "Cannot get bounds for image");
                    failure = true;
                    return false;
                }
                DisplayMetrics metrics = new DisplayMetrics();
                ((Activity)mContext).getWindowManager().getDefaultDisplay().getMetrics(metrics);
                int screenWidth = metrics.widthPixels;
                int screenHeight = metrics.heightPixels;

                // See how much we're reducing the size of the image
                int scaleDownSampleSize = Math.max(1, Math.min(roundedTrueCrop.width() / mOutWidth,
                int scaleDownSampleSize;
                //If image is smaller than screen dimensions
                if (bounds.x < screenWidth && bounds.y < screenHeight) {
                    scaleDownSampleSize = 1;
                }
                else {
                    scaleDownSampleSize = Math.max(2, Math.min(roundedTrueCrop.width() / mOutWidth,
                        roundedTrueCrop.height() / mOutHeight));
                }

                // Attempt to open a region decoder
                BitmapRegionDecoder decoder = null;
                InputStream is = null;