// Destroy the specified rendering context. EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { EGL_API_ENTRY("%p, %p", dpy, ctx); EglDisplayImpl* display = EglDisplayImpl::GetDisplay(dpy); if (display == NULL || display->IsInitialized() == false) { SetError(EGL_BAD_DISPLAY); return EGL_FALSE; } ContextPtr context = display->GetContexts().Get(ctx); if (context == NULL) { return EGL_BAD_CONTEXT; } if (GetContext() == context) { display->MakeCurrent(EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE); } context->Release(); display->GetContexts().Unregister(ctx); return EGL_TRUE; }