Merge "Native crash -> ISE" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f0bc25e44d
@@ -401,8 +401,9 @@ public final class Bitmap implements Parcelable {
|
||||
/**
|
||||
* This is called by methods that want to throw an exception if the bitmap
|
||||
* has already been recycled.
|
||||
* @hide
|
||||
*/
|
||||
private void checkRecycled(String errorMessage) {
|
||||
void checkRecycled(String errorMessage) {
|
||||
if (mRecycled) {
|
||||
throw new IllegalStateException(errorMessage);
|
||||
}
|
||||
|
||||
@@ -120,6 +120,7 @@ public class BitmapShader extends Shader {
|
||||
if (bitmap == null) {
|
||||
throw new IllegalArgumentException("Bitmap must be non-null");
|
||||
}
|
||||
bitmap.checkRecycled("Cannot create BitmapShader for recycled bitmap");
|
||||
mBitmap = bitmap;
|
||||
mTileX = tileX;
|
||||
mTileY = tileY;
|
||||
@@ -188,6 +189,8 @@ public class BitmapShader extends Shader {
|
||||
/** @hide */
|
||||
@Override
|
||||
protected long createNativeInstance(long nativeMatrix, boolean filterFromPaint) {
|
||||
mBitmap.checkRecycled("BitmapShader's bitmap has been recycled");
|
||||
|
||||
boolean enableLinearFilter = mFilterMode == FILTER_MODE_LINEAR;
|
||||
if (mFilterMode == FILTER_MODE_DEFAULT) {
|
||||
mFilterFromPaint = filterFromPaint;
|
||||
|
||||
Reference in New Issue
Block a user