diff options
| author | Jason Sams <jsams@google.com> | 2012-03-23 11:47:26 -0700 |
|---|---|---|
| committer | Jason Sams <jsams@google.com> | 2012-03-23 11:47:26 -0700 |
| commit | fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b (patch) | |
| tree | 7a3135d31e4415a4b6b31c7e44ad15cfa1ccc86f /libs/rs/rsAllocation.cpp | |
| parent | 3da5525558ad84757c48907eead66f44f0f5dd32 (diff) | |
| download | frameworks_base-fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b.zip frameworks_base-fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b.tar.gz frameworks_base-fe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b.tar.bz2 | |
Implement USAGE_IO_INPUT
Change-Id: Idbf7bb21f5ab673ad77082c5c19921d2b276c04b
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); |
