From bf3c3f2ab1067b647038170cb201cdd1a9a1c6d2 Mon Sep 17 00:00:00 2001 From: Alex Sakhartchouk Date: Thu, 2 Feb 2012 09:47:26 -0800 Subject: Fix an incorrect assert that doesn't account for element array size. Change-Id: Ibcb5c55d91967603391a1721137d010a85025990 --- libs/rs/rsAllocation.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libs/rs/rsAllocation.cpp') diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index 972e3d655115..fd85b077a493 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -124,7 +124,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; @@ -157,8 +158,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; -- cgit v1.2.3-59-g8ed1b