diff options
Diffstat (limited to 'libs/rs/rsAllocation.cpp')
-rw-r--r-- | libs/rs/rsAllocation.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index a404c49..cdff49c 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -20,6 +20,7 @@ #include "rs_hal.h" #include "system/window.h" +#include "gui/SurfaceTexture.h" using namespace android; using namespace android::renderscript; @@ -64,6 +65,7 @@ void Allocation::updateCache() { Allocation::~Allocation() { freeChildrenUnlocked(); + setSurfaceTexture(mRSC, NULL); mRSC->mHal.funcs.allocation.destroy(mRSC, this); } @@ -424,6 +426,18 @@ int32_t Allocation::getSurfaceTextureID(const Context *rsc) { return id; } +void Allocation::setSurfaceTexture(const Context *rsc, SurfaceTexture *st) { + if(st != mHal.state.surfaceTexture) { + if(mHal.state.surfaceTexture != NULL) { + mHal.state.surfaceTexture->decStrong(NULL); + } + mHal.state.surfaceTexture = st; + if(mHal.state.surfaceTexture != NULL) { + mHal.state.surfaceTexture->incStrong(NULL); + } + } +} + void Allocation::setSurface(const Context *rsc, RsNativeWindow sur) { ANativeWindow *nw = (ANativeWindow *)sur; ANativeWindow *old = mHal.state.wndSurface; @@ -696,6 +710,11 @@ int32_t rsi_AllocationGetSurfaceTextureID(Context *rsc, RsAllocation valloc) { return alloc->getSurfaceTextureID(rsc); } +void rsi_AllocationGetSurfaceTextureID2(Context *rsc, RsAllocation valloc, void *vst, size_t len) { + Allocation *alloc = static_cast<Allocation *>(valloc); + alloc->setSurfaceTexture(rsc, static_cast<SurfaceTexture *>(vst)); +} + void rsi_AllocationSetSurface(Context *rsc, RsAllocation valloc, RsNativeWindow sur) { Allocation *alloc = static_cast<Allocation *>(valloc); alloc->setSurface(rsc, sur); |