summaryrefslogtreecommitdiff
path: root/cpp/Type.cpp
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2013-02-12 11:25:12 -0800
committerTim Murray <timmurray@google.com>2013-02-12 11:25:12 -0800
commit96267c2ff0133c20cc5643419a3ed3b1e75fe568 (patch)
tree530f1323c934d0986d39cfbcdb261e18b3f4b038 /cpp/Type.cpp
parent60c2796d821d9296003d4e5db025f8734d971a71 (diff)
downloadrs-96267c2ff0133c20cc5643419a3ed3b1e75fe568.tar.gz
Add convenient Type creator, alignment define, and fix USAGE_SHARED issue.
Change-Id: Ib344ed27feee95c9eddf4f58468ef3e29fdfabab
Diffstat (limited to 'cpp/Type.cpp')
-rw-r--r--cpp/Type.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpp/Type.cpp b/cpp/Type.cpp
index b2dfa238..0b473c4b 100644
--- a/cpp/Type.cpp
+++ b/cpp/Type.cpp
@@ -94,6 +94,22 @@ void Type::updateFromNative() {
*/
}
+sp<const Type> Type::create(sp<RS> rs, sp<const Element> e, uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ void * id = rsTypeCreate(rs->getContext(), e->getID(), dimX, dimY, dimZ, false, false, 0);
+ Type *t = new Type(id, rs);
+
+ t->mElement = e;
+ t->mDimX = dimX;
+ t->mDimY = dimY;
+ t->mDimZ = dimZ;
+ t->mDimMipmaps = false;
+ t->mDimFaces = false;
+
+ t->calcElementCount();
+
+ return t;
+}
+
Type::Builder::Builder(sp<RS> rs, sp<const Element> e) {
mRS = rs;
mElement = e;