src/video/haiku/SDL_bopengl.cc
changeset 10690 23a825f341e6
parent 9998 f67cf37e9cd4
child 10737 3406a0f8b041
     1.1 --- a/src/video/haiku/SDL_bopengl.cc	Fri Dec 09 01:29:52 2016 -0800
     1.2 +++ b/src/video/haiku/SDL_bopengl.cc	Fri Dec 09 01:47:43 2016 -0800
     1.3 @@ -38,40 +38,40 @@
     1.4  #define BGL_FLAGS BGL_RGB | BGL_DOUBLE
     1.5  
     1.6  static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
     1.7 -	return ((SDL_BWin*)(window->driverdata));
     1.8 +    return ((SDL_BWin*)(window->driverdata));
     1.9  }
    1.10  
    1.11  static SDL_INLINE SDL_BApp *_GetBeApp() {
    1.12 -	return ((SDL_BApp*)be_app);
    1.13 +    return ((SDL_BApp*)be_app);
    1.14  }
    1.15  
    1.16  /* Passing a NULL path means load pointers from the application */
    1.17  int BE_GL_LoadLibrary(_THIS, const char *path)
    1.18  {
    1.19  /* FIXME: Is this working correctly? */
    1.20 -	image_info info;
    1.21 -			int32 cookie = 0;
    1.22 -	while (get_next_image_info(0, &cookie, &info) == B_OK) {
    1.23 -		void *location = NULL;
    1.24 -		if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
    1.25 -				&location) == B_OK) {
    1.26 +    image_info info;
    1.27 +            int32 cookie = 0;
    1.28 +    while (get_next_image_info(0, &cookie, &info) == B_OK) {
    1.29 +        void *location = NULL;
    1.30 +        if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY,
    1.31 +                &location) == B_OK) {
    1.32  
    1.33 -			_this->gl_config.dll_handle = (void *) info.id;
    1.34 -			_this->gl_config.driver_loaded = 1;
    1.35 -			SDL_strlcpy(_this->gl_config.driver_path, "libGL.so",
    1.36 -					SDL_arraysize(_this->gl_config.driver_path));
    1.37 -		}
    1.38 -	}
    1.39 -	return 0;
    1.40 +            _this->gl_config.dll_handle = (void *) info.id;
    1.41 +            _this->gl_config.driver_loaded = 1;
    1.42 +            SDL_strlcpy(_this->gl_config.driver_path, "libGL.so",
    1.43 +                    SDL_arraysize(_this->gl_config.driver_path));
    1.44 +        }
    1.45 +    }
    1.46 +    return 0;
    1.47  }
    1.48  
    1.49  void *BE_GL_GetProcAddress(_THIS, const char *proc)
    1.50  {
    1.51 -	if (_this->gl_config.dll_handle != NULL) {
    1.52 -		void *location = NULL;
    1.53 -		status_t err;
    1.54 -		if ((err =
    1.55 -			get_image_symbol((image_id) _this->gl_config.dll_handle,
    1.56 +    if (_this->gl_config.dll_handle != NULL) {
    1.57 +        void *location = NULL;
    1.58 +        status_t err;
    1.59 +        if ((err =
    1.60 +            get_image_symbol((image_id) _this->gl_config.dll_handle,
    1.61                                proc, B_SYMBOL_TYPE_ANY,
    1.62                                &location)) == B_OK) {
    1.63              return location;
    1.64 @@ -79,52 +79,53 @@
    1.65                  SDL_SetError("Couldn't find OpenGL symbol");
    1.66                  return NULL;
    1.67          }
    1.68 -	} else {
    1.69 -		SDL_SetError("OpenGL library not loaded");
    1.70 -		return NULL;
    1.71 -	}
    1.72 +    } else {
    1.73 +        SDL_SetError("OpenGL library not loaded");
    1.74 +        return NULL;
    1.75 +    }
    1.76  }
    1.77  
    1.78  
    1.79  
    1.80  
    1.81 -void BE_GL_SwapWindow(_THIS, SDL_Window * window) {
    1.82 +int BE_GL_SwapWindow(_THIS, SDL_Window * window) {
    1.83      _ToBeWin(window)->SwapBuffers();
    1.84 +    return 0;
    1.85  }
    1.86  
    1.87  int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) {
    1.88 -	_GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
    1.89 -	return 0;
    1.90 +    _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView());
    1.91 +    return 0;
    1.92  }
    1.93  
    1.94  
    1.95  SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) {
    1.96 -	/* FIXME: Not sure what flags should be included here; may want to have
    1.97 -	   most of them */
    1.98 -	SDL_BWin *bwin = _ToBeWin(window);
    1.99 -	bwin->CreateGLView(BGL_FLAGS);
   1.100 -	return (SDL_GLContext)(bwin);
   1.101 +    /* FIXME: Not sure what flags should be included here; may want to have
   1.102 +       most of them */
   1.103 +    SDL_BWin *bwin = _ToBeWin(window);
   1.104 +    bwin->CreateGLView(BGL_FLAGS);
   1.105 +    return (SDL_GLContext)(bwin);
   1.106  }
   1.107  
   1.108  void BE_GL_DeleteContext(_THIS, SDL_GLContext context) {
   1.109 -	/* Currently, automatically unlocks the view */
   1.110 -	((SDL_BWin*)context)->RemoveGLView();
   1.111 +    /* Currently, automatically unlocks the view */
   1.112 +    ((SDL_BWin*)context)->RemoveGLView();
   1.113  }
   1.114  
   1.115  
   1.116  int BE_GL_SetSwapInterval(_THIS, int interval) {
   1.117 -	/* TODO: Implement this, if necessary? */
   1.118 -	return 0;
   1.119 +    /* TODO: Implement this, if necessary? */
   1.120 +    return 0;
   1.121  }
   1.122  
   1.123  int BE_GL_GetSwapInterval(_THIS) {
   1.124 -	/* TODO: Implement this, if necessary? */
   1.125 -	return 0;
   1.126 +    /* TODO: Implement this, if necessary? */
   1.127 +    return 0;
   1.128  }
   1.129  
   1.130  
   1.131  void BE_GL_UnloadLibrary(_THIS) {
   1.132 -	/* TODO: Implement this, if necessary? */
   1.133 +    /* TODO: Implement this, if necessary? */
   1.134  }
   1.135  
   1.136  
   1.137 @@ -132,17 +133,17 @@
   1.138     mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not
   1.139     currently in use. */
   1.140  void BE_GL_RebootContexts(_THIS) {
   1.141 -	SDL_Window *window = _this->windows;
   1.142 -	while(window) {
   1.143 -		SDL_BWin *bwin = _ToBeWin(window);
   1.144 -		if(bwin->GetGLView()) {
   1.145 -			bwin->LockLooper();
   1.146 -			bwin->RemoveGLView();
   1.147 -			bwin->CreateGLView(BGL_FLAGS);
   1.148 -			bwin->UnlockLooper();
   1.149 -		}
   1.150 -		window = window->next;
   1.151 -	}
   1.152 +    SDL_Window *window = _this->windows;
   1.153 +    while(window) {
   1.154 +        SDL_BWin *bwin = _ToBeWin(window);
   1.155 +        if(bwin->GetGLView()) {
   1.156 +            bwin->LockLooper();
   1.157 +            bwin->RemoveGLView();
   1.158 +            bwin->CreateGLView(BGL_FLAGS);
   1.159 +            bwin->UnlockLooper();
   1.160 +        }
   1.161 +        window = window->next;
   1.162 +    }
   1.163  }
   1.164  
   1.165  
   1.166 @@ -217,3 +218,5 @@
   1.167  #endif
   1.168  
   1.169  #endif /* SDL_VIDEO_DRIVER_HAIKU */
   1.170 +
   1.171 +/* vi: set ts=4 sw=4 expandtab: */