src/video/SDL_video.c
changeset 2743 453ec0c21f6f
parent 2740 22c96d28449f
child 2744 1aede15771d0
     1.1 --- a/src/video/SDL_video.c	Tue Sep 02 19:53:56 2008 +0000
     1.2 +++ b/src/video/SDL_video.c	Tue Sep 02 20:05:33 2008 +0000
     1.3 @@ -27,19 +27,11 @@
     1.4  #include "SDL_sysvideo.h"
     1.5  #include "SDL_blit.h"
     1.6  #include "SDL_pixels_c.h"
     1.7 -
     1.8 -
     1.9  #include "SDL_renderer_gl.h"
    1.10 -#include "SDL_renderer_gles.h"
    1.11 -
    1.12  #include "SDL_renderer_sw.h"
    1.13  #include "../events/SDL_sysevents.h"
    1.14  #include "../events/SDL_events_c.h"
    1.15  
    1.16 -#if SDL_VIDEO_OPENGL_ES
    1.17 -#include "SDL_opengles.h"
    1.18 -#endif /* SDL_VIDEO_OPENGL_ES */
    1.19 -
    1.20  #if SDL_VIDEO_OPENGL
    1.21  #include "SDL_opengl.h"
    1.22  
    1.23 @@ -111,8 +103,8 @@
    1.24  #if SDL_VIDEO_DRIVER_OS2FS
    1.25      &OS2FSLib_bootstrap,
    1.26  #endif
    1.27 -#if SDL_VIDEO_DRIVER_UIKIT
    1.28 -	&UIKIT_bootstrap,
    1.29 +#if SDL_VIDEO_DRIVER_NDS
    1.30 +    &NDS_bootstrap,
    1.31  #endif
    1.32  #if SDL_VIDEO_DRIVER_DUMMY
    1.33      &DUMMY_bootstrap,
    1.34 @@ -254,7 +246,6 @@
    1.35      _this->gl_config.stereo = 0;
    1.36      _this->gl_config.multisamplebuffers = 0;
    1.37      _this->gl_config.multisamplesamples = 0;
    1.38 -	_this->gl_config.retained_backing = 1; /* most systems have retained backing on the color buffers */
    1.39      _this->gl_config.accelerated = -1;  /* not known, don't set */
    1.40  
    1.41      /* Initialize the video subsystem */
    1.42 @@ -275,10 +266,6 @@
    1.43  #if SDL_VIDEO_RENDER_OGL
    1.44          SDL_AddRenderDriver(i, &GL_RenderDriver);
    1.45  #endif
    1.46 -		
    1.47 -#if SDL_VIDEO_RENDER_OGL_ES
    1.48 -		SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
    1.49 -#endif
    1.50          if (_this->displays[i].num_render_drivers > 0) {
    1.51              SDL_AddRenderDriver(i, &SW_RenderDriver);
    1.52          }
    1.53 @@ -1426,9 +1413,7 @@
    1.54  
    1.55      if (index < 0) {
    1.56          const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
    1.57 -        		
    1.58 -		int n = SDL_GetNumRenderDrivers();
    1.59 -				
    1.60 +        int n = SDL_GetNumRenderDrivers();
    1.61          for (index = 0; index < n; ++index) {
    1.62              SDL_RenderDriver *driver =
    1.63                  &SDL_CurrentDisplay.render_drivers[index];
    1.64 @@ -1461,7 +1446,6 @@
    1.65      /* Create a new renderer instance */
    1.66      window->renderer = SDL_CurrentDisplay.render_drivers[index]
    1.67          .CreateRenderer(window, flags);
    1.68 -	
    1.69      SDL_SelectRenderer(window->id);
    1.70  
    1.71      return 0;
    1.72 @@ -1565,7 +1549,7 @@
    1.73      }
    1.74      fmt = surface->format;
    1.75  
    1.76 -    if (format) { /* if we were passed in a format */
    1.77 +    if (format) {
    1.78          if (!SDL_PixelFormatEnumToMasks
    1.79              (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
    1.80              SDL_SetError("Unknown pixel format");
    1.81 @@ -1575,7 +1559,7 @@
    1.82          if (surface->format->Amask
    1.83              || !(surface->map->info.flags &
    1.84                   (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
    1.85 -			bpp = fmt->BitsPerPixel;
    1.86 +            bpp = fmt->BitsPerPixel;
    1.87              Rmask = fmt->Rmask;
    1.88              Gmask = fmt->Gmask;
    1.89              Bmask = fmt->Bmask;
    1.90 @@ -1595,7 +1579,8 @@
    1.91          }
    1.92      }
    1.93  
    1.94 -    textureID = SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
    1.95 +    textureID =
    1.96 +        SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
    1.97                            surface->h);
    1.98      if (!textureID) {
    1.99          return 0;
   1.100 @@ -1630,8 +1615,9 @@
   1.101                      SDL_DitherColors(dst_fmt->palette->colors,
   1.102                                       SDL_BITSPERPIXEL(format));
   1.103                  }
   1.104 -            }			
   1.105 -			dst = SDL_ConvertSurface(surface, dst_fmt, 0);
   1.106 +            }
   1.107 +
   1.108 +            dst = SDL_ConvertSurface(surface, dst_fmt, 0);
   1.109              if (dst) {
   1.110                  SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
   1.111                  SDL_FreeSurface(dst);
   1.112 @@ -1645,7 +1631,7 @@
   1.113              SDL_DestroyTexture(textureID);
   1.114              return 0;
   1.115          }
   1.116 -	}
   1.117 +    }
   1.118  
   1.119      if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
   1.120          SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
   1.121 @@ -2013,7 +1999,6 @@
   1.122  int
   1.123  SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
   1.124  {
   1.125 -		
   1.126      SDL_Renderer *renderer;
   1.127      SDL_Window *window;
   1.128      SDL_Rect real_rect;
   1.129 @@ -2299,9 +2284,8 @@
   1.130  SDL_bool
   1.131  SDL_GL_ExtensionSupported(const char *extension)
   1.132  {
   1.133 -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
   1.134 -	
   1.135 -	const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
   1.136 +#if SDL_VIDEO_OPENGL
   1.137 +    const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
   1.138      const char *extensions;
   1.139      const char *start;
   1.140      const char *where, *terminator;
   1.141 @@ -2356,7 +2340,7 @@
   1.142  int
   1.143  SDL_GL_SetAttribute(SDL_GLattr attr, int value)
   1.144  {
   1.145 -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
   1.146 +#if SDL_VIDEO_OPENGL
   1.147      int retval;
   1.148  
   1.149      if (!_this) {
   1.150 @@ -2414,9 +2398,6 @@
   1.151      case SDL_GL_ACCELERATED_VISUAL:
   1.152          _this->gl_config.accelerated = value;
   1.153          break;
   1.154 -	case SDL_GL_RETAINED_BACKING:
   1.155 -		_this->gl_config.retained_backing = value;
   1.156 -		break;
   1.157      default:
   1.158          SDL_SetError("Unknown OpenGL attribute");
   1.159          retval = -1;
   1.160 @@ -2432,7 +2413,7 @@
   1.161  int
   1.162  SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
   1.163  {
   1.164 -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
   1.165 +#if SDL_VIDEO_OPENGL
   1.166      void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
   1.167      GLenum attrib = 0;
   1.168  
   1.169 @@ -2441,9 +2422,6 @@
   1.170          return -1;
   1.171      }
   1.172      switch (attr) {
   1.173 -	case SDL_GL_RETAINED_BACKING:
   1.174 -		*value = _this->gl_config.retained_backing;
   1.175 -		return 0;
   1.176      case SDL_GL_RED_SIZE:
   1.177          attrib = GL_RED_BITS;
   1.178          break;
   1.179 @@ -2457,22 +2435,14 @@
   1.180          attrib = GL_ALPHA_BITS;
   1.181          break;
   1.182      case SDL_GL_DOUBLEBUFFER:
   1.183 -	#ifndef SDL_VIDEO_OPENGL_ES
   1.184          attrib = GL_DOUBLEBUFFER;
   1.185          break;
   1.186 -	#else
   1.187 -		/* I believe double buffering is the only option in OpenGL ES
   1.188 -		   -- in any case, GL_DOUBLEBUFFER doesn't exist */
   1.189 -		*value = 1;
   1.190 -		return 0;
   1.191 -	#endif
   1.192      case SDL_GL_DEPTH_SIZE:
   1.193          attrib = GL_DEPTH_BITS;
   1.194          break;
   1.195      case SDL_GL_STENCIL_SIZE:
   1.196          attrib = GL_STENCIL_BITS;
   1.197          break;
   1.198 -#ifndef SDL_VIDEO_OPENGL_ES
   1.199      case SDL_GL_ACCUM_RED_SIZE:
   1.200          attrib = GL_ACCUM_RED_BITS;
   1.201          break;
   1.202 @@ -2485,33 +2455,15 @@
   1.203      case SDL_GL_ACCUM_ALPHA_SIZE:
   1.204          attrib = GL_ACCUM_ALPHA_BITS;
   1.205          break;
   1.206 -	case SDL_GL_STEREO:
   1.207 -		attrib = GL_STEREO;
   1.208 -		break;
   1.209 -#else
   1.210 -	    case SDL_GL_ACCUM_RED_SIZE:
   1.211 -		case SDL_GL_ACCUM_GREEN_SIZE:
   1.212 -		case SDL_GL_ACCUM_BLUE_SIZE:
   1.213 -		case SDL_GL_ACCUM_ALPHA_SIZE:
   1.214 -		case SDL_GL_STEREO:
   1.215 -			/* none of these are supported in OpenGL ES */
   1.216 -			*value = 0;
   1.217 -			return 0;
   1.218 -#endif
   1.219 -		case SDL_GL_MULTISAMPLEBUFFERS:
   1.220 -		#ifndef SDL_VIDEO_OPENGL_ES
   1.221 -			attrib = GL_SAMPLE_BUFFERS_ARB;
   1.222 -		#else
   1.223 -			attrib = GL_SAMPLE_BUFFERS;
   1.224 -		#endif
   1.225 -			break;
   1.226 -		case SDL_GL_MULTISAMPLESAMPLES:
   1.227 -		#ifndef SDL_VIDEO_OPENGL_ES
   1.228 -			attrib = GL_SAMPLES_ARB;
   1.229 -		#else
   1.230 -			attrib = GL_SAMPLES;
   1.231 -		#endif
   1.232 -			break;
   1.233 +    case SDL_GL_STEREO:
   1.234 +        attrib = GL_STEREO;
   1.235 +        break;
   1.236 +    case SDL_GL_MULTISAMPLEBUFFERS:
   1.237 +        attrib = GL_SAMPLE_BUFFERS_ARB;
   1.238 +        break;
   1.239 +    case SDL_GL_MULTISAMPLESAMPLES:
   1.240 +        attrib = GL_SAMPLES_ARB;
   1.241 +        break;
   1.242      case SDL_GL_BUFFER_SIZE:
   1.243          {
   1.244              GLint bits = 0;
   1.245 @@ -2558,6 +2510,7 @@
   1.246          return NULL;
   1.247      }
   1.248      if (!(window->flags & SDL_WINDOW_OPENGL)) {
   1.249 +        SDL_SetError("The specified window isn't an OpenGL window");
   1.250          return NULL;
   1.251      }
   1.252      return _this->GL_CreateContext(_this, window);
   1.253 @@ -2616,7 +2569,6 @@
   1.254      SDL_Window *window = SDL_GetWindowFromID(windowID);
   1.255  
   1.256      if (!window) {
   1.257 -		SDL_SetError("The specified window doesn't exist");
   1.258          return;
   1.259      }
   1.260      if (!(window->flags & SDL_WINDOW_OPENGL)) {