Ensure there's a GL context before creating a Layer
Bug: 13745587
Change-Id: Ib0ec059d9a5974a48734daeec9d83580cada94a3
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index fa82627..c231f6f 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -490,6 +490,16 @@
task->run();
}
+Layer* CanvasContext::createRenderLayer(int width, int height) {
+ requireGlContext();
+ return LayerRenderer::createRenderLayer(width, height);
+}
+
+Layer* CanvasContext::createTextureLayer() {
+ requireGlContext();
+ return LayerRenderer::createTextureLayer();
+}
+
void CanvasContext::requireGlContext() {
if (mEglSurface != EGL_NO_SURFACE) {
mGlobalContext->makeCurrent(mEglSurface);