diff options
author | Jason Sams <rjsams@android.com> | 2009-10-07 18:14:01 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-10-07 18:14:01 -0700 |
commit | bd2197fb0038acd2dc4b17ad3ed3c69cc29dcce2 (patch) | |
tree | af713f6ca8ae06bf5724932461ce98b0721c35af /graphics/java/android/renderscript/SimpleMesh.java | |
parent | dc2ccb82f96b6a7be7a7b262b81d3aa1422f46fa (diff) | |
download | frameworks_base-bd2197fb0038acd2dc4b17ad3ed3c69cc29dcce2.zip frameworks_base-bd2197fb0038acd2dc4b17ad3ed3c69cc29dcce2.tar.gz frameworks_base-bd2197fb0038acd2dc4b17ad3ed3c69cc29dcce2.tar.bz2 |
Add script to script call support. Add exception to catch out of bound index data when added to TriangleMeshBuilder.
Diffstat (limited to 'graphics/java/android/renderscript/SimpleMesh.java')
-rw-r--r-- | graphics/java/android/renderscript/SimpleMesh.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/graphics/java/android/renderscript/SimpleMesh.java b/graphics/java/android/renderscript/SimpleMesh.java index b422702..0ad093e 100644 --- a/graphics/java/android/renderscript/SimpleMesh.java +++ b/graphics/java/android/renderscript/SimpleMesh.java @@ -290,6 +290,11 @@ public class SimpleMesh extends BaseObj { } public void addTriangle(int idx1, int idx2, int idx3) { + if((idx1 >= mVtxCount) || (idx1 < 0) || + (idx2 >= mVtxCount) || (idx2 < 0) || + (idx3 >= mVtxCount) || (idx3 < 0)) { + throw new IllegalStateException("Index provided greater than vertex count."); + } if ((mIndexCount + 3) >= mIndexData.length) { short t[] = new short[mIndexData.length * 2]; System.arraycopy(mIndexData, 0, t, 0, mIndexData.length); |