diff options
Diffstat (limited to 'gfx/gl/GLContextProviderEAGL.mm')
-rw-r--r-- | gfx/gl/GLContextProviderEAGL.mm | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/gfx/gl/GLContextProviderEAGL.mm b/gfx/gl/GLContextProviderEAGL.mm index 507616e2f..11c7cce77 100644 --- a/gfx/gl/GLContextProviderEAGL.mm +++ b/gfx/gl/GLContextProviderEAGL.mm @@ -36,35 +36,24 @@ GLContextEAGL::GLContextEAGL(CreateContextFlags flags, const SurfaceCaps& caps, GLContextEAGL::~GLContextEAGL() { - MakeCurrent(); - - if (mBackbufferFB) { - fDeleteFramebuffers(1, &mBackbufferFB); - } - - if (mBackbufferRB) { - fDeleteRenderbuffers(1, &mBackbufferRB); + if (MakeCurrent()) { + if (mBackbufferFB) { + fDeleteFramebuffers(1, &mBackbufferFB); + } + if (mBackbufferRB) { + fDeleteRenderbuffers(1, &mBackbufferRB); + } } + mLayer = nil; MarkDestroyed(); - - if (mLayer) { - mLayer = nil; - } - - if (mContext) { - [EAGLContext setCurrentContext:nil]; - [mContext release]; - } + [mContext release]; } bool GLContextEAGL::Init() { - if (!InitWithPrefix("gl", true)) - return false; - - return true; + return InitWithPrefix("gl", true); } bool @@ -120,12 +109,12 @@ GLContextEAGL::MakeCurrentImpl(bool aForce) return true; } - if (mContext) { - if(![EAGLContext setCurrentContext:mContext]) { - return false; - } + if (IsDestroyed()) { + [EAGLContext setCurrentContext:nil]; + return false; } - return true; + + return [EAGLContext setCurrentContext:mContext]; } bool |