Load bitmaps in the correct format.

Bug #2936873

Change-Id: Ide93ffd8227cea6c610dde625163ccffb4590e90
This commit is contained in:
Romain Guy
2010-08-20 15:43:52 -07:00
parent 300b0b7e2b
commit f92a0a6d4e

View File

@@ -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);
}