am 413adc92: Merge "Fix free after use with createFromBitmapResource" into jb-mr2-dev

* commit '413adc9260d700bd8143950951c4e1ad07cbeddf':
  Fix free after use with createFromBitmapResource
This commit is contained in:
Jason Sams
2013-06-01 08:23:22 -07:00
committed by Android Git Automerger

View File

@@ -1650,6 +1650,9 @@ public class Allocation extends BaseObj {
int usage) {
rs.validate();
if ((usage & (USAGE_SHARED | USAGE_IO_INPUT | USAGE_IO_OUTPUT)) != 0) {
throw new RSIllegalArgumentException("Unsupported usage specified.");
}
Bitmap b = BitmapFactory.decodeResource(res, id);
Allocation alloc = createFromBitmap(rs, b, mips, usage);
b.recycle();
@@ -1677,7 +1680,7 @@ public class Allocation extends BaseObj {
if (rs.getApplicationContext().getApplicationInfo().targetSdkVersion >= 18) {
return createFromBitmapResource(rs, res, id,
MipmapControl.MIPMAP_NONE,
USAGE_SHARED | USAGE_SCRIPT | USAGE_GRAPHICS_TEXTURE);
USAGE_SCRIPT | USAGE_GRAPHICS_TEXTURE);
}
return createFromBitmapResource(rs, res, id,
MipmapControl.MIPMAP_NONE,