summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Utilities.java
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2009-10-29 17:27:55 -0400
committerMike Reed <reed@google.com>2009-10-30 08:13:24 -0400
commitcdd117935f51d66f6f212387300d851f81aa071f (patch)
treee61b341de7245c131a4114bbafb912b6ac525a83 /src/com/android/launcher2/Utilities.java
parent4d7b6c949ac02eb7b40b0040fafc78f97ea264f8 (diff)
downloadandroid_packages_apps_Trebuchet-cdd117935f51d66f6f212387300d851f81aa071f.tar.gz
android_packages_apps_Trebuchet-cdd117935f51d66f6f212387300d851f81aa071f.tar.bz2
android_packages_apps_Trebuchet-cdd117935f51d66f6f212387300d851f81aa071f.zip
use table maskfilter for glow
http://b/issue?id=2210685
Diffstat (limited to 'src/com/android/launcher2/Utilities.java')
-rw-r--r--src/com/android/launcher2/Utilities.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/com/android/launcher2/Utilities.java b/src/com/android/launcher2/Utilities.java
index 71ac34361..5aeef9bd5 100644
--- a/src/com/android/launcher2/Utilities.java
+++ b/src/com/android/launcher2/Utilities.java
@@ -22,12 +22,14 @@ import android.graphics.drawable.PaintDrawable;
import android.graphics.Bitmap;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
+import android.graphics.MaskFilter;
import android.graphics.Paint;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.PixelFormat;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.graphics.TableMaskFilter;
import android.graphics.Typeface;
import android.text.Layout.Alignment;
import android.text.StaticLayout;
@@ -253,18 +255,13 @@ final class Utilities {
}
dest.drawColor(0, PorterDuff.Mode.CLEAR);
-
- final float scale = 1.55f;
- Bitmap scaled = Bitmap.createScaledBitmap(src, (int)(src.getWidth()*scale),
- (int)(src.getHeight()*scale), true);
-
+
int[] xy = new int[2];
- Bitmap mask = scaled.extractAlpha(sBlurPaint, xy);
+ Bitmap mask = src.extractAlpha(sBlurPaint, xy);
- dest.drawBitmap(mask, (destWidth - mask.getWidth()) / 2,
- (destHeight - mask.getHeight()) / 2, sGlowColorPaint);
- dest.drawBitmap(src, (destWidth - src.getWidth()) / 2,
- (destHeight - src.getHeight()) / 2, sEmptyPaint);
+ float px = (destWidth - src.getWidth()) / 2;
+ float py = (destHeight - src.getHeight()) / 2;
+ dest.drawBitmap(mask, px + xy[0], py + xy[1], sGlowColorPaint);
mask.recycle();
}
@@ -341,8 +338,9 @@ final class Utilities {
sIconWidth = sIconHeight = (int) resources.getDimension(android.R.dimen.app_icon_size);
sIconTextureWidth = sIconTextureHeight = roundToPow2(sIconWidth);
- sBlurPaint.setMaskFilter(new BlurMaskFilter(7 * density, BlurMaskFilter.Blur.NORMAL));
+ sBlurPaint.setMaskFilter(new BlurMaskFilter(4 * density, BlurMaskFilter.Blur.NORMAL));
sGlowColorPaint.setColor(0xffff9000);
+ sGlowColorPaint.setMaskFilter(TableMaskFilter.CreateClipTable(0, 64));
}
static class BubbleText {