summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-08-12 12:49:17 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-08-12 12:49:17 -0700
commit4199175ff34c7c15120c3cc3714d454d84e7afcf (patch)
treed56d8c03c841832cb0fba9401527d5f17722a411 /libs/rs
parent6f99270cbe2d3385962a895d387f9024b829bc22 (diff)
parentee73498ddf896f6ed003e9ce1fab87aefda90173 (diff)
downloadframeworks_base-4199175ff34c7c15120c3cc3714d454d84e7afcf.zip
frameworks_base-4199175ff34c7c15120c3cc3714d454d84e7afcf.tar.gz
frameworks_base-4199175ff34c7c15120c3cc3714d454d84e7afcf.tar.bz2
Merge "Fix field packer bug for U32 data. Fix initial refcounts in allocations. Support null references in allocations."
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rsAllocation.cpp3
-rw-r--r--libs/rs/rsElement.cpp4
2 files changed, 5 insertions, 2 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 7d31bd6..7e44fea 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -34,6 +34,9 @@ Allocation::Allocation(Context *rsc, const Type *type) : ObjectBase(rsc)
init(rsc, type);
mPtr = malloc(mType->getSizeBytes());
+ if (mType->getElement()->getHasReferences()) {
+ memset(mPtr, 0, mType->getSizeBytes());
+ }
if (!mPtr) {
LOGE("Allocation::Allocation, alloc failure");
}
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 5dee1fb..2602dd4 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -266,7 +266,7 @@ void Element::incRefs(const void *ptr) const
if (mComponent.isReference()) {
ObjectBase *const*obp = static_cast<ObjectBase *const*>(ptr);
ObjectBase *ob = obp[0];
- ob->incSysRef();
+ if (ob) ob->incSysRef();
}
return;
}
@@ -285,7 +285,7 @@ void Element::decRefs(const void *ptr) const
if (mComponent.isReference()) {
ObjectBase *const*obp = static_cast<ObjectBase *const*>(ptr);
ObjectBase *ob = obp[0];
- ob->decSysRef();
+ if (ob) ob->decSysRef();
}
return;
}