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..232c8664239c505a7bbbb42d7dd8c3563269e371 100644 |
--- a/src/gpu/gl/angle/SkANGLEGLContext.cpp |
+++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp |
@@ -12,36 +12,6 @@ SkANGLEGLContext::SkANGLEGLContext() |
: fContext(EGL_NO_CONTEXT) |
, fDisplay(EGL_NO_DISPLAY) |
, fSurface(EGL_NO_SURFACE) { |
-} |
- |
-SkANGLEGLContext::~SkANGLEGLContext() { |
- this->destroyGLContext(); |
-} |
- |
-void SkANGLEGLContext::destroyGLContext() { |
- if (fDisplay) { |
- eglMakeCurrent(fDisplay, 0, 0, 0); |
- |
- if (fContext) { |
- eglDestroyContext(fDisplay, fContext); |
- fContext = EGL_NO_CONTEXT; |
- } |
- |
- if (fSurface) { |
- eglDestroySurface(fDisplay, fSurface); |
- fSurface = EGL_NO_SURFACE; |
- } |
- |
- //TODO should we close the display? |
- fDisplay = EGL_NO_DISPLAY; |
- } |
-} |
- |
-const GrGLInterface* SkANGLEGLContext::createGLContext(GrGLStandard forcedGpuAPI) { |
- if (kGL_GrGLStandard == forcedGpuAPI) { |
- return NULL; |
- } |
- |
fDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
EGLint majorVersion; |
@@ -78,14 +48,41 @@ const GrGLInterface* SkANGLEGLContext::createGLContext(GrGLStandard forcedGpuAPI |
eglMakeCurrent(fDisplay, fSurface, fSurface, fContext); |
- const GrGLInterface* interface = GrGLCreateANGLEInterface(); |
- if (NULL == interface) { |
+ fGL.reset(GrGLCreateANGLEInterface()); |
+ if (NULL == fGL.get()) { |
SkDebugf("Could not create ANGLE GL interface!\n"); |
this->destroyGLContext(); |
- return NULL; |
+ return; |
+ } |
+ if (!fGL->validate()) { |
+ SkDebugf("Could not validate ANGLE GL interface!\n"); |
+ this->destroyGLContext(); |
+ return; |
} |
+} |
- return interface; |
+SkANGLEGLContext::~SkANGLEGLContext() { |
+ this->destroyGLContext(); |
+} |
+ |
+void SkANGLEGLContext::destroyGLContext() { |
+ fGL.reset(NULL); |
+ if (fDisplay) { |
+ eglMakeCurrent(fDisplay, 0, 0, 0); |
+ |
+ if (fContext) { |
+ eglDestroyContext(fDisplay, fContext); |
+ fContext = EGL_NO_CONTEXT; |
+ } |
+ |
+ if (fSurface) { |
+ eglDestroySurface(fDisplay, fSurface); |
+ fSurface = EGL_NO_SURFACE; |
+ } |
+ |
+ //TODO should we close the display? |
+ fDisplay = EGL_NO_DISPLAY; |
+ } |
} |
void SkANGLEGLContext::makeCurrent() const { |