diff options
author | Rajeev Kumar <rajekumar@google.com> | 2017-08-14 16:10:13 -0700 |
---|---|---|
committer | Rajeev Kumar <rajekumar@google.com> | 2017-08-14 16:12:48 -0700 |
commit | bf17e50156fe783bc504601782686c92aba0a4d0 (patch) | |
tree | 149bdcf6b39b017d268826d269fff0f74f1fcb40 /src | |
parent | 492617f4c48155c2efc4f07464c8f86625590367 (diff) | |
download | android_packages_apps_Trebuchet-bf17e50156fe783bc504601782686c92aba0a4d0.tar.gz android_packages_apps_Trebuchet-bf17e50156fe783bc504601782686c92aba0a4d0.tar.bz2 android_packages_apps_Trebuchet-bf17e50156fe783bc504601782686c92aba0a4d0.zip |
Get rid of unnecessary int array allocation.
Bug: 64656232
Change-Id: Ifc811c3930b8052d57fa33d35b9d50f11b541c94
Test: Tested manually
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/graphics/IconNormalizer.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/com/android/launcher3/graphics/IconNormalizer.java b/src/com/android/launcher3/graphics/IconNormalizer.java index 34d0b727c..8ed62bcdc 100644 --- a/src/com/android/launcher3/graphics/IconNormalizer.java +++ b/src/com/android/launcher3/graphics/IconNormalizer.java @@ -32,10 +32,8 @@ import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.util.Log; - import com.android.launcher3.LauncherAppState; import com.android.launcher3.Utilities; - import java.io.File; import java.io.FileOutputStream; import java.nio.ByteBuffer; @@ -84,12 +82,12 @@ public class IconNormalizer { private final Rect mBounds; private final Matrix mMatrix; - private Paint mPaintIcon; - private Canvas mCanvasARGB; + private final Paint mPaintIcon; + private final Canvas mCanvasARGB; - private File mDir; + private final File mDir; private int mFileId; - private Random mRandom; + private final Random mRandom; private IconNormalizer(Context context) { // Use twice the icon size as maximum size to avoid scaling down twice. @@ -122,7 +120,6 @@ public class IconNormalizer { mPaintMaskShapeOutline.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT)); mMatrix = new Matrix(); - int[] mPixels = new int[mMaxSize * mMaxSize]; mAdaptiveIconScale = SCALE_NOT_INITIALIZED; mDir = context.getExternalFilesDir(null); @@ -174,7 +171,8 @@ public class IconNormalizer { boolean isTrans = isTransparentBitmap(mBitmapARGB); if (DEBUG) { - final File afterFile = new File(mDir, "isShape" + mFileId + "_after_" + isTrans + ".png"); + final File afterFile = new File(mDir, + "isShape" + mFileId + "_after_" + isTrans + ".png"); try { mBitmapARGB.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(afterFile)); @@ -210,7 +208,9 @@ public class IconNormalizer { float percentageDiffPixels = ((float) sum) / (mBounds.width() * mBounds.height()); boolean transparentImage = percentageDiffPixels < PIXEL_DIFF_PERCENTAGE_THRESHOLD; if (DEBUG) { - Log.d(TAG, "Total # pixel that is different (id="+ mFileId + "):" + percentageDiffPixels + "="+ sum + "/" + mBounds.width() * mBounds.height()); + Log.d(TAG, + "Total # pixel that is different (id=" + mFileId + "):" + percentageDiffPixels + + "=" + sum + "/" + mBounds.width() * mBounds.height()); } return transparentImage; } |