summaryrefslogtreecommitdiff
path: root/libs/rs/rsAllocation.cpp
diff options
context:
space:
mode:
author Jason Sams <jsams@google.com> 2012-03-23 13:29:17 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2012-03-23 13:29:17 -0700
commitcbe55a1c93056cf2878007ebf823a0ac2ad168b1 (patch)
treeb47661d230ddd4699ffc01ae8e9e02f806beee90 /libs/rs/rsAllocation.cpp
parent3c4da3cad04ca878a4a37fcca3f3e2ff51d03fcb (diff)
parentfe1d5ffd1b6c4977a9f301997d2ad90e5b049a3b (diff)
Merge "Implement USAGE_IO_INPUT"
Diffstat (limited to 'libs/rs/rsAllocation.cpp')
-rw-r--r--libs/rs/rsAllocation.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index a404c49cb1aa..cdff49c5ec24 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);