Merge commit '5a14271aacb932ba0d52978c939f74e4c685f7d6' * commit '5a14271aacb932ba0d52978c939f74e4c685f7d6': Load bitmaps in the correct format.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user