diff options
author | Stephen Hines <srhines@google.com> | 2014-06-19 03:26:15 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-06-19 03:26:15 +0000 |
commit | 7f22d0154532a2b65a3f300a25369bf66e3f6cf4 (patch) | |
tree | 21aa21500f6c5f3d5a59a0fd7c44fe82c828f95c /rs/java/android/renderscript/Allocation.java | |
parent | 6f2b8e55eebbaef7ac4ee95ccc7af6f92e5a5880 (diff) | |
parent | c5b11fcc1f4fc4fba988218d0a99a19690398a56 (diff) | |
download | frameworks_base-7f22d0154532a2b65a3f300a25369bf66e3f6cf4.zip frameworks_base-7f22d0154532a2b65a3f300a25369bf66e3f6cf4.tar.gz frameworks_base-7f22d0154532a2b65a3f300a25369bf66e3f6cf4.tar.bz2 |
am c5b11fcc: am ff83ed2d: am b02dadd4: Merge "Create FieldPacker.getPos() to get the actual amount of data used for FP."
* commit 'c5b11fcc1f4fc4fba988218d0a99a19690398a56':
Create FieldPacker.getPos() to get the actual amount of data used for FP.
Diffstat (limited to 'rs/java/android/renderscript/Allocation.java')
-rw-r--r-- | rs/java/android/renderscript/Allocation.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java index 2191b54..d9588e8 100644 --- a/rs/java/android/renderscript/Allocation.java +++ b/rs/java/android/renderscript/Allocation.java @@ -770,10 +770,11 @@ public class Allocation extends BaseObj { mRS.validate(); int eSize = mType.mElement.getBytesSize(); final byte[] data = fp.getData(); + int data_length = fp.getPos(); - int count = data.length / eSize; - if ((eSize * count) != data.length) { - throw new RSIllegalArgumentException("Field packer length " + data.length + + int count = data_length / eSize; + if ((eSize * count) != data_length) { + throw new RSIllegalArgumentException("Field packer length " + data_length + " not divisible by element size " + eSize + "."); } copy1DRangeFromUnchecked(xoff, count, data); @@ -797,16 +798,17 @@ public class Allocation extends BaseObj { } final byte[] data = fp.getData(); + int data_length = fp.getPos(); int eSize = mType.mElement.mElements[component_number].getBytesSize(); eSize *= mType.mElement.mArraySizes[component_number]; - if (data.length != eSize) { - throw new RSIllegalArgumentException("Field packer sizelength " + data.length + + if (data_length != eSize) { + throw new RSIllegalArgumentException("Field packer sizelength " + data_length + " does not match component size " + eSize + "."); } mRS.nAllocationElementData1D(getIDSafe(), xoff, mSelectedLOD, - component_number, data, data.length); + component_number, data, data_length); } private void data1DChecks(int off, int count, int len, int dataSize) { |