summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp10
-rw-r--r--libs/hwui/renderthread/CanvasContext.h2
-rw-r--r--libs/hwui/renderthread/RenderProxy.cpp12
-rw-r--r--libs/hwui/renderthread/RenderProxy.h2
4 files changed, 26 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index a848c8f..4e665d9 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -462,6 +462,16 @@ void CanvasContext::queueFunctorsTask(int delayMs) {
mRenderThread.queueDelayed(&mInvokeFunctorsTask, delayMs);
}
+void CanvasContext::runWithGlContext(RenderTask* task) {
+ if (mEglSurface != EGL_NO_SURFACE) {
+ mGlobalContext->makeCurrent(mEglSurface);
+ } else {
+ mGlobalContext->usePBufferSurface();
+ }
+
+ task->run();
+}
+
} /* namespace renderthread */
} /* namespace uirenderer */
} /* namespace android */
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 2daa905..3197df3 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -65,6 +65,8 @@ public:
void attachFunctor(Functor* functor);
void detachFunctor(Functor* functor);
+ void runWithGlContext(RenderTask* task);
+
private:
void setSurface(EGLNativeWindowType window);
void swapBuffers();
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 25badac..34f1961 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -170,6 +170,18 @@ void RenderProxy::detachFunctor(Functor* functor) {
post(task);
}
+CREATE_BRIDGE2(runWithGlContext, CanvasContext* context, RenderTask* task) {
+ args->context->runWithGlContext(args->task);
+ return NULL;
+}
+
+void RenderProxy::runWithGlContext(RenderTask* gltask) {
+ SETUP_TASK(runWithGlContext);
+ args->context = mContext;
+ args->task = gltask;
+ postAndWait(task);
+}
+
MethodInvokeRenderTask* RenderProxy::createTask(RunnableMethod method) {
// TODO: Consider having a small pool of these to avoid alloc churn
return new MethodInvokeRenderTask(method);
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 113c5a8..1ad0c2d 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -62,6 +62,8 @@ public:
ANDROID_API void attachFunctor(Functor* functor);
ANDROID_API void detachFunctor(Functor* functor);
+ ANDROID_API void runWithGlContext(RenderTask* task);
+
private:
RenderThread& mRenderThread;
CanvasContext* mContext;