diff options
Diffstat (limited to 'libs/rs/rsElement.cpp')
| -rw-r--r-- | libs/rs/rsElement.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp index 71e1b91..56c31b6 100644 --- a/libs/rs/rsElement.cpp +++ b/libs/rs/rsElement.cpp @@ -23,6 +23,7 @@ using namespace android::renderscript; Element::Element(Context *rsc) : ObjectBase(rsc) { mBits = 0; + mBitsUnpadded = 0; mFields = NULL; mFieldCount = 0; mHasReference = false; @@ -60,13 +61,25 @@ size_t Element::getSizeBits() const { return total; } +size_t Element::getSizeBitsUnpadded() const { + if (!mFieldCount) { + return mBitsUnpadded; + } + + size_t total = 0; + for (size_t ct=0; ct < mFieldCount; ct++) { + total += mFields[ct].e->mBitsUnpadded * mFields[ct].arraySize; + } + return total; +} + void Element::dumpLOGV(const char *prefix) const { ObjectBase::dumpLOGV(prefix); - LOGV("%s Element: fieldCount: %zu, size bytes: %zu", prefix, mFieldCount, getSizeBytes()); + ALOGV("%s Element: fieldCount: %zu, size bytes: %zu", prefix, mFieldCount, getSizeBytes()); mComponent.dumpLOGV(prefix); for (uint32_t ct = 0; ct < mFieldCount; ct++) { - LOGV("%s Element field index: %u ------------------", prefix, ct); - LOGV("%s name: %s, offsetBits: %u, arraySize: %u", + ALOGV("%s Element field index: %u ------------------", prefix, ct); + ALOGV("%s name: %s, offsetBits: %u, arraySize: %u", prefix, mFields[ct].name.string(), mFields[ct].offsetBits, mFields[ct].arraySize); mFields[ct].e->dumpLOGV(prefix); } @@ -146,14 +159,18 @@ Element *Element::createFromStream(Context *rsc, IStream *stream) { void Element::compute() { if (mFieldCount == 0) { mBits = mComponent.getBits(); + mBitsUnpadded = mComponent.getBitsUnpadded(); mHasReference = mComponent.isReference(); return; } size_t bits = 0; + size_t bitsUnpadded = 0; for (size_t ct=0; ct < mFieldCount; ct++) { mFields[ct].offsetBits = bits; + mFields[ct].offsetBitsUnpadded = bitsUnpadded; bits += mFields[ct].e->getSizeBits() * mFields[ct].arraySize; + bitsUnpadded += mFields[ct].e->getSizeBitsUnpadded() * mFields[ct].arraySize; if (mFields[ct].e->mHasReference) { mHasReference = true; |
