Remove unnecessary allocations

This change removes a couple of allocations per frame when the user
is trying to scroll past the end of the workspace. The allocated
object, PorterDuffXfermode, is pretty expensive and creating a new
one on every frame could potentially defeat GL rendering optimizations.

Change-Id: Iebaf579d29ad8f14112c5af8cb5dce8d7f4dfbaf
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 6f4759d..ba20a76 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -160,6 +160,9 @@
     private static final int INVALID_DIRECTION = -100;
     private DropTarget.DragEnforcer mDragEnforcer;
 
+    private final static PorterDuffXfermode sAddBlendMode =
+            new PorterDuffXfermode(PorterDuff.Mode.ADD);
+
     public CellLayout(Context context) {
         this(context, null);
     }
@@ -506,7 +509,7 @@
         if (mForegroundAlpha > 0) {
             mOverScrollForegroundDrawable.setBounds(mForegroundRect);
             Paint p = ((NinePatchDrawable) mOverScrollForegroundDrawable).getPaint();
-            p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.ADD));
+            p.setXfermode(sAddBlendMode);
             mOverScrollForegroundDrawable.draw(canvas);
             p.setXfermode(null);
         }