/**
 * Default fallback routine - drivers should usually override this.
 */
EGLBoolean
_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
{
   _EGLContext *context = _eglLookupContext(ctx);
   if (context) {
      _eglHashRemove(_eglGlobal.Contexts, ctx);
      if (context->IsBound) {
         context->DeletePending = EGL_TRUE;
      }
      else {
         free(context);
      }
      return EGL_TRUE;
   }
   else {
      _eglError(EGL_BAD_CONTEXT, "eglDestroyContext");
      return EGL_TRUE;
   }
}
Beispiel #2
0
static EGLBoolean
xlib_eglDestroySurface(_EGLDriver *drv, EGLDisplay dpy, EGLSurface surface)
{
   struct xlib_egl_surface *surf = lookup_surface(surface);
   if (surf) {
      _eglHashRemove(_eglGlobal.Surfaces, (EGLuint) surface);
      if (surf->Base.IsBound) {
         surf->Base.DeletePending = EGL_TRUE;
      }
      else {
         XFreeGC(surf->Dpy, surf->Gc);
         st_unreference_framebuffer(&surf->Framebuffer);
         free(surf);
      }
      return EGL_TRUE;
   }
   else {
      _eglError(EGL_BAD_SURFACE, "eglDestroySurface");
      return EGL_FALSE;
   }
}
/**
 * Remove the given _EGLContext object from the hash table.
 */
void
_eglRemoveContext(_EGLContext *ctx)
{
   _eglHashRemove(_eglGlobal.Contexts, ctx->Handle);
}