diff options
author | Daniel Sandler <dsandler@android.com> | 2013-06-05 22:57:57 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2013-06-05 23:30:20 -0400 |
commit | 325dc23624160689e59fbac708cf6f222b20d025 (patch) | |
tree | 3c6a13a52a6e5688c7e4404890e5e8f88d544856 /src/com/android/launcher3/FastBitmapDrawable.java | |
parent | b582cd201fccece65d36b8915cf84fef3546cffa (diff) | |
download | android_packages_apps_Trebuchet-325dc23624160689e59fbac708cf6f222b20d025.tar.gz android_packages_apps_Trebuchet-325dc23624160689e59fbac708cf6f222b20d025.tar.bz2 android_packages_apps_Trebuchet-325dc23624160689e59fbac708cf6f222b20d025.zip |
Launcher2 is now Launcher3.
Changes include
- moving from com.android.launcher{,2} to
com.android.launcher3
- removing wallpapers
- new temporary icon
Change-Id: I1eabd06059e94a8f3bdf6b620777bd1d2b7c212b
Diffstat (limited to 'src/com/android/launcher3/FastBitmapDrawable.java')
-rw-r--r-- | src/com/android/launcher3/FastBitmapDrawable.java | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java new file mode 100644 index 000000000..14760c7b6 --- /dev/null +++ b/src/com/android/launcher3/FastBitmapDrawable.java @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3; + +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.Paint; +import android.graphics.PixelFormat; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; + +class FastBitmapDrawable extends Drawable { + private Bitmap mBitmap; + private int mAlpha; + private int mWidth; + private int mHeight; + private final Paint mPaint = new Paint(Paint.FILTER_BITMAP_FLAG); + + FastBitmapDrawable(Bitmap b) { + mAlpha = 255; + mBitmap = b; + if (b != null) { + mWidth = mBitmap.getWidth(); + mHeight = mBitmap.getHeight(); + } else { + mWidth = mHeight = 0; + } + } + + @Override + public void draw(Canvas canvas) { + final Rect r = getBounds(); + // Draw the bitmap into the bounding rect + canvas.drawBitmap(mBitmap, null, r, mPaint); + } + + @Override + public void setColorFilter(ColorFilter cf) { + mPaint.setColorFilter(cf); + } + + @Override + public int getOpacity() { + return PixelFormat.TRANSLUCENT; + } + + @Override + public void setAlpha(int alpha) { + mAlpha = alpha; + mPaint.setAlpha(alpha); + } + + public void setFilterBitmap(boolean filterBitmap) { + mPaint.setFilterBitmap(filterBitmap); + } + + public int getAlpha() { + return mAlpha; + } + + @Override + public int getIntrinsicWidth() { + return mWidth; + } + + @Override + public int getIntrinsicHeight() { + return mHeight; + } + + @Override + public int getMinimumWidth() { + return mWidth; + } + + @Override + public int getMinimumHeight() { + return mHeight; + } + + public void setBitmap(Bitmap b) { + mBitmap = b; + if (b != null) { + mWidth = mBitmap.getWidth(); + mHeight = mBitmap.getHeight(); + } else { + mWidth = mHeight = 0; + } + } + + public Bitmap getBitmap() { + return mBitmap; + } +} |