diff options
| author | 2012-02-02 14:56:34 -0800 | |
|---|---|---|
| committer | 2012-02-02 14:56:34 -0800 | |
| commit | 98bea4a3ec6dfd0f5c6ec612b57b122f16f49b7f (patch) | |
| tree | 877115f9e72c9e1c2ec0b45ff30f455cef0494c8 | |
| parent | 8d1c18a181df7d141e8e341e8b120caf3717a506 (diff) | |
| parent | 7042613c653fd0de253f2f659901318902fa4584 (diff) | |
am 7042613c: Merge "Fix an incorrect assert that doesn\'t account for element array size."
* commit '7042613c653fd0de253f2f659901318902fa4584':
Fix an incorrect assert that doesn't account for element array size.
| -rw-r--r-- | graphics/java/android/renderscript/Allocation.java | 1 | ||||
| -rw-r--r-- | libs/rs/rsAllocation.cpp | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/graphics/java/android/renderscript/Allocation.java b/graphics/java/android/renderscript/Allocation.java index 0ea48210402a..88ee3626027c 100644 --- a/graphics/java/android/renderscript/Allocation.java +++ b/graphics/java/android/renderscript/Allocation.java @@ -532,6 +532,7 @@ public class Allocation extends BaseObj { final byte[] data = fp.getData(); int eSize = mType.mElement.mElements[component_number].getSizeBytes(); + eSize *= mType.mElement.mArraySizes[component_number]; if (data.length != eSize) { throw new RSIllegalArgumentException("Field packer sizelength " + data.length + diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index 1dc36b7be5e4..02c680939de3 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -125,7 +125,8 @@ void Allocation::elementData(Context *rsc, uint32_t x, const void *data, } const Element * e = mHal.state.type->getElement()->getField(cIdx); - if (sizeBytes != e->getSizeBytes()) { + uint32_t elemArraySize = mHal.state.type->getElement()->getFieldArraySize(cIdx); + if (sizeBytes != e->getSizeBytes() * elemArraySize) { ALOGE("Error Allocation::subElementData data size %zu does not match field size %zu.", sizeBytes, e->getSizeBytes()); rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size."); return; @@ -158,8 +159,8 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y, } const Element * e = mHal.state.type->getElement()->getField(cIdx); - - if (sizeBytes != e->getSizeBytes()) { + uint32_t elemArraySize = mHal.state.type->getElement()->getFieldArraySize(cIdx); + if (sizeBytes != e->getSizeBytes() * elemArraySize) { ALOGE("Error Allocation::subElementData data size %zu does not match field size %zu.", sizeBytes, e->getSizeBytes()); rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size."); return; |