Merge "Restore MAX_BITMAP_SIZE"
This commit is contained in:
committed by
Android (Google) Code Review
commit
f2ed00dad6
@@ -39,6 +39,8 @@ public final class RecordingCanvas extends BaseRecordingCanvas {
|
||||
// view hierarchy because display lists are generated recursively.
|
||||
private static final int POOL_LIMIT = 25;
|
||||
|
||||
private static final int MAX_BITMAP_SIZE = 100 * 1024 * 1024; // 100 MB
|
||||
|
||||
private static final SynchronizedPool<RecordingCanvas> sPool =
|
||||
new SynchronizedPool<>(POOL_LIMIT);
|
||||
|
||||
@@ -260,6 +262,18 @@ public final class RecordingCanvas extends BaseRecordingCanvas {
|
||||
paint.getNativeContainer());
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@Override
|
||||
protected void throwIfCannotDraw(Bitmap bitmap) {
|
||||
super.throwIfCannotDraw(bitmap);
|
||||
int bitmapSize = bitmap.getByteCount();
|
||||
if (bitmapSize > MAX_BITMAP_SIZE) {
|
||||
throw new RuntimeException(
|
||||
"Canvas: trying to draw too large(" + bitmapSize + "bytes) bitmap.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------ Fast JNI ------------------------
|
||||
|
||||
@FastNative
|
||||
|
||||
Reference in New Issue
Block a user