More cleanups
Change-Id: Id5967944b949a2aec57e4fe9fdcdc04c11b8c35a
diff --git a/libs/hwui/DeferredLayerUpdater.cpp b/libs/hwui/DeferredLayerUpdater.cpp
index 02b0372..836de45 100644
--- a/libs/hwui/DeferredLayerUpdater.cpp
+++ b/libs/hwui/DeferredLayerUpdater.cpp
@@ -119,5 +119,13 @@
}
}
+void DeferredLayerUpdater::detachSurfaceTexture() {
+ if (mSurfaceTexture.get()) {
+ mSurfaceTexture->detachFromContext();
+ mSurfaceTexture = 0;
+ mLayer->clearTexture();
+ }
+}
+
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/DeferredLayerUpdater.h b/libs/hwui/DeferredLayerUpdater.h
index 5905b95..c838c32 100644
--- a/libs/hwui/DeferredLayerUpdater.h
+++ b/libs/hwui/DeferredLayerUpdater.h
@@ -81,6 +81,8 @@
return mLayer;
}
+ ANDROID_API void detachSurfaceTexture();
+
private:
// Generic properties
uint32_t mWidth;
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index f90a26a..e1ee620 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -301,6 +301,17 @@
mDrawFrameTask.removeLayerUpdate(layer);
}
+CREATE_BRIDGE1(detachSurfaceTexture, DeferredLayerUpdater* layer) {
+ args->layer->detachSurfaceTexture();
+ return NULL;
+}
+
+void RenderProxy::detachSurfaceTexture(DeferredLayerUpdater* layer) {
+ SETUP_TASK(detachSurfaceTexture);
+ args->layer = layer;
+ postAndWait(task);
+}
+
CREATE_BRIDGE2(flushCaches, CanvasContext* context, Caches::FlushMode flushMode) {
args->context->flushCaches(args->flushMode);
return NULL;
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index df0aff0..c7358e6 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -83,6 +83,7 @@
ANDROID_API bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap);
ANDROID_API void pushLayerUpdate(DeferredLayerUpdater* layer);
ANDROID_API void cancelLayerUpdate(DeferredLayerUpdater* layer);
+ ANDROID_API void detachSurfaceTexture(DeferredLayerUpdater* layer);
ANDROID_API void flushCaches(Caches::FlushMode flushMode);