Special case EGL_BAD_SURFACE
Bug: 17516789
Change-Id: I3dcb10360c2aef6326f7dbbff6815866d4c143b6
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 5e6796c..832d170 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -91,7 +91,9 @@
}
void CanvasContext::swapBuffers() {
- mEglManager.swapBuffers(mEglSurface);
+ if (CC_UNLIKELY(!mEglManager.swapBuffers(mEglSurface))) {
+ setSurface(NULL);
+ }
mHaveNewSurface = false;
}
@@ -102,8 +104,8 @@
}
bool CanvasContext::initialize(ANativeWindow* window) {
- if (mCanvas) return false;
setSurface(window);
+ if (mCanvas) return false;
mCanvas = new OpenGLRenderer(mRenderThread.renderState());
mCanvas->initProperties();
return true;