summaryrefslogtreecommitdiff
path: root/libs/rs/rsProgramVertex.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2009-09-25 16:37:33 -0700
committer Jason Sams <rjsams@android.com> 2009-09-25 16:37:33 -0700
commit61f08d6fa7c7657e9fbcd17e9a1c5b9114bb3844 (patch)
treee836663efc3047198d5aef1723cee4e5556fe8c4 /libs/rs/rsProgramVertex.cpp
parent66b2771d745aa66df5cf80b300b5ba0f936ff22e (diff)
Improved object lifecycle tracking and fix leaks.
Diffstat (limited to 'libs/rs/rsProgramVertex.cpp')
-rw-r--r--libs/rs/rsProgramVertex.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index 9eb32ff269df..9bfa6022ae6e 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -27,6 +27,8 @@ using namespace android::renderscript;
ProgramVertex::ProgramVertex(Context *rsc, Element *in, Element *out) :
Program(rsc, in, out)
{
+ mAllocFile = __FILE__;
+ mAllocLine = __LINE__;
mTextureMatrixEnable = false;
mLightCount = 0;
}
@@ -139,10 +141,10 @@ void ProgramVertexState::init(Context *rsc, int32_t w, int32_t h)
rsi_TypeBegin(rsc, e);
rsi_TypeAdd(rsc, RS_DIMENSION_X, 48);
- mAllocType = rsi_TypeCreate(rsc);
+ mAllocType.set((Type *)rsi_TypeCreate(rsc));
ProgramVertex *pv = new ProgramVertex(rsc, NULL, NULL);
- Allocation *alloc = (Allocation *)rsi_AllocationCreateTyped(rsc, mAllocType);
+ Allocation *alloc = (Allocation *)rsi_AllocationCreateTyped(rsc, mAllocType.get());
mDefaultAlloc.set(alloc);
mDefault.set(pv);
@@ -156,6 +158,16 @@ void ProgramVertexState::init(Context *rsc, int32_t w, int32_t h)
alloc->subData(RS_PROGRAM_VERTEX_MODELVIEW_OFFSET, 16, &m.m[0], 16*4);
}
+void ProgramVertexState::deinit(Context *rsc)
+{
+ mDefaultAlloc.clear();
+ mDefault.clear();
+ mAllocType.clear();
+ mLast.clear();
+ delete mPV;
+ mPV = NULL;
+}
+
namespace android {
namespace renderscript {