Merge "Revert "Make NDC not block forever and handle restart.""
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index fa4dd25..1e92b43 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -723,6 +723,7 @@
@Override
public void drawPatch(Bitmap bitmap, byte[] chunks, RectF dst, Paint paint) {
+ if (bitmap.isRecycled()) throw new IllegalArgumentException("Cannot draw recycled bitmaps");
// Shaders are ignored when drawing patches
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
@@ -736,6 +737,7 @@
@Override
public void drawBitmap(Bitmap bitmap, float left, float top, Paint paint) {
+ if (bitmap.isRecycled()) throw new IllegalArgumentException("Cannot draw recycled bitmaps");
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
@@ -748,6 +750,7 @@
@Override
public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {
+ if (bitmap.isRecycled()) throw new IllegalArgumentException("Cannot draw recycled bitmaps");
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
@@ -761,6 +764,7 @@
@Override
public void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint) {
+ if (bitmap.isRecycled()) throw new IllegalArgumentException("Cannot draw recycled bitmaps");
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
@@ -784,6 +788,7 @@
@Override
public void drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint) {
+ if (bitmap.isRecycled()) throw new IllegalArgumentException("Cannot draw recycled bitmaps");
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
final int nativePaint = paint == null ? 0 : paint.mNativePaint;
@@ -832,6 +837,7 @@
@Override
public void drawBitmapMesh(Bitmap bitmap, int meshWidth, int meshHeight, float[] verts,
int vertOffset, int[] colors, int colorOffset, Paint paint) {
+ if (bitmap.isRecycled()) throw new IllegalArgumentException("Cannot draw recycled bitmaps");
if (meshWidth < 0 || meshHeight < 0 || vertOffset < 0 || colorOffset < 0) {
throw new ArrayIndexOutOfBoundsException();
}
diff --git a/libs/rs/rsg_generator.c b/libs/rs/rsg_generator.c
index 7a90597..385c8b5 100644
--- a/libs/rs/rsg_generator.c
+++ b/libs/rs/rsg_generator.c
@@ -465,7 +465,14 @@
fprintf(f, ");\n");
if (hasInlineDataPointers(api)) {
- fprintf(f, " if (cmdSizeBytes == sizeof(RS_CMD_%s)) {\n", api->name);
+ fprintf(f, " size_t totalSize = 0;\n");
+ for (ct2=0; ct2 < api->paramCount; ct2++) {
+ if (api->params[ct2].ptrLevel) {
+ fprintf(f, " totalSize += cmd->%s_length;\n", api->params[ct2].name);
+ }
+ }
+
+ fprintf(f, " if ((totalSize != 0) && (cmdSizeBytes == sizeof(RS_CMD_%s))) {\n", api->name);
fprintf(f, " con->mIO.coreSetReturn(NULL, 0);\n");
fprintf(f, " }\n");
} else if (api->ret.typeName[0]) {