Index: src/gpu/gl/angle/SkANGLEGLContext.cpp |
diff --git a/src/gpu/gl/angle/SkANGLEGLContext.cpp b/src/gpu/gl/angle/SkANGLEGLContext.cpp |
index 4914ba55333d70df73ccac437b940ac0db7b6085..81fccebba0cf08a9932d67a1a88abe1be89d0f41 100644 |
--- a/src/gpu/gl/angle/SkANGLEGLContext.cpp |
+++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp |
@@ -7,6 +7,21 @@ |
*/ |
#include "gl/SkANGLEGLContext.h" |
+ |
+SkANGLEGLContext::AutoContextRestore::AutoContextRestore() { |
+ fOldEGLContext = eglGetCurrentContext(); |
+ fOldDisplay = eglGetCurrentDisplay(); |
+ fOldSurface = eglGetCurrentSurface(EGL_DRAW); |
+ |
+} |
+ |
+SkANGLEGLContext::AutoContextRestore::~AutoContextRestore() { |
+ if (fOldDisplay) { |
+ eglMakeCurrent(fOldDisplay, fOldSurface, fOldSurface, fOldEGLContext); |
+ } |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
SkANGLEGLContext::SkANGLEGLContext() |
: fContext(EGL_NO_CONTEXT) |