diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-09-23 16:16:33 -0700 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-09-23 16:16:33 -0700 |
commit | b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17 (patch) | |
tree | 01a6a7c86f5b91018a81d74f16320ce1ed207445 /libs/rs/rsElement.cpp | |
parent | 5eb22e2ce1cb46d18ce0c8e68e10a7f64bed01ea (diff) | |
download | frameworks_base-b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17.zip frameworks_base-b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17.tar.gz frameworks_base-b89aaacb2ca9d062e0a17a32e3d4dbf3f6948a17.tar.bz2 |
Adding support for all allowed textures.
Cleaning up unused code
Adding error messages
Change-Id: I3a92476738ff7699d49feeafcd3eee6f70621acb
Diffstat (limited to 'libs/rs/rsElement.cpp')
-rw-r--r-- | libs/rs/rsElement.cpp | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp index d0909c8..0b9e28c 100644 --- a/libs/rs/rsElement.cpp +++ b/libs/rs/rsElement.cpp @@ -138,37 +138,10 @@ Element *Element::createFromStream(Context *rsc, IStream *stream) // We need to check if this already exists for (uint32_t ct=0; ct < rsc->mStateElement.mElements.size(); ct++) { Element *ee = rsc->mStateElement.mElements[ct]; - - if (!ee->getFieldCount() ) { - - if((ee->getComponent().getType() == elem->getComponent().getType()) && - (ee->getComponent().getKind() == elem->getComponent().getKind()) && - (ee->getComponent().getIsNormalized() == elem->getComponent().getIsNormalized()) && - (ee->getComponent().getVectorSize() == elem->getComponent().getVectorSize())) { - // Match - delete elem; - ee->incUserRef(); - return ee; - } - - } else if (ee->getFieldCount() == elem->mFieldCount) { - - bool match = true; - for (uint32_t i=0; i < elem->mFieldCount; i++) { - if ((ee->mFields[i].e.get() != elem->mFields[i].e.get()) || - (ee->mFields[i].name.length() != elem->mFields[i].name.length()) || - (ee->mFields[i].name != elem->mFields[i].name) || - (ee->mFields[i].arraySize != elem->mFields[i].arraySize)) { - match = false; - break; - } - } - if (match) { - delete elem; - ee->incUserRef(); - return ee; - } - + if(ee->isEqual(elem)) { + delete elem; + ee->incUserRef(); + return ee; } } @@ -176,6 +149,32 @@ Element *Element::createFromStream(Context *rsc, IStream *stream) return elem; } +bool Element::isEqual(const Element *other) const { + if(other == NULL) { + return false; + } + if (!other->getFieldCount() && !mFieldCount) { + if((other->getType() == getType()) && + (other->getKind() == getKind()) && + (other->getComponent().getIsNormalized() == getComponent().getIsNormalized()) && + (other->getComponent().getVectorSize() == getComponent().getVectorSize())) { + return true; + } + return false; + } + if (other->getFieldCount() == mFieldCount) { + for (uint32_t i=0; i < mFieldCount; i++) { + if ((!other->mFields[i].e->isEqual(mFields[i].e.get())) || + (other->mFields[i].name.length() != mFields[i].name.length()) || + (other->mFields[i].name != mFields[i].name) || + (other->mFields[i].arraySize != mFields[i].arraySize)) { + return false; + } + } + return true; + } + return false; +} const Element * Element::create(Context *rsc, RsDataType dt, RsDataKind dk, bool isNorm, uint32_t vecSize) |