summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-08-24 10:15:51 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-08-24 10:15:51 -0700
commit104422039b2dc5ced7e341e067a5a80e6534218b (patch)
treeb49d70e09bfe8646fa964b6a4d44da29db86e840
parent4077d7a75d78b3824c8d652e02efc56e04c7ee05 (diff)
parent5a14271aacb932ba0d52978c939f74e4c685f7d6 (diff)
downloadframeworks_base-104422039b2dc5ced7e341e067a5a80e6534218b.zip
frameworks_base-104422039b2dc5ced7e341e067a5a80e6534218b.tar.gz
frameworks_base-104422039b2dc5ced7e341e067a5a80e6534218b.tar.bz2
am 5a14271a: am d6f7f225: Merge "Load bitmaps in the correct format." into gingerbread
Merge commit '5a14271aacb932ba0d52978c939f74e4c685f7d6' * commit '5a14271aacb932ba0d52978c939f74e4c685f7d6': Load bitmaps in the correct format.
-rw-r--r--graphics/java/android/renderscript/Allocation.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java
index f1f673b..6775c08 100644
--- a/graphics/java/android/renderscript/Allocation.java
+++ b/graphics/java/android/renderscript/Allocation.java
@@ -395,6 +395,17 @@ public class Allocation extends BaseObj {
static public Allocation createFromBitmapResourceBoxed(RenderScript rs, Resources res, int id, Element dstFmt, boolean genMips)
throws IllegalArgumentException {
+ mBitmapOptions.inPreferredConfig = null;
+ if (dstFmt == rs.mElement_RGBA_8888) {
+ mBitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
+ } else if (dstFmt == rs.mElement_RGB_888) {
+ mBitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
+ } else if (dstFmt == rs.mElement_RGBA_4444) {
+ mBitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_4444;
+ } else if (dstFmt == rs.mElement_RGB_565) {
+ mBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;
+ }
+
Bitmap b = BitmapFactory.decodeResource(res, id, mBitmapOptions);
return createFromBitmapBoxed(rs, b, dstFmt, genMips);
}