diff options
author | Romain Guy <romainguy@google.com> | 2010-08-20 15:43:52 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2010-08-20 15:43:52 -0700 |
commit | f92a0a6d4e95660b0e7ebe259323de17d821c50f (patch) | |
tree | 4e7f76e8b061d964ffec1d1b0a226467398cf2e0 /graphics/java/android | |
parent | 300b0b7e2b8f0ab922e4a83755ae999da191894e (diff) | |
download | frameworks_base-f92a0a6d4e95660b0e7ebe259323de17d821c50f.zip frameworks_base-f92a0a6d4e95660b0e7ebe259323de17d821c50f.tar.gz frameworks_base-f92a0a6d4e95660b0e7ebe259323de17d821c50f.tar.bz2 |
Load bitmaps in the correct format.
Bug #2936873
Change-Id: Ide93ffd8227cea6c610dde625163ccffb4590e90
Diffstat (limited to 'graphics/java/android')
-rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 17c0778..b27c7f5 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -363,6 +363,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); } |