summaryrefslogtreecommitdiffstats
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp6
1 files changed, 4 insertions, 2 deletions
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::setSurface(ANativeWindow* window) {
}
void CanvasContext::swapBuffers() {
- mEglManager.swapBuffers(mEglSurface);
+ if (CC_UNLIKELY(!mEglManager.swapBuffers(mEglSurface))) {
+ setSurface(NULL);
+ }
mHaveNewSurface = false;
}
@@ -102,8 +104,8 @@ void CanvasContext::requireSurface() {
}
bool CanvasContext::initialize(ANativeWindow* window) {
- if (mCanvas) return false;
setSurface(window);
+ if (mCanvas) return false;
mCanvas = new OpenGLRenderer(mRenderThread.renderState());
mCanvas->initProperties();
return true;