src/video/directfb/SDL_DirectFB_opengl.c
changeset 7191 75360622e65f
parent 7037 3fedf1f25b94
child 8093 b43765095a6f
     1.1 --- a/src/video/directfb/SDL_DirectFB_opengl.c	Sat May 18 12:48:50 2013 -0700
     1.2 +++ b/src/video/directfb/SDL_DirectFB_opengl.c	Sat May 18 14:17:52 2013 -0700
     1.3 @@ -40,7 +40,7 @@
     1.4      int gl_active;              /* to stop switching drivers while we have a valid context */
     1.5      int initialized;
     1.6      DirectFB_GLContext *firstgl;        /* linked list */
     1.7 -    
     1.8 +
     1.9      /* OpenGL */
    1.10      void (*glFinish) (void);
    1.11      void (*glFlush) (void);
    1.12 @@ -49,13 +49,13 @@
    1.13  #define OPENGL_REQUIRS_DLOPEN
    1.14  #if defined(OPENGL_REQUIRS_DLOPEN) && defined(SDL_LOADSO_DLOPEN)
    1.15  #include <dlfcn.h>
    1.16 -#define GL_LoadObject(X)	dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
    1.17 -#define GL_LoadFunction		dlsym
    1.18 -#define GL_UnloadObject		dlclose
    1.19 +#define GL_LoadObject(X)    dlopen(X, (RTLD_NOW|RTLD_GLOBAL))
    1.20 +#define GL_LoadFunction     dlsym
    1.21 +#define GL_UnloadObject     dlclose
    1.22  #else
    1.23 -#define GL_LoadObject	SDL_LoadObject
    1.24 -#define GL_LoadFunction	SDL_LoadFunction
    1.25 -#define GL_UnloadObject	SDL_UnloadObject
    1.26 +#define GL_LoadObject   SDL_LoadObject
    1.27 +#define GL_LoadFunction SDL_LoadFunction
    1.28 +#define GL_UnloadObject SDL_UnloadObject
    1.29  #endif
    1.30  
    1.31  static void DirectFB_GL_UnloadLibrary(_THIS);
    1.32 @@ -107,8 +107,6 @@
    1.33  int
    1.34  DirectFB_GL_LoadLibrary(_THIS, const char *path)
    1.35  {
    1.36 -    //SDL_DFB_DEVICEDATA(_this);
    1.37 -
    1.38      void *handle = NULL;
    1.39  
    1.40      SDL_DFB_DEBUG("Loadlibrary : %s\n", path);
    1.41 @@ -181,7 +179,6 @@
    1.42  SDL_GLContext
    1.43  DirectFB_GL_CreateContext(_THIS, SDL_Window * window)
    1.44  {
    1.45 -    //SDL_DFB_DEVICEDATA(_this);
    1.46      SDL_DFB_WINDOWDATA(window);
    1.47      DirectFB_GLContext *context;
    1.48  
    1.49 @@ -195,7 +192,7 @@
    1.50  
    1.51      context->is_locked = 0;
    1.52      context->sdl_window = window;
    1.53 -    
    1.54 +
    1.55      context->next = _this->gl_data->firstgl;
    1.56      _this->gl_data->firstgl = context;
    1.57  
    1.58 @@ -215,7 +212,6 @@
    1.59  int
    1.60  DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
    1.61  {
    1.62 -    //SDL_DFB_WINDOWDATA(window);
    1.63      DirectFB_GLContext *ctx = (DirectFB_GLContext *) context;
    1.64      DirectFB_GLContext *p;
    1.65  
    1.66 @@ -225,7 +221,7 @@
    1.67           SDL_DFB_CHECKERR(p->context->Unlock(p->context));
    1.68           p->is_locked = 0;
    1.69         }
    1.70 -        
    1.71 +
    1.72      }
    1.73  
    1.74      if (ctx != NULL) {
    1.75 @@ -253,7 +249,6 @@
    1.76  void
    1.77  DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
    1.78  {
    1.79 -    //SDL_DFB_DEVICEDATA(_this);
    1.80      SDL_DFB_WINDOWDATA(window);
    1.81      DFBRegion region;
    1.82      DirectFB_GLContext *p;
    1.83 @@ -270,20 +265,14 @@
    1.84          devdata->glFlush();
    1.85  #endif
    1.86  
    1.87 -  	for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
    1.88 +    for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
    1.89          if (p->sdl_window == window && p->is_locked)
    1.90          {
    1.91              SDL_DFB_CHECKERR(p->context->Unlock(p->context));
    1.92              p->is_locked = 0;
    1.93 -        }            
    1.94 +        }
    1.95  
    1.96      SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL,  DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC ));
    1.97 -
    1.98 -    //if (windata->gl_context) {
    1.99 -        //SDL_DFB_CHECKERR(windata->surface->Flip(windata->surface,NULL, DSFLIP_ONSYNC)); 
   1.100 -        //SDL_DFB_CHECKERR(windata->gl_context->context->Lock(windata->gl_context->context));
   1.101 -    //}
   1.102 -
   1.103      return;
   1.104    error:
   1.105      return;
   1.106 @@ -313,14 +302,14 @@
   1.107  DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window)
   1.108  {
   1.109      DirectFB_GLContext *p;
   1.110 -    
   1.111 -	for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
   1.112 -	    if (p->sdl_window == window)
   1.113 -	    {
   1.114 -	    	if (p->is_locked)
   1.115 -	        	SDL_DFB_CHECK(p->context->Unlock(p->context));
   1.116 -	        SDL_DFB_RELEASE(p->context);
   1.117 -	    }
   1.118 +
   1.119 +    for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
   1.120 +        if (p->sdl_window == window)
   1.121 +        {
   1.122 +            if (p->is_locked)
   1.123 +                SDL_DFB_CHECK(p->context->Unlock(p->context));
   1.124 +            SDL_DFB_RELEASE(p->context);
   1.125 +        }
   1.126  }
   1.127  
   1.128  void
   1.129 @@ -328,15 +317,15 @@
   1.130  {
   1.131      DirectFB_GLContext *p;
   1.132  
   1.133 -	for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
   1.134 -	    if (p->sdl_window == window)
   1.135 -	    {
   1.136 +    for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
   1.137 +        if (p->sdl_window == window)
   1.138 +        {
   1.139              SDL_DFB_WINDOWDATA(window);
   1.140 -			SDL_DFB_CHECK(windata->surface->GetGL(windata->surface,
   1.141 -	                                         &p->context));
   1.142 -    		if (p->is_locked)
   1.143 -            	SDL_DFB_CHECK(p->context->Lock(p->context));
   1.144 -	        }
   1.145 +            SDL_DFB_CHECK(windata->surface->GetGL(windata->surface,
   1.146 +                                             &p->context));
   1.147 +            if (p->is_locked)
   1.148 +                SDL_DFB_CHECK(p->context->Lock(p->context));
   1.149 +            }
   1.150  }
   1.151  
   1.152  void
   1.153 @@ -344,9 +333,9 @@
   1.154  {
   1.155      DirectFB_GLContext *p;
   1.156  
   1.157 -	for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
   1.158 -		if (p->sdl_window == window)
   1.159 -			DirectFB_GL_DeleteContext(_this, p);
   1.160 +    for (p = _this->gl_data->firstgl; p != NULL; p = p->next)
   1.161 +        if (p->sdl_window == window)
   1.162 +            DirectFB_GL_DeleteContext(_this, p);
   1.163  }
   1.164  
   1.165  #endif