diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-07-16 12:18:06 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-08-13 16:54:58 -0700 |
commit | 106bf64f4a5b4b7772c971f62b6207b5a73529a2 (patch) | |
tree | b2f465ac4e688c7e76ff3be0e47bd9c9ee4f41a3 /src/com/android/launcher3/Utilities.java | |
parent | e88491d66bb66d69033f563df17f9474dc188de7 (diff) | |
download | android_packages_apps_Trebuchet-106bf64f4a5b4b7772c971f62b6207b5a73529a2.tar.gz android_packages_apps_Trebuchet-106bf64f4a5b4b7772c971f62b6207b5a73529a2.tar.bz2 android_packages_apps_Trebuchet-106bf64f4a5b4b7772c971f62b6207b5a73529a2.zip |
Some cleanup around drag and drop
> Instead of resizing the rect for dragoutline in onDrow, store the resized rect itself
> Remove unnecessary inverse matrix calculation
Change-Id: If13c3c5aaecba5a1d3a4f5d39199ed82e9662c62
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 00d4c8d83..4c98e2032 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -354,15 +354,6 @@ public final class Utilities { localY < (v.getHeight() + slop); } - public static void scaleRect(Rect r, float scale) { - if (scale != 1.0f) { - r.left = (int) (r.left * scale + 0.5f); - r.top = (int) (r.top * scale + 0.5f); - r.right = (int) (r.right * scale + 0.5f); - r.bottom = (int) (r.bottom * scale + 0.5f); - } - } - public static int[] getCenterDeltaInScreenSpace(View v0, View v1, int[] delta) { v0.getLocationInWindow(sLoc0); v1.getLocationInWindow(sLoc1); @@ -383,11 +374,18 @@ public final class Utilities { } public static void scaleRectAboutCenter(Rect r, float scale) { - int cx = r.centerX(); - int cy = r.centerY(); - r.offset(-cx, -cy); - Utilities.scaleRect(r, scale); - r.offset(cx, cy); + if (scale != 1.0f) { + int cx = r.centerX(); + int cy = r.centerY(); + r.offset(-cx, -cy); + + r.left = (int) (r.left * scale + 0.5f); + r.top = (int) (r.top * scale + 0.5f); + r.right = (int) (r.right * scale + 0.5f); + r.bottom = (int) (r.bottom * scale + 0.5f); + + r.offset(cx, cy); + } } public static void startActivityForResultSafely( |