From 6ec11bc3a80341206be9506619deb7f9171d38c9 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Tue, 19 Jan 2010 17:56:52 -0800 Subject: Change text labels from RGBA to ALPHA8. Reduces memory usage and may increase performance. --- res/raw/allapps.rs | 2 +- src/com/android/launcher2/AllAppsView.java | 10 +++++++++- src/com/android/launcher2/Utilities.java | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/res/raw/allapps.rs b/res/raw/allapps.rs index edbbcd826..8cbbea2f4 100644 --- a/res/raw/allapps.rs +++ b/res/raw/allapps.rs @@ -106,7 +106,7 @@ void move() { if (g_LastTouchDown) { float dx = -(state->newPositionX - g_LastPositionX); g_PosVelocity = 0; - g_PosPage += dx * 4; + g_PosPage += dx * 5.2f; float pmin = -0.49f; float pmax = g_PosMax + 0.49f; diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java index 20572766e..424bc555e 100644 --- a/src/com/android/launcher2/AllAppsView.java +++ b/src/com/android/launcher2/AllAppsView.java @@ -784,6 +784,7 @@ public class AllAppsView extends RSSurfaceView private ProgramStore mPSText; private ProgramFragment mPFColor; private ProgramFragment mPFTexMip; + private ProgramFragment mPFTexMipAlpha; private ProgramFragment mPFTexNearest; private ProgramVertex mPV; private ProgramVertex mPVOrtho; @@ -1015,6 +1016,13 @@ public class AllAppsView extends RSSurfaceView mPFTexNearest = bf.create(); mPFTexNearest.setName("PFTexNearest"); mPFTexNearest.bindSampler(nearest, 0); + + bf.setTexture(ProgramFragment.Builder.EnvMode.MODULATE, + ProgramFragment.Builder.Format.ALPHA, 0); + mPFTexMipAlpha = bf.create(); + mPFTexMipAlpha.setName("PFTexMipAlpha"); + mPFTexMipAlpha.bindSampler(linear, 0); + } private void initProgramStore() { @@ -1152,7 +1160,7 @@ public class AllAppsView extends RSSurfaceView mIcons[index] = Allocation.createFromBitmap(mRS, item.iconBitmap, Element.RGBA_8888(mRS), true); mLabels[index] = Allocation.createFromBitmap(mRS, item.titleBitmap, - Element.RGBA_8888(mRS), true); + Element.A_8(mRS), true); mIconIds[index] = mIcons[index].getID(); mLabelIds[index] = mLabels[index].getID(); } diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java index 507096cff..94e281b41 100644 --- a/src/com/android/launcher2/Utilities.java +++ b/src/com/android/launcher2/Utilities.java @@ -415,7 +415,7 @@ final class Utilities { /** You own the bitmap after this and you must call recycle on it. */ Bitmap createTextBitmap(String text) { - Bitmap b = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ARGB_8888); + Bitmap b = Bitmap.createBitmap(mBitmapWidth, mBitmapHeight, Bitmap.Config.ALPHA_8); Canvas c = new Canvas(b); StaticLayout layout = new StaticLayout(text, mTextPaint, (int)mTextWidth, -- cgit v1.2.3