--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj Mon Sep 15 04:31:30 2008 +0000
+++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj Mon Sep 15 04:32:36 2008 +0000
@@ -673,7 +673,7 @@
0014B89A09C0DAAE003A99D5 /* Xvlibint.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Xvlibint.h; sourceTree = "<group>"; };
0014B89F09C0DAB9003A99D5 /* Xinerama.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = Xinerama.c; sourceTree = "<group>"; };
0014B8A209C0DAC4003A99D5 /* xme.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = xme.c; sourceTree = "<group>"; };
- 0014B9A909C0E585003A99D5 /* Info-FrameworkNoX11.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-FrameworkNoX11.plist"; sourceTree = "<group>"; };
+ 0014B9A909C0E585003A99D5 /* Info-FrameworkNoX11.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-FrameworkNoX11.plist"; sourceTree = "<group>"; };
00162D3409BD1FA90037C8D0 /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_config_macosx.h; path = ../../include/SDL_config_macosx.h; sourceTree = SOURCE_ROOT; };
00162D3709BD1FA90037C8D0 /* SDL_config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_config.h; path = ../../include/SDL_config.h; sourceTree = SOURCE_ROOT; };
00162D3809BD1FA90037C8D0 /* SDL_platform.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_platform.h; path = ../../include/SDL_platform.h; sourceTree = SOURCE_ROOT; };
@@ -791,7 +791,7 @@
B2CF8DC705C4450500E5DC7F /* SDL_name.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = SDL_name.h; path = ../../include/SDL_name.h; sourceTree = SOURCE_ROOT; };
BECDF5D50761B759005FE872 /* SDL_coreaudio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_coreaudio.c; sourceTree = "<group>"; };
BECDF5D60761B759005FE872 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = "<group>"; };
- BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
+ BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = "<group>"; };
BECDF66C0761BA81005FE872 /* SDL.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL.framework; sourceTree = BUILT_PRODUCTS_DIR; };
BECDF6B30761BA81005FE872 /* libSDL.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL.a; sourceTree = BUILT_PRODUCTS_DIR; };
BECDF6BE0761BA81005FE872 /* Standard DMG */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Standard DMG"; sourceTree = BUILT_PRODUCTS_DIR; };
--- a/include/SDL_opengles.h Mon Sep 15 04:31:30 2008 +0000
+++ b/include/SDL_opengles.h Mon Sep 15 04:32:36 2008 +0000
@@ -32,19 +32,20 @@
/* $Id: gl.h 4533 2007-11-26 11:19:35Z markc $ */
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
-
+
#ifndef APIENTRY
#define APIENTRY
-#endif
-
+#endif
+
#ifndef GL_APIENTRY
#define GL_APIENTRY
-#endif
-
-
+#endif
+
+
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
@@ -79,24 +80,24 @@
** compliant with the OpenGL(R) version 1.2.1 Specification.
*/
-typedef unsigned int GLenum;
-typedef unsigned char GLboolean;
-typedef unsigned int GLbitfield;
-typedef signed char GLbyte;
-typedef short GLshort;
-typedef int GLint;
-typedef int GLsizei;
-typedef unsigned char GLubyte;
-typedef unsigned short GLushort;
-typedef unsigned int GLuint;
-typedef float GLfloat;
-typedef float GLclampf;
-typedef void GLvoid;
-typedef int GLfixed;
-typedef int GLclampx;
+ typedef unsigned int GLenum;
+ typedef unsigned char GLboolean;
+ typedef unsigned int GLbitfield;
+ typedef signed char GLbyte;
+ typedef short GLshort;
+ typedef int GLint;
+ typedef int GLsizei;
+ typedef unsigned char GLubyte;
+ typedef unsigned short GLushort;
+ typedef unsigned int GLuint;
+ typedef float GLfloat;
+ typedef float GLclampf;
+ typedef void GLvoid;
+ typedef int GLfixed;
+ typedef int GLclampx;
-typedef int GLintptr;
-typedef int GLsizeiptr;
+ typedef int GLintptr;
+ typedef int GLsizeiptr;
/*************************************************************/
@@ -654,152 +655,262 @@
/*************************************************************/
/* Available only in Common profile */
-GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLclampf ref);
-GL_API void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-GL_API void GL_APIENTRY glClearDepthf (GLclampf depth);
-GL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation);
-GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_API void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar);
-GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat eqn[4]);
-GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glLineWidth (GLfloat width);
-GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
-GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
-GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
-GL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar);
-GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glPointSize (GLfloat size);
-GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
+ GL_API void GL_APIENTRY glAlphaFunc(GLenum func, GLclampf ref);
+ GL_API void GL_APIENTRY glClearColor(GLclampf red, GLclampf green,
+ GLclampf blue, GLclampf alpha);
+ GL_API void GL_APIENTRY glClearDepthf(GLclampf depth);
+ GL_API void GL_APIENTRY glClipPlanef(GLenum plane,
+ const GLfloat * equation);
+ GL_API void GL_APIENTRY glColor4f(GLfloat red, GLfloat green,
+ GLfloat blue, GLfloat alpha);
+ GL_API void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar);
+ GL_API void GL_APIENTRY glFogf(GLenum pname, GLfloat param);
+ GL_API void GL_APIENTRY glFogfv(GLenum pname, const GLfloat * params);
+ GL_API void GL_APIENTRY glFrustumf(GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar);
+ GL_API void GL_APIENTRY glGetClipPlanef(GLenum pname, GLfloat eqn[4]);
+ GL_API void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat * params);
+ GL_API void GL_APIENTRY glGetLightfv(GLenum light, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glGetMaterialfv(GLenum face, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glGetTexEnvfv(GLenum env, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname,
+ GLfloat * params);
+ GL_API void GL_APIENTRY glLightModelf(GLenum pname, GLfloat param);
+ GL_API void GL_APIENTRY glLightModelfv(GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glLightf(GLenum light, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glLightfv(GLenum light, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glLineWidth(GLfloat width);
+ GL_API void GL_APIENTRY glLoadMatrixf(const GLfloat * m);
+ GL_API void GL_APIENTRY glMaterialf(GLenum face, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glMaterialfv(GLenum face, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glMultMatrixf(const GLfloat * m);
+ GL_API void GL_APIENTRY glMultiTexCoord4f(GLenum target, GLfloat s,
+ GLfloat t, GLfloat r,
+ GLfloat q);
+ GL_API void GL_APIENTRY glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz);
+ GL_API void GL_APIENTRY glOrthof(GLfloat left, GLfloat right,
+ GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar);
+ GL_API void GL_APIENTRY glPointParameterf(GLenum pname, GLfloat param);
+ GL_API void GL_APIENTRY glPointParameterfv(GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glPointSize(GLfloat size);
+ GL_API void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units);
+ GL_API void GL_APIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y,
+ GLfloat z);
+ GL_API void GL_APIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z);
+ GL_API void GL_APIENTRY glTexEnvf(GLenum target, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glTexEnvfv(GLenum target, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname,
+ GLfloat param);
+ GL_API void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname,
+ const GLfloat * params);
+ GL_API void GL_APIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z);
/* Available in both Common and Common-Lite profiles */
-GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref);
-GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
-GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
-GL_API void GL_APIENTRY glClear (GLbitfield mask);
-GL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha);
-GL_API void GL_APIENTRY glClearDepthx (GLclampx depth);
-GL_API void GL_APIENTRY glClearStencil (GLint s);
-GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
-GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
-GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glCullFace (GLenum mode);
-GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GL_API void GL_APIENTRY glDepthFunc (GLenum func);
-GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar);
-GL_API void GL_APIENTRY glDisable (GLenum cap);
-GL_API void GL_APIENTRY glDisableClientState (GLenum array);
-GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
-GL_API void GL_APIENTRY glEnable (GLenum cap);
-GL_API void GL_APIENTRY glEnableClientState (GLenum array);
-GL_API void GL_APIENTRY glFinish (void);
-GL_API void GL_APIENTRY glFlush (void);
-GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glFrontFace (GLenum mode);
-GL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *params);
-GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed eqn[4]);
-GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GL_API GLenum GL_APIENTRY glGetError (void);
-GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
-GL_API const GLubyte * GL_APIENTRY glGetString (GLenum name);
-GL_API void GL_APIENTRY glGetTexEnviv (GLenum env, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
-GL_API void GL_APIENTRY glLoadIdentity (void);
-GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
-GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
-GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
-GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
-GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
-GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar);
-GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glPointSizex (GLfixed size);
-GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
-GL_API void GL_APIENTRY glPopMatrix (void);
-GL_API void GL_APIENTRY glPushMatrix (void);
-GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
-GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert);
-GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
-GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glShadeModel (GLenum mode);
-GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_API void GL_APIENTRY glStencilMask (GLuint mask);
-GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
+ GL_API void GL_APIENTRY glActiveTexture(GLenum texture);
+ GL_API void GL_APIENTRY glAlphaFuncx(GLenum func, GLclampx ref);
+ GL_API void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer);
+ GL_API void GL_APIENTRY glBindTexture(GLenum target, GLuint texture);
+ GL_API void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor);
+ GL_API void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size,
+ const GLvoid * data, GLenum usage);
+ GL_API void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset,
+ GLsizeiptr size,
+ const GLvoid * data);
+ GL_API void GL_APIENTRY glClear(GLbitfield mask);
+ GL_API void GL_APIENTRY glClearColorx(GLclampx red, GLclampx green,
+ GLclampx blue, GLclampx alpha);
+ GL_API void GL_APIENTRY glClearDepthx(GLclampx depth);
+ GL_API void GL_APIENTRY glClearStencil(GLint s);
+ GL_API void GL_APIENTRY glClientActiveTexture(GLenum texture);
+ GL_API void GL_APIENTRY glClipPlanex(GLenum plane,
+ const GLfixed * equation);
+ GL_API void GL_APIENTRY glColor4ub(GLubyte red, GLubyte green,
+ GLubyte blue, GLubyte alpha);
+ GL_API void GL_APIENTRY glColor4x(GLfixed red, GLfixed green,
+ GLfixed blue, GLfixed alpha);
+ GL_API void GL_APIENTRY glColorMask(GLboolean red, GLboolean green,
+ GLboolean blue, GLboolean alpha);
+ GL_API void GL_APIENTRY glColorPointer(GLint size, GLenum type,
+ GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLsizei imageSize,
+ const GLvoid * data);
+ GL_API void GL_APIENTRY glCompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLsizei imageSize,
+ const GLvoid * data);
+ GL_API void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level,
+ GLenum internalformat, GLint x,
+ GLint y, GLsizei width,
+ GLsizei height, GLint border);
+ GL_API void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLint x, GLint y,
+ GLsizei width,
+ GLsizei height);
+ GL_API void GL_APIENTRY glCullFace(GLenum mode);
+ GL_API void GL_APIENTRY glDeleteBuffers(GLsizei n,
+ const GLuint * buffers);
+ GL_API void GL_APIENTRY glDeleteTextures(GLsizei n,
+ const GLuint * textures);
+ GL_API void GL_APIENTRY glDepthFunc(GLenum func);
+ GL_API void GL_APIENTRY glDepthMask(GLboolean flag);
+ GL_API void GL_APIENTRY glDepthRangex(GLclampx zNear, GLclampx zFar);
+ GL_API void GL_APIENTRY glDisable(GLenum cap);
+ GL_API void GL_APIENTRY glDisableClientState(GLenum array);
+ GL_API void GL_APIENTRY glDrawArrays(GLenum mode, GLint first,
+ GLsizei count);
+ GL_API void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count,
+ GLenum type,
+ const GLvoid * indices);
+ GL_API void GL_APIENTRY glEnable(GLenum cap);
+ GL_API void GL_APIENTRY glEnableClientState(GLenum array);
+ GL_API void GL_APIENTRY glFinish(void);
+ GL_API void GL_APIENTRY glFlush(void);
+ GL_API void GL_APIENTRY glFogx(GLenum pname, GLfixed param);
+ GL_API void GL_APIENTRY glFogxv(GLenum pname, const GLfixed * params);
+ GL_API void GL_APIENTRY glFrontFace(GLenum mode);
+ GL_API void GL_APIENTRY glFrustumx(GLfixed left, GLfixed right,
+ GLfixed bottom, GLfixed top,
+ GLfixed zNear, GLfixed zFar);
+ GL_API void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean * params);
+ GL_API void GL_APIENTRY glGetBufferParameteriv(GLenum target,
+ GLenum pname,
+ GLint * params);
+ GL_API void GL_APIENTRY glGetClipPlanex(GLenum pname, GLfixed eqn[4]);
+ GL_API void GL_APIENTRY glGenBuffers(GLsizei n, GLuint * buffers);
+ GL_API void GL_APIENTRY glGenTextures(GLsizei n, GLuint * textures);
+ GL_API GLenum GL_APIENTRY glGetError(void);
+ GL_API void GL_APIENTRY glGetFixedv(GLenum pname, GLfixed * params);
+ GL_API void GL_APIENTRY glGetIntegerv(GLenum pname, GLint * params);
+ GL_API void GL_APIENTRY glGetLightxv(GLenum light, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glGetMaterialxv(GLenum face, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glGetPointerv(GLenum pname, void **params);
+ GL_API const GLubyte *GL_APIENTRY glGetString(GLenum name);
+ GL_API void GL_APIENTRY glGetTexEnviv(GLenum env, GLenum pname,
+ GLint * params);
+ GL_API void GL_APIENTRY glGetTexEnvxv(GLenum env, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname,
+ GLint * params);
+ GL_API void GL_APIENTRY glGetTexParameterxv(GLenum target, GLenum pname,
+ GLfixed * params);
+ GL_API void GL_APIENTRY glHint(GLenum target, GLenum mode);
+ GL_API GLboolean GL_APIENTRY glIsBuffer(GLuint buffer);
+ GL_API GLboolean GL_APIENTRY glIsEnabled(GLenum cap);
+ GL_API GLboolean GL_APIENTRY glIsTexture(GLuint texture);
+ GL_API void GL_APIENTRY glLightModelx(GLenum pname, GLfixed param);
+ GL_API void GL_APIENTRY glLightModelxv(GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glLightx(GLenum light, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glLightxv(GLenum light, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glLineWidthx(GLfixed width);
+ GL_API void GL_APIENTRY glLoadIdentity(void);
+ GL_API void GL_APIENTRY glLoadMatrixx(const GLfixed * m);
+ GL_API void GL_APIENTRY glLogicOp(GLenum opcode);
+ GL_API void GL_APIENTRY glMaterialx(GLenum face, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glMaterialxv(GLenum face, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glMatrixMode(GLenum mode);
+ GL_API void GL_APIENTRY glMultMatrixx(const GLfixed * m);
+ GL_API void GL_APIENTRY glMultiTexCoord4x(GLenum target, GLfixed s,
+ GLfixed t, GLfixed r,
+ GLfixed q);
+ GL_API void GL_APIENTRY glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz);
+ GL_API void GL_APIENTRY glNormalPointer(GLenum type, GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glOrthox(GLfixed left, GLfixed right,
+ GLfixed bottom, GLfixed top,
+ GLfixed zNear, GLfixed zFar);
+ GL_API void GL_APIENTRY glPixelStorei(GLenum pname, GLint param);
+ GL_API void GL_APIENTRY glPointParameterx(GLenum pname, GLfixed param);
+ GL_API void GL_APIENTRY glPointParameterxv(GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glPointSizex(GLfixed size);
+ GL_API void GL_APIENTRY glPolygonOffsetx(GLfixed factor, GLfixed units);
+ GL_API void GL_APIENTRY glPopMatrix(void);
+ GL_API void GL_APIENTRY glPushMatrix(void);
+ GL_API void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width,
+ GLsizei height, GLenum format,
+ GLenum type, GLvoid * pixels);
+ GL_API void GL_APIENTRY glRotatex(GLfixed angle, GLfixed x, GLfixed y,
+ GLfixed z);
+ GL_API void GL_APIENTRY glSampleCoverage(GLclampf value,
+ GLboolean invert);
+ GL_API void GL_APIENTRY glSampleCoveragex(GLclampx value,
+ GLboolean invert);
+ GL_API void GL_APIENTRY glScalex(GLfixed x, GLfixed y, GLfixed z);
+ GL_API void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width,
+ GLsizei height);
+ GL_API void GL_APIENTRY glShadeModel(GLenum mode);
+ GL_API void GL_APIENTRY glStencilFunc(GLenum func, GLint ref,
+ GLuint mask);
+ GL_API void GL_APIENTRY glStencilMask(GLuint mask);
+ GL_API void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail,
+ GLenum zpass);
+ GL_API void GL_APIENTRY glTexCoordPointer(GLint size, GLenum type,
+ GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glTexEnvi(GLenum target, GLenum pname,
+ GLint param);
+ GL_API void GL_APIENTRY glTexEnvx(GLenum target, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glTexEnviv(GLenum target, GLenum pname,
+ const GLint * params);
+ GL_API void GL_APIENTRY glTexEnvxv(GLenum target, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glTexImage2D(GLenum target, GLint level,
+ GLint internalformat, GLsizei width,
+ GLsizei height, GLint border,
+ GLenum format, GLenum type,
+ const GLvoid * pixels);
+ GL_API void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname,
+ GLint param);
+ GL_API void GL_APIENTRY glTexParameterx(GLenum target, GLenum pname,
+ GLfixed param);
+ GL_API void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname,
+ const GLint * params);
+ GL_API void GL_APIENTRY glTexParameterxv(GLenum target, GLenum pname,
+ const GLfixed * params);
+ GL_API void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level,
+ GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height,
+ GLenum format, GLenum type,
+ const GLvoid * pixels);
+ GL_API void GL_APIENTRY glTranslatex(GLfixed x, GLfixed y, GLfixed z);
+ GL_API void GL_APIENTRY glVertexPointer(GLint size, GLenum type,
+ GLsizei stride,
+ const GLvoid * pointer);
+ GL_API void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width,
+ GLsizei height);
/*------------------------------------------------------------------------*
* Required OES extension functions
@@ -818,7 +929,8 @@
/* GL_OES_point_size_array */
#ifndef GL_OES_point_size_array
#define GL_OES_point_size_array 1
-GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer);
+ GL_API void GL_APIENTRY glPointSizePointerOES(GLenum type, GLsizei stride,
+ const GLvoid * pointer);
#endif
/* GL_OES_point_sprite */
@@ -830,5 +942,4 @@
}
#endif
-#endif /* __gles_h_ */
-
+#endif /* __gles_h_ */
--- a/src/video/SDL_glesfuncs.h Mon Sep 15 04:31:30 2008 +0000
+++ b/src/video/SDL_glesfuncs.h Mon Sep 15 04:32:36 2008 +0000
@@ -5,42 +5,59 @@
#define SDL_PROC_UNUSED(ret,func,params)
SDL_PROC_UNUSED(void, glAlphaFunc, (GLenum func, GLclampf ref))
-SDL_PROC(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
+SDL_PROC(void, glClearColor,
+ (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha))
SDL_PROC_UNUSED(void, glClearDepthf, (GLclampf depth))
-SDL_PROC_UNUSED(void, glClipPlanef, (GLenum plane, const GLfloat *equation))
-SDL_PROC(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
+SDL_PROC_UNUSED(void, glClipPlanef, (GLenum plane, const GLfloat * equation))
+SDL_PROC(void, glColor4f,
+ (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
SDL_PROC_UNUSED(void, glDepthRangef, (GLclampf zNear, GLclampf zFar))
SDL_PROC_UNUSED(void, glFogf, (GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glFogfv, (GLenum pname, const GLfloat *params))
-SDL_PROC_UNUSED(void, glFrustumf, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar))
+SDL_PROC_UNUSED(void, glFogfv, (GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glFrustumf,
+ (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar))
SDL_PROC_UNUSED(void, glGetClipPlanef, (GLenum pname, GLfloat eqn[4]))
-SDL_PROC(void, glGetFloatv, (GLenum pname, GLfloat *params))
-SDL_PROC_UNUSED(void, glGetLightfv, (GLenum light, GLenum pname, GLfloat *params))
-SDL_PROC_UNUSED(void, glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params))
-SDL_PROC_UNUSED(void, glGetTexEnvfv, (GLenum env, GLenum pname, GLfloat *params))
-SDL_PROC_UNUSED(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params))
+SDL_PROC(void, glGetFloatv, (GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetLightfv,
+ (GLenum light, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetMaterialfv,
+ (GLenum face, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetTexEnvfv,
+ (GLenum env, GLenum pname, GLfloat * params))
+SDL_PROC_UNUSED(void, glGetTexParameterfv,
+ (GLenum target, GLenum pname, GLfloat * params))
SDL_PROC_UNUSED(void, glLightModelf, (GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glLightModelfv, (GLenum pname, const GLfloat *params))
+SDL_PROC_UNUSED(void, glLightModelfv, (GLenum pname, const GLfloat * params))
SDL_PROC_UNUSED(void, glLightf, (GLenum light, GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glLightfv, (GLenum light, GLenum pname, const GLfloat *params))
+SDL_PROC_UNUSED(void, glLightfv,
+ (GLenum light, GLenum pname, const GLfloat * params))
SDL_PROC_UNUSED(void, glLineWidth, (GLfloat width))
-SDL_PROC_UNUSED(void, glLoadMatrixf, (const GLfloat *m))
+SDL_PROC_UNUSED(void, glLoadMatrixf, (const GLfloat * m))
SDL_PROC_UNUSED(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params))
-SDL_PROC_UNUSED(void, glMultMatrixf, (const GLfloat *m))
-SDL_PROC_UNUSED(void, glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q))
+SDL_PROC_UNUSED(void, glMaterialfv,
+ (GLenum face, GLenum pname, const GLfloat * params))
+SDL_PROC_UNUSED(void, glMultMatrixf, (const GLfloat * m))
+SDL_PROC_UNUSED(void, glMultiTexCoord4f,
+ (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q))
SDL_PROC_UNUSED(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz))
-SDL_PROC(void, glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar))
+SDL_PROC(void, glOrthof,
+ (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top,
+ GLfloat zNear, GLfloat zFar))
SDL_PROC_UNUSED(void, glPointParameterf, (GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glPointParameterfv, (GLenum pname, const GLfloat *params))
+SDL_PROC_UNUSED(void, glPointParameterfv,
+ (GLenum pname, const GLfloat * params))
SDL_PROC_UNUSED(void, glPointSize, (GLfloat size))
SDL_PROC_UNUSED(void, glPolygonOffset, (GLfloat factor, GLfloat units))
-SDL_PROC_UNUSED(void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
+SDL_PROC_UNUSED(void, glRotatef,
+ (GLfloat angle, GLfloat x, GLfloat y, GLfloat z))
SDL_PROC_UNUSED(void, glScalef, (GLfloat x, GLfloat y, GLfloat z))
SDL_PROC(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params))
+SDL_PROC_UNUSED(void, glTexEnvfv,
+ (GLenum target, GLenum pname, const GLfloat * params))
SDL_PROC(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param))
-SDL_PROC_UNUSED(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params))
+SDL_PROC_UNUSED(void, glTexParameterfv,
+ (GLenum target, GLenum pname, const GLfloat * params))
SDL_PROC_UNUSED(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z))
/* Available in both Common and Common-Lite profiles */
@@ -49,85 +66,127 @@
SDL_PROC_UNUSED(void, glBindBuffer, (GLenum target, GLuint buffer))
SDL_PROC(void, glBindTexture, (GLenum target, GLuint texture))
SDL_PROC(void, glBlendFunc, (GLenum sfactor, GLenum dfactor))
-SDL_PROC_UNUSED(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage))
-SDL_PROC_UNUSED(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data))
+SDL_PROC_UNUSED(void, glBufferData,
+ (GLenum target, GLsizeiptr size, const GLvoid * data,
+ GLenum usage))
+SDL_PROC_UNUSED(void, glBufferSubData,
+ (GLenum target, GLintptr offset, GLsizeiptr size,
+ const GLvoid * data))
SDL_PROC(void, glClear, (GLbitfield mask))
-SDL_PROC_UNUSED(void, glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha))
+SDL_PROC_UNUSED(void, glClearColorx,
+ (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha))
SDL_PROC_UNUSED(void, glClearDepthx, (GLclampx depth))
SDL_PROC_UNUSED(void, glClearStencil, (GLint s))
SDL_PROC_UNUSED(void, glClientActiveTexture, (GLenum texture))
-SDL_PROC_UNUSED(void, glClipPlanex, (GLenum plane, const GLfixed *equation))
-SDL_PROC_UNUSED(void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
-SDL_PROC_UNUSED(void, glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha))
-SDL_PROC_UNUSED(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha))
-SDL_PROC_UNUSED(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
-SDL_PROC_UNUSED(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data))
-SDL_PROC_UNUSED(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data))
-SDL_PROC_UNUSED(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border))
-SDL_PROC_UNUSED(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height))
+SDL_PROC_UNUSED(void, glClipPlanex, (GLenum plane, const GLfixed * equation))
+SDL_PROC_UNUSED(void, glColor4ub,
+ (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
+SDL_PROC_UNUSED(void, glColor4x,
+ (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha))
+SDL_PROC_UNUSED(void, glColorMask,
+ (GLboolean red, GLboolean green, GLboolean blue,
+ GLboolean alpha))
+SDL_PROC_UNUSED(void, glColorPointer,
+ (GLint size, GLenum type, GLsizei stride,
+ const GLvoid * pointer))
+SDL_PROC_UNUSED(void, glCompressedTexImage2D,
+ (GLenum target, GLint level, GLenum internalformat,
+ GLsizei width, GLsizei height, GLint border,
+ GLsizei imageSize, const GLvoid * data))
+SDL_PROC_UNUSED(void, glCompressedTexSubImage2D,
+ (GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format,
+ GLsizei imageSize, const GLvoid * data))
+SDL_PROC_UNUSED(void, glCopyTexImage2D,
+ (GLenum target, GLint level, GLenum internalformat, GLint x,
+ GLint y, GLsizei width, GLsizei height, GLint border))
+SDL_PROC_UNUSED(void, glCopyTexSubImage2D,
+ (GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ GLint x, GLint y, GLsizei width, GLsizei height))
SDL_PROC_UNUSED(void, glCullFace, (GLenum mode))
-SDL_PROC_UNUSED(void, glDeleteBuffers, (GLsizei n, const GLuint *buffers))
-SDL_PROC_UNUSED(void, glDeleteTextures, (GLsizei n, const GLuint *textures))
+SDL_PROC_UNUSED(void, glDeleteBuffers, (GLsizei n, const GLuint * buffers))
+SDL_PROC_UNUSED(void, glDeleteTextures, (GLsizei n, const GLuint * textures))
SDL_PROC_UNUSED(void, glDepthFunc, (GLenum func))
SDL_PROC_UNUSED(void, glDepthMask, (GLboolean flag))
SDL_PROC_UNUSED(void, glDepthRangex, (GLclampx zNear, GLclampx zFar))
SDL_PROC(void, glDisable, (GLenum cap))
SDL_PROC_UNUSED(void, glDisableClientState, (GLenum array))
SDL_PROC(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count))
-SDL_PROC_UNUSED(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices))
+SDL_PROC_UNUSED(void, glDrawElements,
+ (GLenum mode, GLsizei count, GLenum type,
+ const GLvoid * indices))
SDL_PROC(void, glEnable, (GLenum cap))
SDL_PROC(void, glEnableClientState, (GLenum array))
SDL_PROC_UNUSED(void, glFinish, (void))
SDL_PROC_UNUSED(void, glFlush, (void))
SDL_PROC_UNUSED(void, glFogx, (GLenum pname, GLfixed param))
-SDL_PROC_UNUSED(void, glFogxv, (GLenum pname, const GLfixed *params))
+SDL_PROC_UNUSED(void, glFogxv, (GLenum pname, const GLfixed * params))
SDL_PROC_UNUSED(void, glFrontFace, (GLenum mode))
-SDL_PROC_UNUSED(void, glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar))
-SDL_PROC_UNUSED(void, glGetBooleanv, (GLenum pname, GLboolean *params))
-SDL_PROC_UNUSED(void, glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params))
+SDL_PROC_UNUSED(void, glFrustumx,
+ (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
+ GLfixed zNear, GLfixed zFar))
+SDL_PROC_UNUSED(void, glGetBooleanv, (GLenum pname, GLboolean * params))
+SDL_PROC_UNUSED(void, glGetBufferParameteriv,
+ (GLenum target, GLenum pname, GLint * params))
SDL_PROC_UNUSED(void, glGetClipPlanex, (GLenum pname, GLfixed eqn[4]))
-SDL_PROC_UNUSED(void, glGenBuffers, (GLsizei n, GLuint *buffers))
-SDL_PROC(void, glGenTextures, (GLsizei n, GLuint *textures))
+SDL_PROC_UNUSED(void, glGenBuffers, (GLsizei n, GLuint * buffers))
+SDL_PROC(void, glGenTextures, (GLsizei n, GLuint * textures))
SDL_PROC(GLenum, glGetError, (void))
-SDL_PROC_UNUSED(void, glGetFixedv, (GLenum pname, GLfixed *params))
-SDL_PROC(void, glGetIntegerv, (GLenum pname, GLint *params))
-SDL_PROC_UNUSED(void, glGetLightxv, (GLenum light, GLenum pname, GLfixed *params))
-SDL_PROC_UNUSED(void, glGetMaterialxv, (GLenum face, GLenum pname, GLfixed *params))
+SDL_PROC_UNUSED(void, glGetFixedv, (GLenum pname, GLfixed * params))
+SDL_PROC(void, glGetIntegerv, (GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetLightxv,
+ (GLenum light, GLenum pname, GLfixed * params))
+SDL_PROC_UNUSED(void, glGetMaterialxv,
+ (GLenum face, GLenum pname, GLfixed * params))
SDL_PROC_UNUSED(void, glGetPointerv, (GLenum pname, void **params))
SDL_PROC_UNUSED(const GLubyte *, glGetString, (GLenum name))
-SDL_PROC_UNUSED(void, glGetTexEnviv, (GLenum env, GLenum pname, GLint *params))
-SDL_PROC_UNUSED(void, glGetTexEnvxv, (GLenum env, GLenum pname, GLfixed *params))
-SDL_PROC_UNUSED(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params))
-SDL_PROC_UNUSED(void, glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params))
+SDL_PROC_UNUSED(void, glGetTexEnviv,
+ (GLenum env, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetTexEnvxv,
+ (GLenum env, GLenum pname, GLfixed * params))
+SDL_PROC_UNUSED(void, glGetTexParameteriv,
+ (GLenum target, GLenum pname, GLint * params))
+SDL_PROC_UNUSED(void, glGetTexParameterxv,
+ (GLenum target, GLenum pname, GLfixed * params))
SDL_PROC_UNUSED(void, glHint, (GLenum target, GLenum mode))
SDL_PROC_UNUSED(GLboolean, glIsBuffer, (GLuint buffer))
SDL_PROC_UNUSED(GLboolean, glIsEnabled, (GLenum cap))
SDL_PROC_UNUSED(GLboolean, glIsTexture, (GLuint texture))
SDL_PROC_UNUSED(void, glLightModelx, (GLenum pname, GLfixed param))
-SDL_PROC_UNUSED(void, glLightModelxv, (GLenum pname, const GLfixed *params))
+SDL_PROC_UNUSED(void, glLightModelxv, (GLenum pname, const GLfixed * params))
SDL_PROC_UNUSED(void, glLightx, (GLenum light, GLenum pname, GLfixed param))
-SDL_PROC_UNUSED(void, glLightxv, (GLenum light, GLenum pname, const GLfixed *params))
+SDL_PROC_UNUSED(void, glLightxv,
+ (GLenum light, GLenum pname, const GLfixed * params))
SDL_PROC_UNUSED(void, glLineWidthx, (GLfixed width))
SDL_PROC(void, glLoadIdentity, (void))
-SDL_PROC_UNUSED(void, glLoadMatrixx, (const GLfixed *m))
+SDL_PROC_UNUSED(void, glLoadMatrixx, (const GLfixed * m))
SDL_PROC_UNUSED(void, glLogicOp, (GLenum opcode))
SDL_PROC_UNUSED(void, glMaterialx, (GLenum face, GLenum pname, GLfixed param))
-SDL_PROC_UNUSED(void, glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params))
+SDL_PROC_UNUSED(void, glMaterialxv,
+ (GLenum face, GLenum pname, const GLfixed * params))
SDL_PROC(void, glMatrixMode, (GLenum mode))
-SDL_PROC_UNUSED(void, glMultMatrixx, (const GLfixed *m))
-SDL_PROC_UNUSED(void, glMultiTexCoord4x, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q))
+SDL_PROC_UNUSED(void, glMultMatrixx, (const GLfixed * m))
+SDL_PROC_UNUSED(void, glMultiTexCoord4x,
+ (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q))
SDL_PROC_UNUSED(void, glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz))
-SDL_PROC_UNUSED(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer))
-SDL_PROC_UNUSED(void, glOrthox, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar))
+SDL_PROC_UNUSED(void, glNormalPointer,
+ (GLenum type, GLsizei stride, const GLvoid * pointer))
+SDL_PROC_UNUSED(void, glOrthox,
+ (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top,
+ GLfixed zNear, GLfixed zFar))
SDL_PROC(void, glPixelStorei, (GLenum pname, GLint param))
SDL_PROC_UNUSED(void, glPointParameterx, (GLenum pname, GLfixed param))
-SDL_PROC_UNUSED(void, glPointParameterxv, (GLenum pname, const GLfixed *params))
+SDL_PROC_UNUSED(void, glPointParameterxv,
+ (GLenum pname, const GLfixed * params))
SDL_PROC_UNUSED(void, glPointSizex, (GLfixed size))
SDL_PROC_UNUSED(void, glPolygonOffsetx, (GLfixed factor, GLfixed units))
SDL_PROC_UNUSED(void, glPopMatrix, (void))
SDL_PROC_UNUSED(void, glPushMatrix, (void))
-SDL_PROC_UNUSED(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels))
-SDL_PROC_UNUSED(void, glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z))
+SDL_PROC_UNUSED(void, glReadPixels,
+ (GLint x, GLint y, GLsizei width, GLsizei height,
+ GLenum format, GLenum type, GLvoid * pixels))
+SDL_PROC_UNUSED(void, glRotatex,
+ (GLfixed angle, GLfixed x, GLfixed y, GLfixed z))
SDL_PROC_UNUSED(void, glSampleCoverage, (GLclampf value, GLboolean invert))
SDL_PROC_UNUSED(void, glSampleCoveragex, (GLclampx value, GLboolean invert))
SDL_PROC_UNUSED(void, glScalex, (GLfixed x, GLfixed y, GLfixed z))
@@ -136,22 +195,36 @@
SDL_PROC_UNUSED(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
SDL_PROC_UNUSED(void, glStencilMask, (GLuint mask))
SDL_PROC_UNUSED(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
-SDL_PROC(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
+SDL_PROC(void, glTexCoordPointer,
+ (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer))
SDL_PROC_UNUSED(void, glTexEnvi, (GLenum target, GLenum pname, GLint param))
SDL_PROC_UNUSED(void, glTexEnvx, (GLenum target, GLenum pname, GLfixed param))
-SDL_PROC_UNUSED(void, glTexEnviv, (GLenum target, GLenum pname, const GLint *params))
-SDL_PROC_UNUSED(void, glTexEnvxv, (GLenum target, GLenum pname, const GLfixed *params))
-SDL_PROC(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels))
+SDL_PROC_UNUSED(void, glTexEnviv,
+ (GLenum target, GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glTexEnvxv,
+ (GLenum target, GLenum pname, const GLfixed * params))
+SDL_PROC(void, glTexImage2D,
+ (GLenum target, GLint level, GLint internalformat, GLsizei width,
+ GLsizei height, GLint border, GLenum format, GLenum type,
+ const GLvoid * pixels))
SDL_PROC(void, glTexParameteri, (GLenum target, GLenum pname, GLint param))
-SDL_PROC_UNUSED(void, glTexParameterx, (GLenum target, GLenum pname, GLfixed param))
-SDL_PROC(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint *params))
-SDL_PROC_UNUSED(void, glTexParameterxv, (GLenum target, GLenum pname, const GLfixed *params))
-SDL_PROC(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels))
+SDL_PROC_UNUSED(void, glTexParameterx,
+ (GLenum target, GLenum pname, GLfixed param))
+SDL_PROC(void, glTexParameteriv,
+ (GLenum target, GLenum pname, const GLint * params))
+SDL_PROC_UNUSED(void, glTexParameterxv,
+ (GLenum target, GLenum pname, const GLfixed * params))
+SDL_PROC(void, glTexSubImage2D,
+ (GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ GLsizei width, GLsizei height, GLenum format, GLenum type,
+ const GLvoid * pixels))
SDL_PROC_UNUSED(void, glTranslatex, (GLfixed x, GLfixed y, GLfixed z))
-SDL_PROC(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer))
+SDL_PROC(void, glVertexPointer,
+ (GLint size, GLenum type, GLsizei stride, const GLvoid * pointer))
SDL_PROC(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
/* extension functions used */
-SDL_PROC(void, glDrawTexiOES, (GLint x, GLint y, GLint z, GLint width, GLint height))
+SDL_PROC(void, glDrawTexiOES,
+ (GLint x, GLint y, GLint z, GLint width, GLint height))
/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_renderer_gles.c Mon Sep 15 04:31:30 2008 +0000
+++ b/src/video/SDL_renderer_gles.c Mon Sep 15 04:32:36 2008 +0000
@@ -39,38 +39,41 @@
static int GLES_DisplayModeChanged(SDL_Renderer * renderer);
static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int GLES_QueryTexturePixels(SDL_Renderer * renderer,
- SDL_Texture * texture, void **pixels,
- int *pitch);
+ SDL_Texture * texture, void **pixels,
+ int *pitch);
static int GLES_SetTexturePalette(SDL_Renderer * renderer,
- SDL_Texture * texture,
- const SDL_Color * colors, int firstcolor,
- int ncolors);
+ SDL_Texture * texture,
+ const SDL_Color * colors, int firstcolor,
+ int ncolors);
static int GLES_GetTexturePalette(SDL_Renderer * renderer,
- SDL_Texture * texture, SDL_Color * colors,
- int firstcolor, int ncolors);
+ SDL_Texture * texture, SDL_Color * colors,
+ int firstcolor, int ncolors);
static int GLES_SetTextureColorMod(SDL_Renderer * renderer,
- SDL_Texture * texture);
+ SDL_Texture * texture);
static int GLES_SetTextureAlphaMod(SDL_Renderer * renderer,
- SDL_Texture * texture);
+ SDL_Texture * texture);
static int GLES_SetTextureBlendMode(SDL_Renderer * renderer,
- SDL_Texture * texture);
+ SDL_Texture * texture);
static int GLES_SetTextureScaleMode(SDL_Renderer * renderer,
- SDL_Texture * texture);
+ SDL_Texture * texture);
static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, const void *pixels,
- int pitch);
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
static int GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch);
-static void GLES_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+ const SDL_Rect * rect, int markDirty,
+ void **pixels, int *pitch);
+static void GLES_UnlockTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
static void GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects);
+ int numrects, const SDL_Rect * rects);
static int GLES_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
- Uint8 a, const SDL_Rect * rect);
+ Uint8 a, const SDL_Rect * rect);
static int GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * srcrect, const SDL_Rect * dstrect);
+ const SDL_Rect * srcrect,
+ const SDL_Rect * dstrect);
static void GLES_RenderPresent(SDL_Renderer * renderer);
-static void GLES_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture);
+static void GLES_DestroyTexture(SDL_Renderer * renderer,
+ SDL_Texture * texture);
static void GLES_DestroyRenderer(SDL_Renderer * renderer);
@@ -87,11 +90,11 @@
SDL_TEXTUREBLENDMODE_MOD),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST |
SDL_TEXTURESCALEMODE_SLOW), 2,
- {
- SDL_PIXELFORMAT_RGB24,
- SDL_PIXELFORMAT_ABGR8888,
- },
- 0,
+ {
+ SDL_PIXELFORMAT_RGB24,
+ SDL_PIXELFORMAT_ABGR8888,
+ },
+ 0,
0}
};
@@ -100,18 +103,18 @@
SDL_GLContext context;
SDL_bool updateSize;
int blendMode;
-
+
#ifndef APIENTRY
#define APIENTRY
#endif
-
- SDL_bool useDrawTexture;
- SDL_bool GL_OES_draw_texture_supported;
-
- /* OpenGL ES functions */
- #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
- #include "SDL_glesfuncs.h"
- #undef SDL_PROC
+
+ SDL_bool useDrawTexture;
+ SDL_bool GL_OES_draw_texture_supported;
+
+ /* OpenGL ES functions */
+#define SDL_PROC(ret,func,params) ret (APIENTRY *func) params;
+#include "SDL_glesfuncs.h"
+#undef SDL_PROC
} GLES_RenderData;
@@ -165,12 +168,12 @@
static int
GLES_LoadFunctions(GLES_RenderData * data)
{
-
- #define SDL_PROC(ret,func,params) \
+
+#define SDL_PROC(ret,func,params) \
data->func = func;
- #include "SDL_glesfuncs.h"
- #undef SDL_PROC
-
+#include "SDL_glesfuncs.h"
+#undef SDL_PROC
+
return 0;
}
@@ -185,7 +188,7 @@
SDL_Renderer *
GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
{
-
+
SDL_Renderer *renderer;
GLES_RenderData *data;
GLint value;
@@ -232,9 +235,10 @@
renderer->info = GL_ES_RenderDriver.info;
renderer->window = window->id;
renderer->driverdata = data;
-
-
- renderer->info.flags = (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
+
+
+ renderer->info.flags =
+ (SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED);
if (GLES_LoadFunctions(data) < 0) {
GLES_DestroyRenderer(renderer);
@@ -265,15 +269,14 @@
renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER;
}
}
-
- if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) {
- data->GL_OES_draw_texture_supported = SDL_TRUE;
- data->useDrawTexture = SDL_TRUE;
- }
- else {
- data->GL_OES_draw_texture_supported = SDL_FALSE;
- data->useDrawTexture = SDL_FALSE;
- }
+
+ if (SDL_GL_ExtensionSupported("GL_OES_draw_texture")) {
+ data->GL_OES_draw_texture_supported = SDL_TRUE;
+ data->useDrawTexture = SDL_TRUE;
+ } else {
+ data->GL_OES_draw_texture_supported = SDL_FALSE;
+ data->useDrawTexture = SDL_FALSE;
+ }
data->glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value);
renderer->info.max_texture_width = value;
@@ -284,18 +287,19 @@
data->blendMode = -1;
data->glDisable(GL_DEPTH_TEST);
data->glDisable(GL_CULL_FACE);
- data->glEnable(GL_TEXTURE_2D);
+ data->glEnable(GL_TEXTURE_2D);
data->updateSize = SDL_TRUE;
return renderer;
}
-static int GLES_ActivateRenderer(SDL_Renderer * renderer)
+static int
+GLES_ActivateRenderer(SDL_Renderer * renderer)
{
-
- GLES_RenderData *data = (GLES_RenderData *)renderer->driverdata;
+
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
SDL_Window *window = SDL_GetWindowFromID(renderer->window);
-
+
if (SDL_GL_MakeCurrent(window->id, data->context) < 0) {
return -1;
}
@@ -305,8 +309,8 @@
data->glMatrixMode(GL_MODELVIEW);
data->glLoadIdentity();
data->glViewport(0, 0, window->w, window->h);
- data->glOrthof(0.0, (GLfloat)window->w, (GLfloat)window->h, 0.0,
- 0.0, 1.0);
+ data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0,
+ 0.0, 1.0);
data->updateSize = SDL_FALSE;
}
return 0;
@@ -342,55 +346,55 @@
GLenum format, type;
int texture_w, texture_h;
GLenum result;
- switch (texture->format) {
- case SDL_PIXELFORMAT_INDEX1LSB:
- case SDL_PIXELFORMAT_INDEX1MSB:
- case SDL_PIXELFORMAT_INDEX8:
- case SDL_PIXELFORMAT_RGB332:
- case SDL_PIXELFORMAT_RGB444:
- case SDL_PIXELFORMAT_RGB555:
- case SDL_PIXELFORMAT_ARGB4444:
- case SDL_PIXELFORMAT_ARGB1555:
- case SDL_PIXELFORMAT_BGR24:
- case SDL_PIXELFORMAT_BGR888:
- case SDL_PIXELFORMAT_RGB888:
- case SDL_PIXELFORMAT_RGBA8888:
- case SDL_PIXELFORMAT_ARGB2101010:
- case SDL_PIXELFORMAT_ARGB8888:
- case SDL_PIXELFORMAT_RGB24:
- internalFormat = GL_RGB;
- format = GL_RGB;
- type = GL_UNSIGNED_BYTE;
- break;
- case SDL_PIXELFORMAT_ABGR8888:
- internalFormat = GL_RGBA;
- format = GL_RGBA;
- type = GL_UNSIGNED_BYTE;
- break;
- /*
- These formats would be supported if SDL had the necessary pixel formats
- case SDL_PIXELFORMAT_BGR565:
- internalFormat = GL_RGB;
- format = GL_RGB;
- type = GL_UNSIGNED_SHORT_5_6_5;
- break;
- case SDL_PIXELFORMAT_ABGR5551:
- internalFormat = GL_RGBA;
- format = GL_RGBA;
- type = GL_UNSIGNED_SHORT_5_5_5_1;
- break;
- case SDL_PIXELFORMAT_ABGR4444:
- internalFormat = GL_RGBA;
- format = GL_RGBA;
- type = GL_UNSIGNED_SHORT_4_4_4_4;
- break;
- */
- default:
- SDL_SetError("Unsupported texture format");
- return -1;
+ switch (texture->format) {
+ case SDL_PIXELFORMAT_INDEX1LSB:
+ case SDL_PIXELFORMAT_INDEX1MSB:
+ case SDL_PIXELFORMAT_INDEX8:
+ case SDL_PIXELFORMAT_RGB332:
+ case SDL_PIXELFORMAT_RGB444:
+ case SDL_PIXELFORMAT_RGB555:
+ case SDL_PIXELFORMAT_ARGB4444:
+ case SDL_PIXELFORMAT_ARGB1555:
+ case SDL_PIXELFORMAT_BGR24:
+ case SDL_PIXELFORMAT_BGR888:
+ case SDL_PIXELFORMAT_RGB888:
+ case SDL_PIXELFORMAT_RGBA8888:
+ case SDL_PIXELFORMAT_ARGB2101010:
+ case SDL_PIXELFORMAT_ARGB8888:
+ case SDL_PIXELFORMAT_RGB24:
+ internalFormat = GL_RGB;
+ format = GL_RGB;
+ type = GL_UNSIGNED_BYTE;
+ break;
+ case SDL_PIXELFORMAT_ABGR8888:
+ internalFormat = GL_RGBA;
+ format = GL_RGBA;
+ type = GL_UNSIGNED_BYTE;
+ break;
+ /*
+ These formats would be supported if SDL had the necessary pixel formats
+ case SDL_PIXELFORMAT_BGR565:
+ internalFormat = GL_RGB;
+ format = GL_RGB;
+ type = GL_UNSIGNED_SHORT_5_6_5;
+ break;
+ case SDL_PIXELFORMAT_ABGR5551:
+ internalFormat = GL_RGBA;
+ format = GL_RGBA;
+ type = GL_UNSIGNED_SHORT_5_5_5_1;
+ break;
+ case SDL_PIXELFORMAT_ABGR4444:
+ internalFormat = GL_RGBA;
+ format = GL_RGBA;
+ type = GL_UNSIGNED_SHORT_4_4_4_4;
+ break;
+ */
+ default:
+ SDL_SetError("Unsupported texture format");
+ return -1;
}
-
- data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
+
+ data = (GLES_TextureData *) SDL_calloc(1, sizeof(*data));
if (!data) {
SDL_OutOfMemory();
return -1;
@@ -410,14 +414,14 @@
renderdata->glGetError();
renderdata->glGenTextures(1, &data->texture);
-
- data->type = GL_TEXTURE_2D;
- /* no NPOV textures allowed in OpenGL ES (yet) */
- texture_w = power_of_2(texture->w);
- texture_h = power_of_2(texture->h);
- data->texw = (GLfloat) texture->w / texture_w;
- data->texh = (GLfloat) texture->h / texture_h;
-
+
+ data->type = GL_TEXTURE_2D;
+ /* no NPOV textures allowed in OpenGL ES (yet) */
+ texture_w = power_of_2(texture->w);
+ texture_h = power_of_2(texture->h);
+ data->texw = (GLfloat) texture->w / texture_w;
+ data->texh = (GLfloat) texture->h / texture_h;
+
data->format = format;
data->formattype = type;
renderdata->glBindTexture(data->type, data->texture);
@@ -429,9 +433,9 @@
GL_CLAMP_TO_EDGE);
renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T,
GL_CLAMP_TO_EDGE);
-
- renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
- texture_h, 0, format, type, NULL);
+
+ renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w,
+ texture_h, 0, format, type, NULL);
result = renderdata->glGetError();
if (result != GL_NO_ERROR) {
@@ -443,7 +447,7 @@
static int
GLES_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch)
+ void **pixels, int *pitch)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
@@ -454,17 +458,17 @@
static int
GLES_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Color * colors, int firstcolor, int ncolors)
+ const SDL_Color * colors, int firstcolor, int ncolors)
{
- SDL_SetError("OpenGL ES does not support paletted textures");
+ SDL_SetError("OpenGL ES does not support paletted textures");
return -1;
}
static int
GLES_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
- SDL_Color * colors, int firstcolor, int ncolors)
+ SDL_Color * colors, int firstcolor, int ncolors)
{
- SDL_SetError("OpenGL ES does not support paletted textures");
+ SDL_SetError("OpenGL ES does not support paletted textures");
return -1;
}
@@ -472,10 +476,10 @@
SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
int pitch)
{
-
-
- GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
- renderdata->glBindTexture(data->type, data->texture);
+
+
+ GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
+ renderdata->glBindTexture(data->type, data->texture);
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
@@ -518,7 +522,7 @@
return 0;
case SDL_TEXTURESCALEMODE_BEST:
SDL_Unsupported();
- texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW;
+ texture->scaleMode = SDL_TEXTURESCALEMODE_SLOW;
return -1;
default:
SDL_Unsupported();
@@ -529,15 +533,15 @@
static int
GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, const void *pixels, int pitch)
+ const SDL_Rect * rect, const void *pixels, int pitch)
{
GLES_RenderData *renderdata = (GLES_RenderData *) renderer->driverdata;
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
GLenum result;
SetupTextureUpdate(renderdata, texture, pitch);
- renderdata->glGetError();
- renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
+ renderdata->glGetError();
+ renderdata->glTexSubImage2D(data->type, 0, rect->x, rect->y, rect->w,
rect->h, data->format, data->formattype,
pixels);
result = renderdata->glGetError();
@@ -550,8 +554,8 @@
static int
GLES_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch)
+ const SDL_Rect * rect, int markDirty, void **pixels,
+ int *pitch)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
@@ -572,8 +576,8 @@
}
static void
-GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
- const SDL_Rect * rects)
+GLES_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
+ int numrects, const SDL_Rect * rects)
{
GLES_TextureData *data = (GLES_TextureData *) texture->driverdata;
int i;
@@ -585,44 +589,45 @@
static int
GLES_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
- const SDL_Rect * rect)
+ const SDL_Rect * rect)
{
-
- GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
+
+ GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
SDL_Window *window = SDL_GetWindowFromID(renderer->window);
-
- /* set proper drawing color */
- GLfloat oldClearColor[4];
-
- data->glGetFloatv(GL_COLOR_CLEAR_VALUE, oldClearColor);
-
- data->glClearColor((GLclampf) r * inv255f, (GLclampf) g * inv255f,
- (GLclampf) b * inv255f, (GLclampf) a * inv255f);
-
- data->glScissor(rect->x, window->h - rect->y - rect->h, rect->w, rect->h);
- data->glEnable(GL_SCISSOR_TEST);
- data->glClear(GL_COLOR_BUFFER_BIT);
- data->glDisable(GL_SCISSOR_TEST);
-
- /* reset clear color */
- data->glClearColor(oldClearColor[0], oldClearColor[1], oldClearColor[2], oldClearColor[2]);
-
- return 0;
+
+ /* set proper drawing color */
+ GLfloat oldClearColor[4];
+
+ data->glGetFloatv(GL_COLOR_CLEAR_VALUE, oldClearColor);
+
+ data->glClearColor((GLclampf) r * inv255f, (GLclampf) g * inv255f,
+ (GLclampf) b * inv255f, (GLclampf) a * inv255f);
+
+ data->glScissor(rect->x, window->h - rect->y - rect->h, rect->w, rect->h);
+ data->glEnable(GL_SCISSOR_TEST);
+ data->glClear(GL_COLOR_BUFFER_BIT);
+ data->glDisable(GL_SCISSOR_TEST);
+
+ /* reset clear color */
+ data->glClearColor(oldClearColor[0], oldClearColor[1], oldClearColor[2],
+ oldClearColor[2]);
+
+ return 0;
}
static int
GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * srcrect, const SDL_Rect * dstrect)
+ const SDL_Rect * srcrect, const SDL_Rect * dstrect)
{
-
+
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
int minx, miny, maxx, maxy;
GLfloat minu, maxu, minv, maxv;
- int i;
- void *temp_buffer; /* used for reformatting dirty rect pixels */
- void *temp_ptr;
-
+ int i;
+ void *temp_buffer; /* used for reformatting dirty rect pixels */
+ void *temp_ptr;
+
if (texturedata->dirty.list) {
SDL_DirtyRect *dirty;
void *pixels;
@@ -630,38 +635,40 @@
int pitch = texturedata->pitch;
SetupTextureUpdate(data, texture, pitch);
-
+
data->glBindTexture(texturedata->type, texturedata->texture);
for (dirty = texturedata->dirty.list; dirty; dirty = dirty->next) {
SDL_Rect *rect = &dirty->rect;
- pixels = (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch + rect->x * bpp);
- /* There is no GL_UNPACK_ROW_LENGTH in OpenGLES
- we must do this reformatting ourselves(!)
-
- maybe it'd be a good idea to keep a temp buffer around
- for this purpose rather than allocating it each time
- */
- temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
- temp_ptr = temp_buffer;
- for (i=0; i<rect->h; i++) {
- SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
- temp_ptr += rect->w * bpp;
- pixels += pitch;
- }
-
+ pixels =
+ (void *) ((Uint8 *) texturedata->pixels + rect->y * pitch +
+ rect->x * bpp);
+ /* There is no GL_UNPACK_ROW_LENGTH in OpenGLES
+ we must do this reformatting ourselves(!)
+
+ maybe it'd be a good idea to keep a temp buffer around
+ for this purpose rather than allocating it each time
+ */
+ temp_buffer = SDL_malloc(rect->w * rect->h * bpp);
+ temp_ptr = temp_buffer;
+ for (i = 0; i < rect->h; i++) {
+ SDL_memcpy(temp_ptr, pixels, rect->w * bpp);
+ temp_ptr += rect->w * bpp;
+ pixels += pitch;
+ }
+
data->glTexSubImage2D(texturedata->type, 0, rect->x, rect->y,
rect->w, rect->h, texturedata->format,
texturedata->formattype, temp_buffer);
-
- SDL_free(temp_buffer);
-
+
+ SDL_free(temp_buffer);
+
}
SDL_ClearDirtyRects(&texturedata->dirty);
}
-
+
data->glBindTexture(texturedata->type, texturedata->texture);
- data->glEnable(GL_TEXTURE_2D);
-
+ data->glEnable(GL_TEXTURE_2D);
+
if (texture->modMode) {
data->glColor4f((GLfloat) texture->r * inv255f,
(GLfloat) texture->g * inv255f,
@@ -697,71 +704,80 @@
data->blendMode = texture->blendMode;
}
- switch (texture->scaleMode) {
- case SDL_TEXTURESCALEMODE_NONE:
- case SDL_TEXTURESCALEMODE_FAST:
- data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
- GL_NEAREST);
- data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
- GL_NEAREST);
- break;
- case SDL_TEXTURESCALEMODE_SLOW:
- case SDL_TEXTURESCALEMODE_BEST:
- data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
- GL_LINEAR);
- data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
- GL_LINEAR);
- break;
- }
+ switch (texture->scaleMode) {
+ case SDL_TEXTURESCALEMODE_NONE:
+ case SDL_TEXTURESCALEMODE_FAST:
+ data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST);
+ data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
+ GL_NEAREST);
+ break;
+ case SDL_TEXTURESCALEMODE_SLOW:
+ case SDL_TEXTURESCALEMODE_BEST:
+ data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR);
+ data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER,
+ GL_LINEAR);
+ break;
+ }
+
+ if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
+ /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
+ SDL_Window *window = SDL_GetWindowFromID(renderer->window);
+ GLint cropRect[4];
+ cropRect[0] = srcrect->x;
+ cropRect[1] = srcrect->y + srcrect->h;
+ cropRect[2] = srcrect->w;
+ cropRect[3] = -srcrect->h;
+ data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
+ cropRect);
+ data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h,
+ 0, dstrect->w, dstrect->h);
+ } else {
+
+ minx = dstrect->x;
+ miny = dstrect->y;
+ maxx = dstrect->x + dstrect->w;
+ maxy = dstrect->y + dstrect->h;
- if (data->GL_OES_draw_texture_supported && data->useDrawTexture) {
- /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */
- SDL_Window *window = SDL_GetWindowFromID(renderer->window);
- GLint cropRect[4];
- cropRect[0] = srcrect->x;
- cropRect[1] = srcrect->y + srcrect->h;
- cropRect[2] = srcrect->w;
- cropRect[3] = -srcrect->h;
- data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, cropRect);
- data->glDrawTexiOES(dstrect->x, window->h - dstrect->y - dstrect->h, 0, dstrect->w, dstrect->h);
- }
- else {
-
- minx = dstrect->x;
- miny = dstrect->y;
- maxx = dstrect->x + dstrect->w;
- maxy = dstrect->y + dstrect->h;
-
- minu = (GLfloat) srcrect->x / texture->w;
- minu *= texturedata->texw;
- maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
- maxu *= texturedata->texw;
- minv = (GLfloat) srcrect->y / texture->h;
- minv *= texturedata->texh;
- maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
- maxv *= texturedata->texh;
-
- GLshort vertices[8];
- GLfloat texCoords[8];
-
- vertices[0] = minx; vertices[1] = miny;
- vertices[2] = maxx; vertices[3] = miny;
- vertices[4] = minx; vertices[5] = maxy;
- vertices[6] = maxx; vertices[7] = maxy;
-
- texCoords[0] = minu; texCoords[1] = minv;
- texCoords[2] = maxu; texCoords[3] = minv;
- texCoords[4] = minu; texCoords[5] = maxv;
- texCoords[6] = maxu; texCoords[7] = maxv;
-
- data->glVertexPointer(2, GL_SHORT, 0, vertices);
- data->glEnableClientState(GL_VERTEX_ARRAY);
- data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
- data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
- data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- }
-
+ minu = (GLfloat) srcrect->x / texture->w;
+ minu *= texturedata->texw;
+ maxu = (GLfloat) (srcrect->x + srcrect->w) / texture->w;
+ maxu *= texturedata->texw;
+ minv = (GLfloat) srcrect->y / texture->h;
+ minv *= texturedata->texh;
+ maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
+ maxv *= texturedata->texh;
+
+ GLshort vertices[8];
+ GLfloat texCoords[8];
+
+ vertices[0] = minx;
+ vertices[1] = miny;
+ vertices[2] = maxx;
+ vertices[3] = miny;
+ vertices[4] = minx;
+ vertices[5] = maxy;
+ vertices[6] = maxx;
+ vertices[7] = maxy;
+
+ texCoords[0] = minu;
+ texCoords[1] = minv;
+ texCoords[2] = maxu;
+ texCoords[3] = minv;
+ texCoords[4] = minu;
+ texCoords[5] = maxv;
+ texCoords[6] = maxu;
+ texCoords[7] = maxv;
+
+ data->glVertexPointer(2, GL_SHORT, 0, vertices);
+ data->glEnableClientState(GL_VERTEX_ARRAY);
+ data->glTexCoordPointer(2, GL_FLOAT, 0, texCoords);
+ data->glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ data->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
+
+ }
+
return 0;
}
@@ -781,7 +797,7 @@
return;
}
if (data->texture) {
- glDeleteTextures(1, &data->texture);
+ glDeleteTextures(1, &data->texture);
}
if (data->pixels) {
SDL_free(data->pixels);
--- a/src/video/SDL_sysvideo.h Mon Sep 15 04:31:30 2008 +0000
+++ b/src/video/SDL_sysvideo.h Mon Sep 15 04:32:36 2008 +0000
@@ -37,95 +37,99 @@
typedef struct SDL_VideoDevice SDL_VideoDevice;
/* Define the SDL texture structure */
-struct SDL_Texture {
- Uint32 id;
+struct SDL_Texture
+{
+ Uint32 id;
- Uint32 format; /**< The pixel format of the texture */
- int access; /**< SDL_TextureAccess */
- int w; /**< The width of the texture */
- int h; /**< The height of the texture */
- int modMode;/**< The texture modulation mode */
- int blendMode; /**< The texture blend mode */
- int scaleMode; /**< The texture scale mode */
- Uint8 r, g, b, a; /**< Texture modulation values */
+ Uint32 format; /**< The pixel format of the texture */
+ int access; /**< SDL_TextureAccess */
+ int w; /**< The width of the texture */
+ int h; /**< The height of the texture */
+ int modMode; /**< The texture modulation mode */
+ int blendMode; /**< The texture blend mode */
+ int scaleMode; /**< The texture scale mode */
+ Uint8 r, g, b, a; /**< Texture modulation values */
- SDL_Renderer *renderer;
+ SDL_Renderer *renderer;
- void *driverdata; /**< Driver specific texture representation */
+ void *driverdata; /**< Driver specific texture representation */
- SDL_Texture *next;
+ SDL_Texture *next;
};
/* Define the SDL renderer structure */
-struct SDL_Renderer {
- int (*ActivateRenderer) (SDL_Renderer * renderer);
- int (*DisplayModeChanged) (SDL_Renderer * renderer);
- int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
- int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
- void **pixels, int *pitch);
- int (*SetTexturePalette) (SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Color * colors, int firstcolor,
- int ncolors);
- int (*GetTexturePalette) (SDL_Renderer * renderer, SDL_Texture * texture,
- SDL_Color * colors, int firstcolor,
- int ncolors);
- int (*SetTextureColorMod) (SDL_Renderer * renderer,
- SDL_Texture * texture);
- int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
- SDL_Texture * texture);
- int (*SetTextureBlendMode) (SDL_Renderer * renderer,
- SDL_Texture * texture);
- int (*SetTextureScaleMode) (SDL_Renderer * renderer,
- SDL_Texture * texture);
- int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, const void *pixels,
- int pitch);
- int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * rect, int markDirty, void **pixels,
- int *pitch);
- void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
- void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
- int numrects, const SDL_Rect * rects);
- int (*RenderFill) (SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
- Uint8 a, const SDL_Rect * rect);
- int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
- const SDL_Rect * srcrect, const SDL_Rect * dstrect);
- void (*RenderPresent) (SDL_Renderer * renderer);
- void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+struct SDL_Renderer
+{
+ int (*ActivateRenderer) (SDL_Renderer * renderer);
+ int (*DisplayModeChanged) (SDL_Renderer * renderer);
+ int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+ int (*QueryTexturePixels) (SDL_Renderer * renderer, SDL_Texture * texture,
+ void **pixels, int *pitch);
+ int (*SetTexturePalette) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Color * colors, int firstcolor,
+ int ncolors);
+ int (*GetTexturePalette) (SDL_Renderer * renderer, SDL_Texture * texture,
+ SDL_Color * colors, int firstcolor,
+ int ncolors);
+ int (*SetTextureColorMod) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*SetTextureAlphaMod) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*SetTextureBlendMode) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*SetTextureScaleMode) (SDL_Renderer * renderer,
+ SDL_Texture * texture);
+ int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, const void *pixels,
+ int pitch);
+ int (*LockTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * rect, int markDirty, void **pixels,
+ int *pitch);
+ void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
+ void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
+ int numrects, const SDL_Rect * rects);
+ int (*RenderFill) (SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
+ Uint8 a, const SDL_Rect * rect);
+ int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
+ const SDL_Rect * srcrect, const SDL_Rect * dstrect);
+ void (*RenderPresent) (SDL_Renderer * renderer);
+ void (*DestroyTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
- void (*DestroyRenderer) (SDL_Renderer * renderer);
+ void (*DestroyRenderer) (SDL_Renderer * renderer);
- /* The current renderer info */
- SDL_RendererInfo info;
+ /* The current renderer info */
+ SDL_RendererInfo info;
- /* The window associated with the renderer */
- SDL_WindowID window;
+ /* The window associated with the renderer */
+ SDL_WindowID window;
- void *driverdata;
+ void *driverdata;
};
/* Define the SDL render driver structure */
-struct SDL_RenderDriver {
- SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
+struct SDL_RenderDriver
+{
+ SDL_Renderer *(*CreateRenderer) (SDL_Window * window, Uint32 flags);
- /* Info about the renderer capabilities */
- SDL_RendererInfo info;
+ /* Info about the renderer capabilities */
+ SDL_RendererInfo info;
};
/* Define the SDL window structure, corresponding to toplevel windows */
-struct SDL_Window {
- Uint32 id;
+struct SDL_Window
+{
+ Uint32 id;
- char *title;
- int x, y;
- int w, h;
- Uint32 flags;
+ char *title;
+ int x, y;
+ int w, h;
+ Uint32 flags;
- int display;
- SDL_Renderer *renderer;
+ int display;
+ SDL_Renderer *renderer;
- void *userdata;
- void *driverdata;
+ void *userdata;
+ void *driverdata;
};
#define FULLSCREEN_VISIBLE(W) \
(((W)->flags & SDL_WINDOW_FULLSCREEN) && \
@@ -136,177 +140,181 @@
* Define the SDL display structure This corresponds to physical monitors
* attached to the system.
*/
-struct SDL_VideoDisplay {
- int max_display_modes;
- int num_display_modes;
- SDL_DisplayMode *display_modes;
- SDL_DisplayMode desktop_mode;
- SDL_DisplayMode current_mode;
- SDL_DisplayMode fullscreen_mode;
- SDL_Palette *palette;
+struct SDL_VideoDisplay
+{
+ int max_display_modes;
+ int num_display_modes;
+ SDL_DisplayMode *display_modes;
+ SDL_DisplayMode desktop_mode;
+ SDL_DisplayMode current_mode;
+ SDL_DisplayMode fullscreen_mode;
+ SDL_Palette *palette;
- Uint16 *gamma;
- Uint16 *saved_gamma; /* (just offset into gamma) */
+ Uint16 *gamma;
+ Uint16 *saved_gamma; /* (just offset into gamma) */
- int num_render_drivers;
- SDL_RenderDriver *render_drivers;
+ int num_render_drivers;
+ SDL_RenderDriver *render_drivers;
- int num_windows;
- SDL_Window *windows;
+ int num_windows;
+ SDL_Window *windows;
- SDL_Renderer *current_renderer;
+ SDL_Renderer *current_renderer;
- /* The hash list of textures */
- SDL_Texture *textures[64];
+ /* The hash list of textures */
+ SDL_Texture *textures[64];
- SDL_VideoDevice *device;
+ SDL_VideoDevice *device;
- void *driverdata;
+ void *driverdata;
};
/* Define the SDL video driver structure */
#define _THIS SDL_VideoDevice *_this
-struct SDL_VideoDevice {
- /* * * */
- /* The name of this video driver */
- const char *name;
+struct SDL_VideoDevice
+{
+ /* * * */
+ /* The name of this video driver */
+ const char *name;
- /* * * */
- /* Initialization/Query functions */
+ /* * * */
+ /* Initialization/Query functions */
- /*
- * Initialize the native video subsystem, filling in the list of
- * displays for this driver, returning 0 or -1 if there's an error.
- */
- int (*VideoInit) (_THIS);
+ /*
+ * Initialize the native video subsystem, filling in the list of
+ * displays for this driver, returning 0 or -1 if there's an error.
+ */
+ int (*VideoInit) (_THIS);
- /*
- * Reverse the effects VideoInit() -- called if VideoInit() fails or
- * if the application is shutting down the video subsystem.
- */
- void (*VideoQuit) (_THIS);
+ /*
+ * Reverse the effects VideoInit() -- called if VideoInit() fails or
+ * if the application is shutting down the video subsystem.
+ */
+ void (*VideoQuit) (_THIS);
- /* * * */
- /*
- * Display functions
- */
+ /* * * */
+ /*
+ * Display functions
+ */
- /*
- * Get a list of the available display modes. e.g.
- * SDL_AddDisplayMode(_this->current_display, mode)
- */
- void (*GetDisplayModes) (_THIS);
+ /*
+ * Get a list of the available display modes. e.g.
+ * SDL_AddDisplayMode(_this->current_display, mode)
+ */
+ void (*GetDisplayModes) (_THIS);
- /*
- * Setting the display mode is independent of creating windows, so
- * when the display mode is changed, all existing windows should have
- * their data updated accordingly, including the display surfaces
- * associated with them.
- */
- int (*SetDisplayMode) (_THIS, SDL_DisplayMode * mode);
+ /*
+ * Setting the display mode is independent of creating windows, so
+ * when the display mode is changed, all existing windows should have
+ * their data updated accordingly, including the display surfaces
+ * associated with them.
+ */
+ int (*SetDisplayMode) (_THIS, SDL_DisplayMode * mode);
- /* Set the color entries of the display palette */
- int (*SetDisplayPalette) (_THIS, SDL_Palette * palette);
+ /* Set the color entries of the display palette */
+ int (*SetDisplayPalette) (_THIS, SDL_Palette * palette);
- /* Get the color entries of the display palette */
- int (*GetDisplayPalette) (_THIS, SDL_Palette * palette);
+ /* Get the color entries of the display palette */
+ int (*GetDisplayPalette) (_THIS, SDL_Palette * palette);
- /* Set the gamma ramp */
- int (*SetDisplayGammaRamp) (_THIS, Uint16 * ramp);
+ /* Set the gamma ramp */
+ int (*SetDisplayGammaRamp) (_THIS, Uint16 * ramp);
- /* Get the gamma ramp */
- int (*GetDisplayGammaRamp) (_THIS, Uint16 * ramp);
+ /* Get the gamma ramp */
+ int (*GetDisplayGammaRamp) (_THIS, Uint16 * ramp);
- /* * * */
- /*
- * Window functions
- */
- int (*CreateWindow) (_THIS, SDL_Window * window);
- int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data);
- void (*SetWindowTitle) (_THIS, SDL_Window * window);
- void (*SetWindowPosition) (_THIS, SDL_Window * window);
- void (*SetWindowSize) (_THIS, SDL_Window * window);
- void (*ShowWindow) (_THIS, SDL_Window * window);
- void (*HideWindow) (_THIS, SDL_Window * window);
- void (*RaiseWindow) (_THIS, SDL_Window * window);
- void (*MaximizeWindow) (_THIS, SDL_Window * window);
- void (*MinimizeWindow) (_THIS, SDL_Window * window);
- void (*RestoreWindow) (_THIS, SDL_Window * window);
- void (*SetWindowGrab) (_THIS, SDL_Window * window);
- void (*DestroyWindow) (_THIS, SDL_Window * window);
+ /* * * */
+ /*
+ * Window functions
+ */
+ int (*CreateWindow) (_THIS, SDL_Window * window);
+ int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data);
+ void (*SetWindowTitle) (_THIS, SDL_Window * window);
+ void (*SetWindowPosition) (_THIS, SDL_Window * window);
+ void (*SetWindowSize) (_THIS, SDL_Window * window);
+ void (*ShowWindow) (_THIS, SDL_Window * window);
+ void (*HideWindow) (_THIS, SDL_Window * window);
+ void (*RaiseWindow) (_THIS, SDL_Window * window);
+ void (*MaximizeWindow) (_THIS, SDL_Window * window);
+ void (*MinimizeWindow) (_THIS, SDL_Window * window);
+ void (*RestoreWindow) (_THIS, SDL_Window * window);
+ void (*SetWindowGrab) (_THIS, SDL_Window * window);
+ void (*DestroyWindow) (_THIS, SDL_Window * window);
- /* Get some platform dependent window information */
- SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
- struct SDL_SysWMinfo * info);
+ /* Get some platform dependent window information */
+ SDL_bool(*GetWindowWMInfo) (_THIS, SDL_Window * window,
+ struct SDL_SysWMinfo * info);
- /* * * */
- /*
- * OpenGL support
- */
- int (*GL_LoadLibrary) (_THIS, const char *path);
- void *(*GL_GetProcAddress) (_THIS, const char *proc);
- SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
- int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
- int (*GL_SetSwapInterval) (_THIS, int interval);
- int (*GL_GetSwapInterval) (_THIS);
- void (*GL_SwapWindow) (_THIS, SDL_Window * window);
- void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
+ /* * * */
+ /*
+ * OpenGL support
+ */
+ int (*GL_LoadLibrary) (_THIS, const char *path);
+ void *(*GL_GetProcAddress) (_THIS, const char *proc);
+ SDL_GLContext(*GL_CreateContext) (_THIS, SDL_Window * window);
+ int (*GL_MakeCurrent) (_THIS, SDL_Window * window, SDL_GLContext context);
+ int (*GL_SetSwapInterval) (_THIS, int interval);
+ int (*GL_GetSwapInterval) (_THIS);
+ void (*GL_SwapWindow) (_THIS, SDL_Window * window);
+ void (*GL_DeleteContext) (_THIS, SDL_GLContext context);
- /* * * */
- /*
- * Event manager functions
- */
- void (*PumpEvents) (_THIS);
+ /* * * */
+ /*
+ * Event manager functions
+ */
+ void (*PumpEvents) (_THIS);
- /* * * */
- /* Data common to all drivers */
- int num_displays;
- SDL_VideoDisplay *displays;
- int current_display;
- Uint32 next_object_id;
+ /* * * */
+ /* Data common to all drivers */
+ int num_displays;
+ SDL_VideoDisplay *displays;
+ int current_display;
+ Uint32 next_object_id;
- /* * * */
- /* Data used by the GL drivers */
- struct {
- int red_size;
- int green_size;
- int blue_size;
- int alpha_size;
- int depth_size;
- int buffer_size;
- int stencil_size;
- int double_buffer;
- int accum_red_size;
- int accum_green_size;
- int accum_blue_size;
- int accum_alpha_size;
- int stereo;
- int multisamplebuffers;
- int multisamplesamples;
- int accelerated;
- int retained_backing;
- int driver_loaded;
- char driver_path[256];
- void *dll_handle;
- } gl_config;
+ /* * * */
+ /* Data used by the GL drivers */
+ struct
+ {
+ int red_size;
+ int green_size;
+ int blue_size;
+ int alpha_size;
+ int depth_size;
+ int buffer_size;
+ int stencil_size;
+ int double_buffer;
+ int accum_red_size;
+ int accum_green_size;
+ int accum_blue_size;
+ int accum_alpha_size;
+ int stereo;
+ int multisamplebuffers;
+ int multisamplesamples;
+ int accelerated;
+ int retained_backing;
+ int driver_loaded;
+ char driver_path[256];
+ void *dll_handle;
+ } gl_config;
- /* * * */
- /* Data private to this driver */
- void *driverdata;
- struct SDL_GLDriverData *gl_data;
+ /* * * */
+ /* Data private to this driver */
+ void *driverdata;
+ struct SDL_GLDriverData *gl_data;
- /* * * */
- /* The function used to dispose of this structure */
- void (*free) (_THIS);
+ /* * * */
+ /* The function used to dispose of this structure */
+ void (*free) (_THIS);
};
-typedef struct VideoBootStrap {
- const char *name;
- const char *desc;
- int (*available) (void);
- SDL_VideoDevice *(*create) (int devindex);
-} VideoBootStrap;
+typedef struct VideoBootStrap
+{
+ const char *name;
+ const char *desc;
+ int (*available) (void);
+ SDL_VideoDevice *(*create) (int devindex);
+} VideoBootStrap;
#if SDL_VIDEO_DRIVER_COCOA
extern VideoBootStrap COCOA_bootstrap;
@@ -381,26 +389,24 @@
#define SDL_CurrentDisplay (_this->displays[_this->current_display])
extern SDL_VideoDevice *SDL_GetVideoDevice();
-extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
-extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
-extern SDL_bool
-SDL_AddDisplayMode(int displayIndex,
- const SDL_DisplayMode * mode);
-extern void
-SDL_AddRenderDriver(int displayIndex,
- const SDL_RenderDriver * driver);
+extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode);
+extern int SDL_AddVideoDisplay(const SDL_VideoDisplay * display);
+extern SDL_bool
+SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode);
+extern void
+SDL_AddRenderDriver(int displayIndex, const SDL_RenderDriver * driver);
-extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
+extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags);
extern SDL_Window *SDL_GetWindowFromID(SDL_WindowID windowID);
extern SDL_VideoDisplay *SDL_GetDisplayFromWindow(SDL_Window * window);
-extern void SDL_OnWindowShown(SDL_Window * window);
-extern void SDL_OnWindowHidden(SDL_Window * window);
-extern void SDL_OnWindowResized(SDL_Window * window);
-extern void SDL_OnWindowFocusGained(SDL_Window * window);
-extern void SDL_OnWindowFocusLost(SDL_Window * window);
+extern void SDL_OnWindowShown(SDL_Window * window);
+extern void SDL_OnWindowHidden(SDL_Window * window);
+extern void SDL_OnWindowResized(SDL_Window * window);
+extern void SDL_OnWindowFocusGained(SDL_Window * window);
+extern void SDL_OnWindowFocusLost(SDL_Window * window);
extern SDL_WindowID SDL_GetFocusWindow(void);
-#endif /* _SDL_sysvideo_h */
+#endif /* _SDL_sysvideo_h */
/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/SDL_video.c Mon Sep 15 04:31:30 2008 +0000
+++ b/src/video/SDL_video.c Mon Sep 15 04:32:36 2008 +0000
@@ -35,7 +35,7 @@
#if SDL_VIDEO_OPENGL_ES
#include "SDL_opengles.h"
-#endif /* SDL_VIDEO_OPENGL_ES */
+#endif /* SDL_VIDEO_OPENGL_ES */
#if SDL_VIDEO_OPENGL
#include "SDL_opengl.h"
@@ -44,128 +44,128 @@
#ifdef CreateWindow
#undef CreateWindow
#endif
-#endif /* SDL_VIDEO_OPENGL */
+#endif /* SDL_VIDEO_OPENGL */
/* Available video drivers */
static VideoBootStrap *bootstrap[] = {
#if SDL_VIDEO_DRIVER_COCOA
- &COCOA_bootstrap,
+ &COCOA_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_X11
- &X11_bootstrap,
+ &X11_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_NANOX
- &NX_bootstrap,
+ &NX_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_IPOD
- &iPod_bootstrap,
+ &iPod_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_WSCONS
- &WSCONS_bootstrap,
+ &WSCONS_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_FBCON
- &FBCON_bootstrap,
+ &FBCON_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DIRECTFB
- &DirectFB_bootstrap,
+ &DirectFB_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_PS2GS
- &PS2GS_bootstrap,
+ &PS2GS_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_VGL
- &VGL_bootstrap,
+ &VGL_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_SVGALIB
- &SVGALIB_bootstrap,
+ &SVGALIB_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_GAPI
- &GAPI_bootstrap,
+ &GAPI_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_WIN32
- &WIN32_bootstrap,
+ &WIN32_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_BWINDOW
- &BWINDOW_bootstrap,
+ &BWINDOW_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_PHOTON
- &ph_bootstrap,
+ &ph_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_EPOC
- &EPOC_bootstrap,
+ &EPOC_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_XBIOS
- &XBIOS_bootstrap,
+ &XBIOS_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_GEM
- &GEM_bootstrap,
+ &GEM_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DC
- &DC_bootstrap,
+ &DC_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_RISCOS
- &RISCOS_bootstrap,
+ &RISCOS_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_OS2FS
- &OS2FSLib_bootstrap,
+ &OS2FSLib_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_NDS
- &NDS_bootstrap,
+ &NDS_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_UIKIT
- &UIKIT_bootstrap,
+ &UIKIT_bootstrap,
#endif
#if SDL_VIDEO_DRIVER_DUMMY
- &DUMMY_bootstrap,
+ &DUMMY_bootstrap,
#endif
- NULL
+ NULL
};
static SDL_VideoDevice *_this = NULL;
/* Various local functions */
-int SDL_VideoInit(const char *driver_name, Uint32 flags);
-void SDL_VideoQuit(void);
+int SDL_VideoInit(const char *driver_name, Uint32 flags);
+void SDL_VideoQuit(void);
static int
cmpmodes(const void *A, const void *B)
{
- SDL_DisplayMode a = *(const SDL_DisplayMode *) A;
- SDL_DisplayMode b = *(const SDL_DisplayMode *) B;
+ SDL_DisplayMode a = *(const SDL_DisplayMode *) A;
+ SDL_DisplayMode b = *(const SDL_DisplayMode *) B;
- if (a.w != b.w) {
- return b.w - a.w;
- }
- if (a.h != b.h) {
- return b.h - a.h;
- }
- if (SDL_BITSPERPIXEL(a.format) != SDL_BITSPERPIXEL(b.format)) {
- return SDL_BITSPERPIXEL(b.format) - SDL_BITSPERPIXEL(a.format);
- }
- if (a.refresh_rate != b.refresh_rate) {
- return b.refresh_rate - a.refresh_rate;
- }
- return 0;
+ if (a.w != b.w) {
+ return b.w - a.w;
+ }
+ if (a.h != b.h) {
+ return b.h - a.h;
+ }
+ if (SDL_BITSPERPIXEL(a.format) != SDL_BITSPERPIXEL(b.format)) {
+ return SDL_BITSPERPIXEL(b.format) - SDL_BITSPERPIXEL(a.format);
+ }
+ if (a.refresh_rate != b.refresh_rate) {
+ return b.refresh_rate - a.refresh_rate;
+ }
+ return 0;
}
static void
SDL_UninitializedVideo()
{
- SDL_SetError("Video subsystem has not been initialized");
+ SDL_SetError("Video subsystem has not been initialized");
}
int
SDL_GetNumVideoDrivers(void)
{
- return SDL_arraysize(bootstrap) - 1;
+ return SDL_arraysize(bootstrap) - 1;
}
-const char *
+const char *
SDL_GetVideoDriver(int index)
{
- if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
- return bootstrap[index]->name;
- }
- return NULL;
+ if (index >= 0 && index < SDL_GetNumVideoDrivers()) {
+ return bootstrap[index]->name;
+ }
+ return NULL;
}
/*
@@ -174,1045 +174,1045 @@
int
SDL_VideoInit(const char *driver_name, Uint32 flags)
{
- SDL_VideoDevice *video;
- int index;
- int i;
+ SDL_VideoDevice *video;
+ int index;
+ int i;
- /* Toggle the event thread flags, based on OS requirements */
+ /* Toggle the event thread flags, based on OS requirements */
#if defined(MUST_THREAD_EVENTS)
- flags |= SDL_INIT_EVENTTHREAD;
+ flags |= SDL_INIT_EVENTTHREAD;
#elif defined(CANT_THREAD_EVENTS)
- if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) {
- SDL_SetError("OS doesn't support threaded events");
- return -1;
- }
+ if ((flags & SDL_INIT_EVENTTHREAD) == SDL_INIT_EVENTTHREAD) {
+ SDL_SetError("OS doesn't support threaded events");
+ return -1;
+ }
#endif
- /* Start the event loop */
- if (SDL_StartEventLoop(flags) < 0) {
- return -1;
- }
- /* Check to make sure we don't overwrite '_this' */
- if (_this != NULL) {
- SDL_VideoQuit();
- }
- /* Select the proper video driver */
- index = 0;
- video = NULL;
- if (driver_name == NULL) {
- driver_name = SDL_getenv("SDL_VIDEODRIVER");
- }
- if (driver_name != NULL) {
- for (i = 0; bootstrap[i]; ++i) {
- if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
- if (bootstrap[i]->available()) {
- video = bootstrap[i]->create(index);
- }
- break;
- }
- }
- } else {
- for (i = 0; bootstrap[i]; ++i) {
- if (bootstrap[i]->available()) {
- video = bootstrap[i]->create(index);
- if (video != NULL) {
- break;
- }
- }
- }
- }
- if (video == NULL) {
- if (driver_name) {
- SDL_SetError("%s not available", driver_name);
- } else {
- SDL_SetError("No available video device");
- }
- return -1;
- }
- _this = video;
- _this->name = bootstrap[i]->name;
- _this->next_object_id = 1;
+ /* Start the event loop */
+ if (SDL_StartEventLoop(flags) < 0) {
+ return -1;
+ }
+ /* Check to make sure we don't overwrite '_this' */
+ if (_this != NULL) {
+ SDL_VideoQuit();
+ }
+ /* Select the proper video driver */
+ index = 0;
+ video = NULL;
+ if (driver_name == NULL) {
+ driver_name = SDL_getenv("SDL_VIDEODRIVER");
+ }
+ if (driver_name != NULL) {
+ for (i = 0; bootstrap[i]; ++i) {
+ if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
+ if (bootstrap[i]->available()) {
+ video = bootstrap[i]->create(index);
+ }
+ break;
+ }
+ }
+ } else {
+ for (i = 0; bootstrap[i]; ++i) {
+ if (bootstrap[i]->available()) {
+ video = bootstrap[i]->create(index);
+ if (video != NULL) {
+ break;
+ }
+ }
+ }
+ }
+ if (video == NULL) {
+ if (driver_name) {
+ SDL_SetError("%s not available", driver_name);
+ } else {
+ SDL_SetError("No available video device");
+ }
+ return -1;
+ }
+ _this = video;
+ _this->name = bootstrap[i]->name;
+ _this->next_object_id = 1;
- /* Set some very sane GL defaults */
- _this->gl_config.driver_loaded = 0;
- _this->gl_config.dll_handle = NULL;
- _this->gl_config.red_size = 3;
- _this->gl_config.green_size = 3;
- _this->gl_config.blue_size = 2;
- _this->gl_config.alpha_size = 0;
- _this->gl_config.buffer_size = 0;
- _this->gl_config.depth_size = 16;
- _this->gl_config.stencil_size = 0;
- _this->gl_config.double_buffer = 1;
- _this->gl_config.accum_red_size = 0;
- _this->gl_config.accum_green_size = 0;
- _this->gl_config.accum_blue_size = 0;
- _this->gl_config.accum_alpha_size = 0;
- _this->gl_config.stereo = 0;
- _this->gl_config.multisamplebuffers = 0;
- _this->gl_config.multisamplesamples = 0;
- _this->gl_config.retained_backing = 1;
- _this->gl_config.accelerated = -1; /* not known, don't set */
+ /* Set some very sane GL defaults */
+ _this->gl_config.driver_loaded = 0;
+ _this->gl_config.dll_handle = NULL;
+ _this->gl_config.red_size = 3;
+ _this->gl_config.green_size = 3;
+ _this->gl_config.blue_size = 2;
+ _this->gl_config.alpha_size = 0;
+ _this->gl_config.buffer_size = 0;
+ _this->gl_config.depth_size = 16;
+ _this->gl_config.stencil_size = 0;
+ _this->gl_config.double_buffer = 1;
+ _this->gl_config.accum_red_size = 0;
+ _this->gl_config.accum_green_size = 0;
+ _this->gl_config.accum_blue_size = 0;
+ _this->gl_config.accum_alpha_size = 0;
+ _this->gl_config.stereo = 0;
+ _this->gl_config.multisamplebuffers = 0;
+ _this->gl_config.multisamplesamples = 0;
+ _this->gl_config.retained_backing = 1;
+ _this->gl_config.accelerated = -1; /* not known, don't set */
- /* Initialize the video subsystem */
- if (_this->VideoInit(_this) < 0) {
- SDL_VideoQuit();
- return -1;
- }
- /* Make sure some displays were added */
- if (_this->num_displays == 0) {
- SDL_SetError("The video driver did not add any displays");
- SDL_VideoQuit();
- return (-1);
- }
- /* The software renderer is always available */
- for (i = 0; i < _this->num_displays; ++i) {
+ /* Initialize the video subsystem */
+ if (_this->VideoInit(_this) < 0) {
+ SDL_VideoQuit();
+ return -1;
+ }
+ /* Make sure some displays were added */
+ if (_this->num_displays == 0) {
+ SDL_SetError("The video driver did not add any displays");
+ SDL_VideoQuit();
+ return (-1);
+ }
+ /* The software renderer is always available */
+ for (i = 0; i < _this->num_displays; ++i) {
#if SDL_VIDEO_RENDER_OGL
- SDL_AddRenderDriver(i, &GL_RenderDriver);
+ SDL_AddRenderDriver(i, &GL_RenderDriver);
#endif
#if SDL_VIDEO_RENDER_OGL_ES
- SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
+ SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
#endif
- if (_this->displays[i].num_render_drivers > 0) {
- SDL_AddRenderDriver(i, &SW_RenderDriver);
- }
- }
+ if (_this->displays[i].num_render_drivers > 0) {
+ SDL_AddRenderDriver(i, &SW_RenderDriver);
+ }
+ }
- /* We're ready to go! */
- return 0;
+ /* We're ready to go! */
+ return 0;
}
-const char *
+const char *
SDL_GetCurrentVideoDriver()
{
- if (!_this) {
- SDL_UninitializedVideo();
- return NULL;
- }
- return _this->name;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ return _this->name;
}
SDL_VideoDevice *
SDL_GetVideoDevice()
{
- return _this;
+ return _this;
}
int
SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode)
{
- SDL_VideoDisplay display;
+ SDL_VideoDisplay display;
- SDL_zero(display);
- if (desktop_mode) {
- display.desktop_mode = *desktop_mode;
- }
- display.current_mode = display.desktop_mode;
+ SDL_zero(display);
+ if (desktop_mode) {
+ display.desktop_mode = *desktop_mode;
+ }
+ display.current_mode = display.desktop_mode;
- return SDL_AddVideoDisplay(&display);
+ return SDL_AddVideoDisplay(&display);
}
int
SDL_AddVideoDisplay(const SDL_VideoDisplay * display)
{
- SDL_VideoDisplay *displays;
- int index = -1;
+ SDL_VideoDisplay *displays;
+ int index = -1;
- displays =
- SDL_realloc(_this->displays,
- (_this->num_displays + 1) * sizeof(*displays));
- if (displays) {
- index = _this->num_displays++;
- displays[index] = *display;
- displays[index].device = _this;
- _this->displays = displays;
- } else {
- SDL_OutOfMemory();
- }
- return index;
+ displays =
+ SDL_realloc(_this->displays,
+ (_this->num_displays + 1) * sizeof(*displays));
+ if (displays) {
+ index = _this->num_displays++;
+ displays[index] = *display;
+ displays[index].device = _this;
+ _this->displays = displays;
+ } else {
+ SDL_OutOfMemory();
+ }
+ return index;
}
int
SDL_GetNumVideoDisplays(void)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return 0;
- }
- return _this->num_displays;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return 0;
+ }
+ return _this->num_displays;
}
int
SDL_SelectVideoDisplay(int index)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return (-1);
- }
- if (index < 0 || index >= _this->num_displays) {
- SDL_SetError("index must be in the range 0 - %d",
- _this->num_displays - 1);
- return -1;
- }
- _this->current_display = index;
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return (-1);
+ }
+ if (index < 0 || index >= _this->num_displays) {
+ SDL_SetError("index must be in the range 0 - %d",
+ _this->num_displays - 1);
+ return -1;
+ }
+ _this->current_display = index;
+ return 0;
}
int
SDL_GetCurrentVideoDisplay(void)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return (-1);
- }
- return _this->current_display;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return (-1);
+ }
+ return _this->current_display;
}
SDL_bool
SDL_AddDisplayMode(int displayIndex, const SDL_DisplayMode * mode)
{
- SDL_VideoDisplay *display = &_this->displays[displayIndex];
- SDL_DisplayMode *modes;
- int i, nmodes;
+ SDL_VideoDisplay *display = &_this->displays[displayIndex];
+ SDL_DisplayMode *modes;
+ int i, nmodes;
- /* Make sure we don't already have the mode in the list */
- modes = display->display_modes;
- nmodes = display->num_display_modes;
- for (i = nmodes; i--;) {
- if (SDL_memcmp(mode, &modes[i], sizeof(*mode)) == 0) {
- return SDL_FALSE;
- }
- }
+ /* Make sure we don't already have the mode in the list */
+ modes = display->display_modes;
+ nmodes = display->num_display_modes;
+ for (i = nmodes; i--;) {
+ if (SDL_memcmp(mode, &modes[i], sizeof(*mode)) == 0) {
+ return SDL_FALSE;
+ }
+ }
- /* Go ahead and add the new mode */
- if (nmodes == display->max_display_modes) {
- modes =
- SDL_realloc(modes,
- (display->max_display_modes + 32) * sizeof(*modes));
- if (!modes) {
- return SDL_FALSE;
- }
- display->display_modes = modes;
- display->max_display_modes += 32;
- }
- modes[nmodes] = *mode;
- display->num_display_modes++;
+ /* Go ahead and add the new mode */
+ if (nmodes == display->max_display_modes) {
+ modes =
+ SDL_realloc(modes,
+ (display->max_display_modes + 32) * sizeof(*modes));
+ if (!modes) {
+ return SDL_FALSE;
+ }
+ display->display_modes = modes;
+ display->max_display_modes += 32;
+ }
+ modes[nmodes] = *mode;
+ display->num_display_modes++;
- return SDL_TRUE;
+ return SDL_TRUE;
}
int
SDL_GetNumDisplayModes()
{
- if (_this) {
- SDL_VideoDisplay *display = &SDL_CurrentDisplay;
- if (!display->num_display_modes && _this->GetDisplayModes) {
- _this->GetDisplayModes(_this);
- SDL_qsort(display->display_modes, display->num_display_modes,
- sizeof(SDL_DisplayMode), cmpmodes);
- }
- return display->num_display_modes;
- }
- return 0;
+ if (_this) {
+ SDL_VideoDisplay *display = &SDL_CurrentDisplay;
+ if (!display->num_display_modes && _this->GetDisplayModes) {
+ _this->GetDisplayModes(_this);
+ SDL_qsort(display->display_modes, display->num_display_modes,
+ sizeof(SDL_DisplayMode), cmpmodes);
+ }
+ return display->num_display_modes;
+ }
+ return 0;
}
int
SDL_GetDisplayMode(int index, SDL_DisplayMode * mode)
{
- if (index < 0 || index >= SDL_GetNumDisplayModes()) {
- SDL_SetError("index must be in the range of 0 - %d",
- SDL_GetNumDisplayModes() - 1);
- return -1;
- }
- if (mode) {
- *mode = SDL_CurrentDisplay.display_modes[index];
- }
- return 0;
+ if (index < 0 || index >= SDL_GetNumDisplayModes()) {
+ SDL_SetError("index must be in the range of 0 - %d",
+ SDL_GetNumDisplayModes() - 1);
+ return -1;
+ }
+ if (mode) {
+ *mode = SDL_CurrentDisplay.display_modes[index];
+ }
+ return 0;
}
int
SDL_GetDesktopDisplayMode(SDL_DisplayMode * mode)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (mode) {
- *mode = SDL_CurrentDisplay.desktop_mode;
- }
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (mode) {
+ *mode = SDL_CurrentDisplay.desktop_mode;
+ }
+ return 0;
}
int
SDL_GetCurrentDisplayMode(SDL_DisplayMode * mode)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (mode) {
- *mode = SDL_CurrentDisplay.current_mode;
- }
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (mode) {
+ *mode = SDL_CurrentDisplay.current_mode;
+ }
+ return 0;
}
SDL_DisplayMode *
SDL_GetClosestDisplayMode(const SDL_DisplayMode * mode,
- SDL_DisplayMode * closest)
+ SDL_DisplayMode * closest)
{
- Uint32 target_format;
- int target_refresh_rate;
- int i;
- SDL_DisplayMode *current, *match;
+ Uint32 target_format;
+ int target_refresh_rate;
+ int i;
+ SDL_DisplayMode *current, *match;
- if (!_this || !mode || !closest) {
- return NULL;
- }
- /* Default to the desktop format */
- if (mode->format) {
- target_format = mode->format;
- } else {
- target_format = SDL_CurrentDisplay.desktop_mode.format;
- }
+ if (!_this || !mode || !closest) {
+ return NULL;
+ }
+ /* Default to the desktop format */
+ if (mode->format) {
+ target_format = mode->format;
+ } else {
+ target_format = SDL_CurrentDisplay.desktop_mode.format;
+ }
- /* Default to the desktop refresh rate */
- if (mode->refresh_rate) {
- target_refresh_rate = mode->refresh_rate;
- } else {
- target_refresh_rate = SDL_CurrentDisplay.desktop_mode.refresh_rate;
- }
+ /* Default to the desktop refresh rate */
+ if (mode->refresh_rate) {
+ target_refresh_rate = mode->refresh_rate;
+ } else {
+ target_refresh_rate = SDL_CurrentDisplay.desktop_mode.refresh_rate;
+ }
- match = NULL;
- for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
- current = &SDL_CurrentDisplay.display_modes[i];
+ match = NULL;
+ for (i = 0; i < SDL_GetNumDisplayModes(); ++i) {
+ current = &SDL_CurrentDisplay.display_modes[i];
- if ((current->w && current->h) &&
- (current->w < mode->w || current->h < mode->h)) {
- /* Out of sorted modes large enough here */
- break;
- }
- if (!match || current->w < match->w || current->h < match->h) {
- match = current;
- continue;
- }
- if (current->format != match->format) {
- /* Sorted highest depth to lowest */
- if (current->format == target_format ||
- (SDL_BITSPERPIXEL(current->format) >=
- SDL_BITSPERPIXEL(target_format)
- && SDL_PIXELTYPE(current->format) ==
- SDL_PIXELTYPE(target_format))) {
- match = current;
- }
- continue;
- }
- if (current->refresh_rate != match->refresh_rate) {
- /* Sorted highest refresh to lowest */
- if (current->refresh_rate >= target_refresh_rate) {
- match = current;
- }
- }
- }
- if (match) {
- if (match->format) {
- closest->format = match->format;
- } else {
- closest->format = mode->format;
- }
- if (match->w && match->h) {
- closest->w = match->w;
- closest->h = match->h;
- } else {
- closest->w = mode->w;
- closest->h = mode->h;
- }
- if (match->refresh_rate) {
- closest->refresh_rate = match->refresh_rate;
- } else {
- closest->refresh_rate = mode->refresh_rate;
- }
- closest->driverdata = match->driverdata;
+ if ((current->w && current->h) &&
+ (current->w < mode->w || current->h < mode->h)) {
+ /* Out of sorted modes large enough here */
+ break;
+ }
+ if (!match || current->w < match->w || current->h < match->h) {
+ match = current;
+ continue;
+ }
+ if (current->format != match->format) {
+ /* Sorted highest depth to lowest */
+ if (current->format == target_format ||
+ (SDL_BITSPERPIXEL(current->format) >=
+ SDL_BITSPERPIXEL(target_format)
+ && SDL_PIXELTYPE(current->format) ==
+ SDL_PIXELTYPE(target_format))) {
+ match = current;
+ }
+ continue;
+ }
+ if (current->refresh_rate != match->refresh_rate) {
+ /* Sorted highest refresh to lowest */
+ if (current->refresh_rate >= target_refresh_rate) {
+ match = current;
+ }
+ }
+ }
+ if (match) {
+ if (match->format) {
+ closest->format = match->format;
+ } else {
+ closest->format = mode->format;
+ }
+ if (match->w && match->h) {
+ closest->w = match->w;
+ closest->h = match->h;
+ } else {
+ closest->w = mode->w;
+ closest->h = mode->h;
+ }
+ if (match->refresh_rate) {
+ closest->refresh_rate = match->refresh_rate;
+ } else {
+ closest->refresh_rate = mode->refresh_rate;
+ }
+ closest->driverdata = match->driverdata;
- /*
- * Pick some reasonable defaults if the app and driver don't
- * care
- */
- if (!closest->format) {
- closest->format = SDL_PIXELFORMAT_RGB888;
- }
- if (!closest->w) {
- closest->w = 640;
- }
- if (!closest->h) {
- closest->h = 480;
- }
- return closest;
- }
- return NULL;
+ /*
+ * Pick some reasonable defaults if the app and driver don't
+ * care
+ */
+ if (!closest->format) {
+ closest->format = SDL_PIXELFORMAT_RGB888;
+ }
+ if (!closest->w) {
+ closest->w = 640;
+ }
+ if (!closest->h) {
+ closest->h = 480;
+ }
+ return closest;
+ }
+ return NULL;
}
int
SDL_SetDisplayMode(const SDL_DisplayMode * mode)
{
- SDL_VideoDisplay *display;
- SDL_DisplayMode display_mode;
- SDL_DisplayMode current_mode;
- int i, ncolors;
+ SDL_VideoDisplay *display;
+ SDL_DisplayMode display_mode;
+ SDL_DisplayMode current_mode;
+ int i, ncolors;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- display = &SDL_CurrentDisplay;
- if (!mode) {
- mode = &display->desktop_mode;
- }
- display_mode = *mode;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ display = &SDL_CurrentDisplay;
+ if (!mode) {
+ mode = &display->desktop_mode;
+ }
+ display_mode = *mode;
- /* Default to the current mode */
- if (!display_mode.format) {
- display_mode.format = display->current_mode.format;
- }
- if (!display_mode.w) {
- display_mode.w = display->current_mode.w;
- }
- if (!display_mode.h) {
- display_mode.h = display->current_mode.h;
- }
- if (!display_mode.refresh_rate) {
- display_mode.refresh_rate = display->current_mode.refresh_rate;
- }
- /* Get a good video mode, the closest one possible */
- if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
- SDL_SetError("No video mode large enough for %dx%d",
- display_mode.w, display_mode.h);
- return -1;
- }
- /* See if there's anything left to do */
- SDL_GetCurrentDisplayMode(¤t_mode);
- if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) {
- return 0;
- }
- /* Actually change the display mode */
- if (_this->SetDisplayMode(_this, &display_mode) < 0) {
- return -1;
- }
- display->current_mode = display_mode;
+ /* Default to the current mode */
+ if (!display_mode.format) {
+ display_mode.format = display->current_mode.format;
+ }
+ if (!display_mode.w) {
+ display_mode.w = display->current_mode.w;
+ }
+ if (!display_mode.h) {
+ display_mode.h = display->current_mode.h;
+ }
+ if (!display_mode.refresh_rate) {
+ display_mode.refresh_rate = display->current_mode.refresh_rate;
+ }
+ /* Get a good video mode, the closest one possible */
+ if (!SDL_GetClosestDisplayMode(&display_mode, &display_mode)) {
+ SDL_SetError("No video mode large enough for %dx%d",
+ display_mode.w, display_mode.h);
+ return -1;
+ }
+ /* See if there's anything left to do */
+ SDL_GetCurrentDisplayMode(¤t_mode);
+ if (SDL_memcmp(&display_mode, ¤t_mode, sizeof(display_mode)) == 0) {
+ return 0;
+ }
+ /* Actually change the display mode */
+ if (_this->SetDisplayMode(_this, &display_mode) < 0) {
+ return -1;
+ }
+ display->current_mode = display_mode;
- /* Set up a palette, if necessary */
- if (SDL_ISPIXELFORMAT_INDEXED(display_mode.format)) {
- ncolors = (1 << SDL_BITSPERPIXEL(display_mode.format));
- } else {
- ncolors = 0;
- }
- if ((!ncolors && display->palette) || (ncolors && !display->palette)
- || (ncolors && ncolors != display->palette->ncolors)) {
- if (display->palette) {
- SDL_FreePalette(display->palette);
- display->palette = NULL;
- }
- if (ncolors) {
- display->palette = SDL_AllocPalette(ncolors);
- if (!display->palette) {
- return -1;
- }
- SDL_DitherColors(display->palette->colors,
- SDL_BITSPERPIXEL(display_mode.format));
- }
- }
- /* Move any fullscreen windows into position */
- for (i = 0; i < display->num_windows; ++i) {
- SDL_Window *window = &display->windows[i];
- if (FULLSCREEN_VISIBLE(window)) {
- SDL_SetWindowPosition(window->id, SDL_WINDOWPOS_CENTERED,
- SDL_WINDOWPOS_CENTERED);
- }
- }
+ /* Set up a palette, if necessary */
+ if (SDL_ISPIXELFORMAT_INDEXED(display_mode.format)) {
+ ncolors = (1 << SDL_BITSPERPIXEL(display_mode.format));
+ } else {
+ ncolors = 0;
+ }
+ if ((!ncolors && display->palette) || (ncolors && !display->palette)
+ || (ncolors && ncolors != display->palette->ncolors)) {
+ if (display->palette) {
+ SDL_FreePalette(display->palette);
+ display->palette = NULL;
+ }
+ if (ncolors) {
+ display->palette = SDL_AllocPalette(ncolors);
+ if (!display->palette) {
+ return -1;
+ }
+ SDL_DitherColors(display->palette->colors,
+ SDL_BITSPERPIXEL(display_mode.format));
+ }
+ }
+ /* Move any fullscreen windows into position */
+ for (i = 0; i < display->num_windows; ++i) {
+ SDL_Window *window = &display->windows[i];
+ if (FULLSCREEN_VISIBLE(window)) {
+ SDL_SetWindowPosition(window->id, SDL_WINDOWPOS_CENTERED,
+ SDL_WINDOWPOS_CENTERED);
+ }
+ }
- return 0;
+ return 0;
}
int
SDL_SetFullscreenDisplayMode(const SDL_DisplayMode * mode)
{
- SDL_VideoDisplay *display;
- SDL_DisplayMode fullscreen_mode;
- int i;
+ SDL_VideoDisplay *display;
+ SDL_DisplayMode fullscreen_mode;
+ int i;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- display = &SDL_CurrentDisplay;
- if (!mode) {
- mode = &display->desktop_mode;
- }
- SDL_GetClosestDisplayMode(mode, &fullscreen_mode);
- if (SDL_memcmp
- (&fullscreen_mode, &display->fullscreen_mode,
- sizeof(fullscreen_mode)) == 0) {
- /* Nothing to do... */
- return 0;
- }
- display->fullscreen_mode = fullscreen_mode;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ display = &SDL_CurrentDisplay;
+ if (!mode) {
+ mode = &display->desktop_mode;
+ }
+ SDL_GetClosestDisplayMode(mode, &fullscreen_mode);
+ if (SDL_memcmp
+ (&fullscreen_mode, &display->fullscreen_mode,
+ sizeof(fullscreen_mode)) == 0) {
+ /* Nothing to do... */
+ return 0;
+ }
+ display->fullscreen_mode = fullscreen_mode;
- /* Actually set the mode if we have a fullscreen window visible */
- for (i = 0; i < display->num_windows; ++i) {
- SDL_Window *window = &display->windows[i];
- if (FULLSCREEN_VISIBLE(window)) {
- if (SDL_SetDisplayMode(&display->fullscreen_mode) < 0) {
- return -1;
- }
- }
- if (window->flags & SDL_WINDOW_FULLSCREEN) {
- SDL_OnWindowResized(window);
- }
- }
- return 0;
+ /* Actually set the mode if we have a fullscreen window visible */
+ for (i = 0; i < display->num_windows; ++i) {
+ SDL_Window *window = &display->windows[i];
+ if (FULLSCREEN_VISIBLE(window)) {
+ if (SDL_SetDisplayMode(&display->fullscreen_mode) < 0) {
+ return -1;
+ }
+ }
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_OnWindowResized(window);
+ }
+ }
+ return 0;
}
int
SDL_GetFullscreenDisplayMode(SDL_DisplayMode * mode)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (mode) {
- *mode = SDL_CurrentDisplay.fullscreen_mode;
- }
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (mode) {
+ *mode = SDL_CurrentDisplay.fullscreen_mode;
+ }
+ return 0;
}
int
SDL_SetDisplayPalette(const SDL_Color * colors, int firstcolor, int ncolors)
{
- SDL_Palette *palette;
- int status = 0;
+ SDL_Palette *palette;
+ int status = 0;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- palette = SDL_CurrentDisplay.palette;
- if (!palette) {
- SDL_SetError("Display mode does not have a palette");
- return -1;
- }
- status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ palette = SDL_CurrentDisplay.palette;
+ if (!palette) {
+ SDL_SetError("Display mode does not have a palette");
+ return -1;
+ }
+ status = SDL_SetPaletteColors(palette, colors, firstcolor, ncolors);
- if (_this->SetDisplayPalette) {
- if (_this->SetDisplayPalette(_this, palette) < 0) {
- status = -1;
- }
- }
- return status;
+ if (_this->SetDisplayPalette) {
+ if (_this->SetDisplayPalette(_this, palette) < 0) {
+ status = -1;
+ }
+ }
+ return status;
}
int
SDL_GetDisplayPalette(SDL_Color * colors, int firstcolor, int ncolors)
{
- SDL_Palette *palette;
+ SDL_Palette *palette;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- palette = SDL_CurrentDisplay.palette;
- if (!palette->ncolors) {
- SDL_SetError("Display mode does not have a palette");
- return -1;
- }
- if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
- SDL_SetError("Palette indices are out of range");
- return -1;
- }
- SDL_memcpy(colors, &palette->colors[firstcolor],
- ncolors * sizeof(*colors));
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ palette = SDL_CurrentDisplay.palette;
+ if (!palette->ncolors) {
+ SDL_SetError("Display mode does not have a palette");
+ return -1;
+ }
+ if (firstcolor < 0 || (firstcolor + ncolors) > palette->ncolors) {
+ SDL_SetError("Palette indices are out of range");
+ return -1;
+ }
+ SDL_memcpy(colors, &palette->colors[firstcolor],
+ ncolors * sizeof(*colors));
+ return 0;
}
SDL_WindowID
SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
{
- const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN |
- SDL_WINDOW_OPENGL |
- SDL_WINDOW_BORDERLESS |
- SDL_WINDOW_RESIZABLE);
- SDL_VideoDisplay *display;
- SDL_Window window;
- int num_windows;
- SDL_Window *windows;
+ const Uint32 allowed_flags = (SDL_WINDOW_FULLSCREEN |
+ SDL_WINDOW_OPENGL |
+ SDL_WINDOW_BORDERLESS |
+ SDL_WINDOW_RESIZABLE);
+ SDL_VideoDisplay *display;
+ SDL_Window window;
+ int num_windows;
+ SDL_Window *windows;
- if (!_this) {
- SDL_UninitializedVideo();
- return 0;
- }
- if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
- SDL_SetError("No OpenGL support in video driver");
- return 0;
- }
- /* Fullscreen windows don't have any window decorations */
- if (flags & SDL_WINDOW_FULLSCREEN) {
- flags |= SDL_WINDOW_BORDERLESS;
- flags &= ~SDL_WINDOW_RESIZABLE;
- }
- SDL_zero(window);
- window.id = _this->next_object_id++;
- window.x = x;
- window.y = y;
- window.w = w;
- window.h = h;
- window.flags = (flags & allowed_flags);
- window.display = _this->current_display;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return 0;
+ }
+ if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
+ SDL_SetError("No OpenGL support in video driver");
+ return 0;
+ }
+ /* Fullscreen windows don't have any window decorations */
+ if (flags & SDL_WINDOW_FULLSCREEN) {
+ flags |= SDL_WINDOW_BORDERLESS;
+ flags &= ~SDL_WINDOW_RESIZABLE;
+ }
+ SDL_zero(window);
+ window.id = _this->next_object_id++;
+ window.x = x;
+ window.y = y;
+ window.w = w;
+ window.h = h;
+ window.flags = (flags & allowed_flags);
+ window.display = _this->current_display;
- if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
- return 0;
- }
- display = &SDL_CurrentDisplay;
- num_windows = display->num_windows;
- windows =
- SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
- if (!windows) {
- if (_this->DestroyWindow) {
- _this->DestroyWindow(_this, &window);
- }
- return 0;
- }
- windows[num_windows] = window;
- display->windows = windows;
- display->num_windows++;
+ if (_this->CreateWindow && _this->CreateWindow(_this, &window) < 0) {
+ return 0;
+ }
+ display = &SDL_CurrentDisplay;
+ num_windows = display->num_windows;
+ windows =
+ SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
+ if (!windows) {
+ if (_this->DestroyWindow) {
+ _this->DestroyWindow(_this, &window);
+ }
+ return 0;
+ }
+ windows[num_windows] = window;
+ display->windows = windows;
+ display->num_windows++;
- if (title) {
- SDL_SetWindowTitle(window.id, title);
- }
- if (flags & SDL_WINDOW_MAXIMIZED) {
- SDL_MaximizeWindow(window.id);
- }
- if (flags & SDL_WINDOW_MINIMIZED) {
- SDL_MinimizeWindow(window.id);
- }
- if (flags & SDL_WINDOW_SHOWN) {
- SDL_ShowWindow(window.id);
- }
- if (flags & SDL_WINDOW_INPUT_GRABBED) {
- SDL_SetWindowGrab(window.id, 1);
- }
- return window.id;
+ if (title) {
+ SDL_SetWindowTitle(window.id, title);
+ }
+ if (flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_MaximizeWindow(window.id);
+ }
+ if (flags & SDL_WINDOW_MINIMIZED) {
+ SDL_MinimizeWindow(window.id);
+ }
+ if (flags & SDL_WINDOW_SHOWN) {
+ SDL_ShowWindow(window.id);
+ }
+ if (flags & SDL_WINDOW_INPUT_GRABBED) {
+ SDL_SetWindowGrab(window.id, 1);
+ }
+ return window.id;
}
SDL_WindowID
SDL_CreateWindowFrom(const void *data)
{
- SDL_VideoDisplay *display;
- SDL_Window window;
- int num_windows;
- SDL_Window *windows;
+ SDL_VideoDisplay *display;
+ SDL_Window window;
+ int num_windows;
+ SDL_Window *windows;
- if (!_this) {
- SDL_UninitializedVideo();
- return (0);
- }
- SDL_zero(window);
- window.id = _this->next_object_id++;
- window.display = _this->current_display;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return (0);
+ }
+ SDL_zero(window);
+ window.id = _this->next_object_id++;
+ window.display = _this->current_display;
- if (!_this->CreateWindowFrom ||
- _this->CreateWindowFrom(_this, &window, data) < 0) {
- return 0;
- }
- display = &SDL_CurrentDisplay;
- num_windows = display->num_windows;
- windows =
- SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
- if (!windows) {
- if (_this->DestroyWindow) {
- _this->DestroyWindow(_this, &window);
- }
- if (window.title) {
- SDL_free(window.title);
- }
- return 0;
- }
- windows[num_windows] = window;
- display->windows = windows;
- display->num_windows++;
+ if (!_this->CreateWindowFrom ||
+ _this->CreateWindowFrom(_this, &window, data) < 0) {
+ return 0;
+ }
+ display = &SDL_CurrentDisplay;
+ num_windows = display->num_windows;
+ windows =
+ SDL_realloc(display->windows, (num_windows + 1) * sizeof(*windows));
+ if (!windows) {
+ if (_this->DestroyWindow) {
+ _this->DestroyWindow(_this, &window);
+ }
+ if (window.title) {
+ SDL_free(window.title);
+ }
+ return 0;
+ }
+ windows[num_windows] = window;
+ display->windows = windows;
+ display->num_windows++;
- return window.id;
+ return window.id;
}
int
SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
{
- char *title = window->title;
+ char *title = window->title;
- if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
- SDL_SetError("No OpenGL support in video driver");
- return -1;
- }
- if (_this->DestroyWindow) {
- _this->DestroyWindow(_this, window);
- }
- window->title = NULL;
- window->flags =
- (flags &
- ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_SHOWN |
- SDL_WINDOW_INPUT_GRABBED));
+ if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
+ SDL_SetError("No OpenGL support in video driver");
+ return -1;
+ }
+ if (_this->DestroyWindow) {
+ _this->DestroyWindow(_this, window);
+ }
+ window->title = NULL;
+ window->flags =
+ (flags &
+ ~(SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED | SDL_WINDOW_SHOWN |
+ SDL_WINDOW_INPUT_GRABBED));
- if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
- return -1;
- }
- if (title) {
- SDL_SetWindowTitle(window->id, title);
- SDL_free(title);
- }
- if (flags & SDL_WINDOW_MAXIMIZED) {
- SDL_MaximizeWindow(window->id);
- }
- if (flags & SDL_WINDOW_MINIMIZED) {
- SDL_MinimizeWindow(window->id);
- }
- if (flags & SDL_WINDOW_SHOWN) {
- SDL_ShowWindow(window->id);
- }
- if (flags & SDL_WINDOW_INPUT_GRABBED) {
- SDL_SetWindowGrab(window->id, 1);
- }
- return 0;
+ if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) {
+ return -1;
+ }
+ if (title) {
+ SDL_SetWindowTitle(window->id, title);
+ SDL_free(title);
+ }
+ if (flags & SDL_WINDOW_MAXIMIZED) {
+ SDL_MaximizeWindow(window->id);
+ }
+ if (flags & SDL_WINDOW_MINIMIZED) {
+ SDL_MinimizeWindow(window->id);
+ }
+ if (flags & SDL_WINDOW_SHOWN) {
+ SDL_ShowWindow(window->id);
+ }
+ if (flags & SDL_WINDOW_INPUT_GRABBED) {
+ SDL_SetWindowGrab(window->id, 1);
+ }
+ return 0;
}
-SDL_Window *
+SDL_Window *
SDL_GetWindowFromID(SDL_WindowID windowID)
{
- int i, j;
+ int i, j;
- if (!_this) {
- SDL_UninitializedVideo();
- return NULL;
- }
- for (i = 0; i < _this->num_displays; ++i) {
- SDL_VideoDisplay *display = &_this->displays[i];
- for (j = 0; j < display->num_windows; ++j) {
- SDL_Window *window = &display->windows[j];
- if (window->id == windowID) {
- return window;
- }
- }
- }
- return NULL;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ for (j = 0; j < display->num_windows; ++j) {
+ SDL_Window *window = &display->windows[j];
+ if (window->id == windowID) {
+ return window;
+ }
+ }
+ }
+ return NULL;
}
SDL_VideoDisplay *
SDL_GetDisplayFromWindow(SDL_Window * window)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return NULL;
- }
- if (!window) {
- return NULL;
- }
- return &_this->displays[window->display];
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ if (!window) {
+ return NULL;
+ }
+ return &_this->displays[window->display];
}
Uint32
SDL_GetWindowFlags(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return 0;
- }
- return window->flags;
+ if (!window) {
+ return 0;
+ }
+ return window->flags;
}
void
SDL_SetWindowTitle(SDL_WindowID windowID, const char *title)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || title == window->title) {
- return;
- }
- if (window->title) {
- SDL_free(window->title);
- }
- if (title) {
- window->title = SDL_strdup(title);
- } else {
- window->title = NULL;
- }
+ if (!window || title == window->title) {
+ return;
+ }
+ if (window->title) {
+ SDL_free(window->title);
+ }
+ if (title) {
+ window->title = SDL_strdup(title);
+ } else {
+ window->title = NULL;
+ }
- if (_this->SetWindowTitle) {
- _this->SetWindowTitle(_this, window);
- }
+ if (_this->SetWindowTitle) {
+ _this->SetWindowTitle(_this, window);
+ }
}
-const char *
+const char *
SDL_GetWindowTitle(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return NULL;
- }
- return window->title;
+ if (!window) {
+ return NULL;
+ }
+ return window->title;
}
void
SDL_SetWindowData(SDL_WindowID windowID, void *userdata)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return;
- }
- window->userdata = userdata;
+ if (!window) {
+ return;
+ }
+ window->userdata = userdata;
}
-void *
+void *
SDL_GetWindowData(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return NULL;
- }
- return window->userdata;
+ if (!window) {
+ return NULL;
+ }
+ return window->userdata;
}
void
SDL_SetWindowPosition(SDL_WindowID windowID, int x, int y)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
- SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
- if (!window) {
- return;
- }
- if (x == SDL_WINDOWPOS_CENTERED) {
- window->x = (display->current_mode.w - window->w) / 2;
- } else if (x != SDL_WINDOWPOS_UNDEFINED) {
- window->x = x;
- }
- if (y == SDL_WINDOWPOS_CENTERED) {
- window->y = (display->current_mode.h - window->h) / 2;
- } else if (y != SDL_WINDOWPOS_UNDEFINED) {
- window->y = y;
- }
- if (_this->SetWindowPosition) {
- _this->SetWindowPosition(_this, window);
- }
+ if (!window) {
+ return;
+ }
+ if (x == SDL_WINDOWPOS_CENTERED) {
+ window->x = (display->current_mode.w - window->w) / 2;
+ } else if (x != SDL_WINDOWPOS_UNDEFINED) {
+ window->x = x;
+ }
+ if (y == SDL_WINDOWPOS_CENTERED) {
+ window->y = (display->current_mode.h - window->h) / 2;
+ } else if (y != SDL_WINDOWPOS_UNDEFINED) {
+ window->y = y;
+ }
+ if (_this->SetWindowPosition) {
+ _this->SetWindowPosition(_this, window);
+ }
}
void
SDL_GetWindowPosition(SDL_WindowID windowID, int *x, int *y)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return;
- }
- if (x) {
- *x = window->x;
- }
- if (y) {
- *y = window->y;
- }
+ if (!window) {
+ return;
+ }
+ if (x) {
+ *x = window->x;
+ }
+ if (y) {
+ *y = window->y;
+ }
}
void
SDL_SetWindowSize(SDL_WindowID windowID, int w, int h)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return;
- }
- window->w = w;
- window->h = h;
+ if (!window) {
+ return;
+ }
+ window->w = w;
+ window->h = h;
- if (_this->SetWindowSize) {
- _this->SetWindowSize(_this, window);
- }
+ if (_this->SetWindowSize) {
+ _this->SetWindowSize(_this, window);
+ }
}
void
SDL_GetWindowSize(SDL_WindowID windowID, int *w, int *h)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return;
- }
- if (w) {
- *w = window->w;
- }
- if (h) {
- *h = window->h;
- }
+ if (!window) {
+ return;
+ }
+ if (w) {
+ *w = window->w;
+ }
+ if (h) {
+ *h = window->h;
+ }
}
void
SDL_ShowWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
- return;
- }
- SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
+ if (!window || (window->flags & SDL_WINDOW_SHOWN)) {
+ return;
+ }
+ SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_SHOWN, 0, 0);
- if (_this->ShowWindow) {
- _this->ShowWindow(_this, window);
- }
+ if (_this->ShowWindow) {
+ _this->ShowWindow(_this, window);
+ }
}
void
SDL_HideWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
- return;
- }
- SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
+ if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
+ return;
+ }
+ SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_HIDDEN, 0, 0);
- if (_this->HideWindow) {
- _this->HideWindow(_this, window);
- }
+ if (_this->HideWindow) {
+ _this->HideWindow(_this, window);
+ }
}
void
SDL_RaiseWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
- return;
- }
- if (_this->RaiseWindow) {
- _this->RaiseWindow(_this, window);
- }
+ if (!window || !(window->flags & SDL_WINDOW_SHOWN)) {
+ return;
+ }
+ if (_this->RaiseWindow) {
+ _this->RaiseWindow(_this, window);
+ }
}
void
SDL_MaximizeWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
- return;
- }
- SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
+ if (!window || (window->flags & SDL_WINDOW_MAXIMIZED)) {
+ return;
+ }
+ SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
- if (_this->MaximizeWindow) {
- _this->MaximizeWindow(_this, window);
- }
+ if (_this->MaximizeWindow) {
+ _this->MaximizeWindow(_this, window);
+ }
}
void
SDL_MinimizeWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
- return;
- }
- SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
+ if (!window || (window->flags & SDL_WINDOW_MINIMIZED)) {
+ return;
+ }
+ SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_MINIMIZED, 0, 0);
- if (_this->MinimizeWindow) {
- _this->MinimizeWindow(_this, window);
- }
+ if (_this->MinimizeWindow) {
+ _this->MinimizeWindow(_this, window);
+ }
}
void
SDL_RestoreWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window
- || (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
- return;
- }
- SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
+ if (!window
+ || (window->flags & (SDL_WINDOW_MAXIMIZED | SDL_WINDOW_MINIMIZED))) {
+ return;
+ }
+ SDL_SendWindowEvent(window->id, SDL_WINDOWEVENT_RESTORED, 0, 0);
- if (_this->RestoreWindow) {
- _this->RestoreWindow(_this, window);
- }
+ if (_this->RestoreWindow) {
+ _this->RestoreWindow(_this, window);
+ }
}
int
SDL_SetWindowFullscreen(SDL_WindowID windowID, int fullscreen)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return -1;
- }
- if (fullscreen) {
- fullscreen = SDL_WINDOW_FULLSCREEN;
- }
- if ((window->flags & SDL_WINDOW_FULLSCREEN) == fullscreen) {
- return 0;
- }
- if (fullscreen) {
- window->flags |= SDL_WINDOW_FULLSCREEN;
+ if (!window) {
+ return -1;
+ }
+ if (fullscreen) {
+ fullscreen = SDL_WINDOW_FULLSCREEN;
+ }
+ if ((window->flags & SDL_WINDOW_FULLSCREEN) == fullscreen) {
+ return 0;
+ }
+ if (fullscreen) {
+ window->flags |= SDL_WINDOW_FULLSCREEN;
- if (FULLSCREEN_VISIBLE(window)) {
- SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
+ if (FULLSCREEN_VISIBLE(window)) {
+ SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
- /* Hide any other fullscreen windows */
- int i;
- for (i = 0; i < display->num_windows; ++i) {
- SDL_Window *other = &display->windows[i];
- if (other->id != windowID && FULLSCREEN_VISIBLE(other)) {
- SDL_MinimizeWindow(other->id);
- }
- }
+ /* Hide any other fullscreen windows */
+ int i;
+ for (i = 0; i < display->num_windows; ++i) {
+ SDL_Window *other = &display->windows[i];
+ if (other->id != windowID && FULLSCREEN_VISIBLE(other)) {
+ SDL_MinimizeWindow(other->id);
+ }
+ }
- SDL_SetDisplayMode(&display->fullscreen_mode);
- }
- } else {
- window->flags &= ~SDL_WINDOW_FULLSCREEN;
+ SDL_SetDisplayMode(&display->fullscreen_mode);
+ }
+ } else {
+ window->flags &= ~SDL_WINDOW_FULLSCREEN;
- if (FULLSCREEN_VISIBLE(window)) {
- SDL_SetDisplayMode(NULL);
- }
- }
- return 0;
+ if (FULLSCREEN_VISIBLE(window)) {
+ SDL_SetDisplayMode(NULL);
+ }
+ }
+ return 0;
}
void
SDL_SetWindowGrab(SDL_WindowID windowID, int mode)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
- return;
- }
- if (mode) {
- window->flags |= SDL_WINDOW_INPUT_GRABBED;
- } else {
- window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
- }
+ if (!window || (!!mode == !!(window->flags & SDL_WINDOW_INPUT_GRABBED))) {
+ return;
+ }
+ if (mode) {
+ window->flags |= SDL_WINDOW_INPUT_GRABBED;
+ } else {
+ window->flags &= ~SDL_WINDOW_INPUT_GRABBED;
+ }
- if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
- _this->SetWindowGrab(_this, window);
- }
+ if ((window->flags & SDL_WINDOW_INPUT_FOCUS) && _this->SetWindowGrab) {
+ _this->SetWindowGrab(_this, window);
+ }
}
int
SDL_GetWindowGrab(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return 0;
- }
- return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
+ if (!window) {
+ return 0;
+ }
+ return ((window->flags & SDL_WINDOW_INPUT_GRABBED) != 0);
}
void
@@ -1228,1041 +1228,1041 @@
void
SDL_OnWindowResized(SDL_Window * window)
{
- SDL_Renderer *renderer = window->renderer;
+ SDL_Renderer *renderer = window->renderer;
- if (renderer && renderer->DisplayModeChanged) {
- renderer->DisplayModeChanged(renderer);
- }
+ if (renderer && renderer->DisplayModeChanged) {
+ renderer->DisplayModeChanged(renderer);
+ }
}
void
SDL_OnWindowFocusGained(SDL_Window * window)
{
- SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
+ SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
- if (window->flags & SDL_WINDOW_FULLSCREEN) {
- SDL_SetDisplayMode(&display->fullscreen_mode);
- }
- if (display->gamma && _this->SetDisplayGammaRamp) {
- _this->SetDisplayGammaRamp(_this, display->gamma);
- }
- if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
- _this->SetWindowGrab(_this, window);
- }
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_SetDisplayMode(&display->fullscreen_mode);
+ }
+ if (display->gamma && _this->SetDisplayGammaRamp) {
+ _this->SetDisplayGammaRamp(_this, display->gamma);
+ }
+ if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
+ _this->SetWindowGrab(_this, window);
+ }
}
void
SDL_OnWindowFocusLost(SDL_Window * window)
{
- SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
+ SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
- if (window->flags & SDL_WINDOW_FULLSCREEN) {
- SDL_MinimizeWindow(window->id);
- SDL_SetDisplayMode(NULL);
- }
- if (display->gamma && _this->SetDisplayGammaRamp) {
- _this->SetDisplayGammaRamp(_this, display->saved_gamma);
- }
- if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
- _this->SetWindowGrab(_this, window);
- }
+ if (window->flags & SDL_WINDOW_FULLSCREEN) {
+ SDL_MinimizeWindow(window->id);
+ SDL_SetDisplayMode(NULL);
+ }
+ if (display->gamma && _this->SetDisplayGammaRamp) {
+ _this->SetDisplayGammaRamp(_this, display->saved_gamma);
+ }
+ if ((window->flags & SDL_WINDOW_INPUT_GRABBED) && _this->SetWindowGrab) {
+ _this->SetWindowGrab(_this, window);
+ }
}
SDL_WindowID
SDL_GetFocusWindow(void)
{
- SDL_VideoDisplay *display;
- int i;
+ SDL_VideoDisplay *display;
+ int i;
- if (!_this) {
- return 0;
- }
- display = &SDL_CurrentDisplay;
- for (i = 0; i < display->num_windows; ++i) {
- SDL_Window *window = &display->windows[i];
+ if (!_this) {
+ return 0;
+ }
+ display = &SDL_CurrentDisplay;
+ for (i = 0; i < display->num_windows; ++i) {
+ SDL_Window *window = &display->windows[i];
- if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
- return window->id;
- }
- }
- return 0;
+ if (window->flags & SDL_WINDOW_INPUT_FOCUS) {
+ return window->id;
+ }
+ }
+ return 0;
}
void
SDL_DestroyWindow(SDL_WindowID windowID)
{
- int i, j;
+ int i, j;
- if (!_this) {
- return;
- }
- /* Restore video mode, etc. */
- SDL_SendWindowEvent(windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
+ if (!_this) {
+ return;
+ }
+ /* Restore video mode, etc. */
+ SDL_SendWindowEvent(windowID, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
- for (i = 0; i < _this->num_displays; ++i) {
- SDL_VideoDisplay *display = &_this->displays[i];
- for (j = 0; j < display->num_windows; ++j) {
- SDL_Window *window = &display->windows[j];
- if (window->id != windowID) {
- continue;
- }
- if (window->title) {
- SDL_free(window->title);
- window->title = NULL;
- }
- if (window->renderer) {
- SDL_DestroyRenderer(window->id);
- window->renderer = NULL;
- }
- if (_this->DestroyWindow) {
- _this->DestroyWindow(_this, window);
- }
- if (j != display->num_windows - 1) {
- SDL_memcpy(&display->windows[i],
- &display->windows[i + 1],
- (display->num_windows - i - 1) * sizeof(*window));
- }
- --display->num_windows;
- return;
- }
- }
+ for (i = 0; i < _this->num_displays; ++i) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ for (j = 0; j < display->num_windows; ++j) {
+ SDL_Window *window = &display->windows[j];
+ if (window->id != windowID) {
+ continue;
+ }
+ if (window->title) {
+ SDL_free(window->title);
+ window->title = NULL;
+ }
+ if (window->renderer) {
+ SDL_DestroyRenderer(window->id);
+ window->renderer = NULL;
+ }
+ if (_this->DestroyWindow) {
+ _this->DestroyWindow(_this, window);
+ }
+ if (j != display->num_windows - 1) {
+ SDL_memcpy(&display->windows[i],
+ &display->windows[i + 1],
+ (display->num_windows - i - 1) * sizeof(*window));
+ }
+ --display->num_windows;
+ return;
+ }
+ }
}
void
SDL_AddRenderDriver(int displayIndex, const SDL_RenderDriver * driver)
{
- SDL_VideoDisplay *display;
- SDL_RenderDriver *render_drivers;
+ SDL_VideoDisplay *display;
+ SDL_RenderDriver *render_drivers;
- if (displayIndex >= _this->num_displays) {
- return;
- }
- display = &_this->displays[displayIndex];
+ if (displayIndex >= _this->num_displays) {
+ return;
+ }
+ display = &_this->displays[displayIndex];
- render_drivers =
- SDL_realloc(display->render_drivers,
- (display->num_render_drivers +
- 1) * sizeof(*render_drivers));
- if (render_drivers) {
- render_drivers[display->num_render_drivers] = *driver;
- display->render_drivers = render_drivers;
- display->num_render_drivers++;
- }
+ render_drivers =
+ SDL_realloc(display->render_drivers,
+ (display->num_render_drivers +
+ 1) * sizeof(*render_drivers));
+ if (render_drivers) {
+ render_drivers[display->num_render_drivers] = *driver;
+ display->render_drivers = render_drivers;
+ display->num_render_drivers++;
+ }
}
int
SDL_GetNumRenderDrivers(void)
{
- if (_this) {
- return SDL_CurrentDisplay.num_render_drivers;
- }
- return 0;
+ if (_this) {
+ return SDL_CurrentDisplay.num_render_drivers;
+ }
+ return 0;
}
int
SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
- SDL_SetError("index must be in the range of 0 - %d",
- SDL_GetNumRenderDrivers() - 1);
- return -1;
- }
- *info = SDL_CurrentDisplay.render_drivers[index].info;
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (index < 0 || index >= SDL_GetNumRenderDrivers()) {
+ SDL_SetError("index must be in the range of 0 - %d",
+ SDL_GetNumRenderDrivers() - 1);
+ return -1;
+ }
+ *info = SDL_CurrentDisplay.render_drivers[index].info;
+ return 0;
}
int
SDL_CreateRenderer(SDL_WindowID windowID, int index, Uint32 flags)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return 0;
- }
- if (index < 0) {
- const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
- int n = SDL_GetNumRenderDrivers();
- for (index = 0; index < n; ++index) {
- SDL_RenderDriver *driver =
- &SDL_CurrentDisplay.render_drivers[index];
+ if (!window) {
+ return 0;
+ }
+ if (index < 0) {
+ const char *override = SDL_getenv("SDL_VIDEO_RENDERER");
+ int n = SDL_GetNumRenderDrivers();
+ for (index = 0; index < n; ++index) {
+ SDL_RenderDriver *driver =
+ &SDL_CurrentDisplay.render_drivers[index];
- if (override) {
- if (SDL_strcasecmp(override, driver->info.name) == 0) {
- break;
- }
- } else {
- if ((driver->info.flags & flags) == flags) {
- break;
- }
- }
- }
- if (index == n) {
- SDL_SetError("Couldn't find matching render driver");
- return -1;
- }
- }
- if (index >= SDL_GetNumRenderDrivers()) {
- SDL_SetError("index must be -1 or in the range of 0 - %d",
- SDL_GetNumRenderDrivers() - 1);
- return -1;
- }
- /* Free any existing renderer */
- SDL_DestroyRenderer(windowID);
+ if (override) {
+ if (SDL_strcasecmp(override, driver->info.name) == 0) {
+ break;
+ }
+ } else {
+ if ((driver->info.flags & flags) == flags) {
+ break;
+ }
+ }
+ }
+ if (index == n) {
+ SDL_SetError("Couldn't find matching render driver");
+ return -1;
+ }
+ }
+ if (index >= SDL_GetNumRenderDrivers()) {
+ SDL_SetError("index must be -1 or in the range of 0 - %d",
+ SDL_GetNumRenderDrivers() - 1);
+ return -1;
+ }
+ /* Free any existing renderer */
+ SDL_DestroyRenderer(windowID);
- /* Create a new renderer instance */
- window->renderer = SDL_CurrentDisplay.render_drivers[index]
- .CreateRenderer(window, flags);
- SDL_SelectRenderer(window->id);
+ /* Create a new renderer instance */
+ window->renderer = SDL_CurrentDisplay.render_drivers[index]
+ .CreateRenderer(window, flags);
+ SDL_SelectRenderer(window->id);
- return 0;
+ return 0;
}
int
SDL_SelectRenderer(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
- SDL_Renderer *renderer;
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Renderer *renderer;
- if (!window || !window->renderer) {
- return -1;
- }
- renderer = window->renderer;
- if (renderer && renderer->ActivateRenderer) {
- if (renderer->ActivateRenderer(renderer) < 0) {
- return -1;
- }
- }
- SDL_CurrentDisplay.current_renderer = renderer;
- return 0;
+ if (!window || !window->renderer) {
+ return -1;
+ }
+ renderer = window->renderer;
+ if (renderer && renderer->ActivateRenderer) {
+ if (renderer->ActivateRenderer(renderer) < 0) {
+ return -1;
+ }
+ }
+ SDL_CurrentDisplay.current_renderer = renderer;
+ return 0;
}
int
SDL_GetRendererInfo(SDL_RendererInfo * info)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (!SDL_CurrentDisplay.current_renderer) {
- SDL_SetError("There is no current renderer");
- return -1;
- }
- *info = SDL_CurrentDisplay.current_renderer->info;
- return 0;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (!SDL_CurrentDisplay.current_renderer) {
+ SDL_SetError("There is no current renderer");
+ return -1;
+ }
+ *info = SDL_CurrentDisplay.current_renderer->info;
+ return 0;
}
SDL_TextureID
SDL_CreateTexture(Uint32 format, int access, int w, int h)
{
- int hash;
- SDL_Renderer *renderer;
- SDL_Texture *texture;
+ int hash;
+ SDL_Renderer *renderer;
+ SDL_Texture *texture;
- if (!_this) {
- SDL_UninitializedVideo();
- return 0;
- }
- renderer = SDL_CurrentDisplay.current_renderer;
- if (!renderer || !renderer->CreateTexture) {
- return 0;
- }
- texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
- if (!texture) {
- SDL_OutOfMemory();
- return 0;
- }
- texture->id = _this->next_object_id++;
- texture->format = format;
- texture->access = access;
- texture->w = w;
- texture->h = h;
- texture->r = 255;
- texture->g = 255;
- texture->b = 255;
- texture->a = 255;
- texture->renderer = renderer;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return 0;
+ }
+ renderer = SDL_CurrentDisplay.current_renderer;
+ if (!renderer || !renderer->CreateTexture) {
+ return 0;
+ }
+ texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture));
+ if (!texture) {
+ SDL_OutOfMemory();
+ return 0;
+ }
+ texture->id = _this->next_object_id++;
+ texture->format = format;
+ texture->access = access;
+ texture->w = w;
+ texture->h = h;
+ texture->r = 255;
+ texture->g = 255;
+ texture->b = 255;
+ texture->a = 255;
+ texture->renderer = renderer;
- if (renderer->CreateTexture(renderer, texture) < 0) {
- if (renderer->DestroyTexture) {
- renderer->DestroyTexture(renderer, texture);
- }
- SDL_free(texture);
- return 0;
- }
- hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
- texture->next = SDL_CurrentDisplay.textures[hash];
- SDL_CurrentDisplay.textures[hash] = texture;
+ if (renderer->CreateTexture(renderer, texture) < 0) {
+ if (renderer->DestroyTexture) {
+ renderer->DestroyTexture(renderer, texture);
+ }
+ SDL_free(texture);
+ return 0;
+ }
+ hash = (texture->id % SDL_arraysize(SDL_CurrentDisplay.textures));
+ texture->next = SDL_CurrentDisplay.textures[hash];
+ SDL_CurrentDisplay.textures[hash] = texture;
- return texture->id;
+ return texture->id;
}
SDL_TextureID
SDL_CreateTextureFromSurface(Uint32 format, SDL_Surface * surface)
{
- SDL_TextureID textureID;
- SDL_PixelFormat *fmt;
- int bpp;
- Uint32 Rmask, Gmask, Bmask, Amask;
+ SDL_TextureID textureID;
+ SDL_PixelFormat *fmt;
+ int bpp;
+ Uint32 Rmask, Gmask, Bmask, Amask;
- if (!surface) {
- SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface");
- return 0;
- }
- fmt = surface->format;
+ if (!surface) {
+ SDL_SetError("SDL_CreateTextureFromSurface() passed NULL surface");
+ return 0;
+ }
+ fmt = surface->format;
- if (format) {
- if (!SDL_PixelFormatEnumToMasks
- (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
- SDL_SetError("Unknown pixel format");
- return 0;
- }
- } else {
- if (surface->format->Amask
- || !(surface->map->info.flags &
- (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
- bpp = fmt->BitsPerPixel;
- Rmask = fmt->Rmask;
- Gmask = fmt->Gmask;
- Bmask = fmt->Bmask;
- Amask = fmt->Amask;
- } else {
- /* Need a format with alpha */
- bpp = 32;
- Rmask = 0x00FF0000;
- Gmask = 0x0000FF00;
- Bmask = 0x000000FF;
- Amask = 0xFF000000;
- }
- format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
- if (!format) {
- SDL_SetError("Unknown pixel format");
- return 0;
- }
- }
+ if (format) {
+ if (!SDL_PixelFormatEnumToMasks
+ (format, &bpp, &Rmask, &Gmask, &Bmask, &Amask)) {
+ SDL_SetError("Unknown pixel format");
+ return 0;
+ }
+ } else {
+ if (surface->format->Amask
+ || !(surface->map->info.flags &
+ (SDL_COPY_COLORKEY | SDL_COPY_MASK | SDL_COPY_BLEND))) {
+ bpp = fmt->BitsPerPixel;
+ Rmask = fmt->Rmask;
+ Gmask = fmt->Gmask;
+ Bmask = fmt->Bmask;
+ Amask = fmt->Amask;
+ } else {
+ /* Need a format with alpha */
+ bpp = 32;
+ Rmask = 0x00FF0000;
+ Gmask = 0x0000FF00;
+ Bmask = 0x000000FF;
+ Amask = 0xFF000000;
+ }
+ format = SDL_MasksToPixelFormatEnum(bpp, Rmask, Gmask, Bmask, Amask);
+ if (!format) {
+ SDL_SetError("Unknown pixel format");
+ return 0;
+ }
+ }
- textureID =
- SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
- surface->h);
- if (!textureID) {
- return 0;
- }
- if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
- && Bmask == fmt->Bmask && Amask == fmt->Amask) {
- if (SDL_MUSTLOCK(surface)) {
- if (SDL_LockSurface(surface) < 0) {
- SDL_DestroyTexture(textureID);
- return 0;
- }
- SDL_UpdateTexture(textureID, NULL, surface->pixels,
- surface->pitch);
- SDL_UnlockSurface(surface);
- } else {
- SDL_UpdateTexture(textureID, NULL, surface->pixels,
- surface->pitch);
- }
- } else {
- SDL_PixelFormat *dst_fmt;
- SDL_Surface *dst = NULL;
+ textureID =
+ SDL_CreateTexture(format, SDL_TEXTUREACCESS_STATIC, surface->w,
+ surface->h);
+ if (!textureID) {
+ return 0;
+ }
+ if (bpp == fmt->BitsPerPixel && Rmask == fmt->Rmask && Gmask == fmt->Gmask
+ && Bmask == fmt->Bmask && Amask == fmt->Amask) {
+ if (SDL_MUSTLOCK(surface)) {
+ if (SDL_LockSurface(surface) < 0) {
+ SDL_DestroyTexture(textureID);
+ return 0;
+ }
+ SDL_UpdateTexture(textureID, NULL, surface->pixels,
+ surface->pitch);
+ SDL_UnlockSurface(surface);
+ } else {
+ SDL_UpdateTexture(textureID, NULL, surface->pixels,
+ surface->pitch);
+ }
+ } else {
+ SDL_PixelFormat *dst_fmt;
+ SDL_Surface *dst = NULL;
- /* Set up a destination surface for the texture update */
- dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
- if (dst_fmt) {
- if (SDL_ISPIXELFORMAT_INDEXED(format)) {
- dst_fmt->palette =
- SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
- if (dst_fmt->palette) {
- /*
- * FIXME: Should we try to copy
- * fmt->palette?
- */
- SDL_DitherColors(dst_fmt->palette->colors,
- SDL_BITSPERPIXEL(format));
- }
- }
- dst = SDL_ConvertSurface(surface, dst_fmt, 0);
- if (dst) {
- SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
- SDL_FreeSurface(dst);
- }
- if (dst_fmt->palette) {
- SDL_FreePalette(dst_fmt->palette);
- }
- SDL_FreeFormat(dst_fmt);
- }
- if (!dst) {
- SDL_DestroyTexture(textureID);
- return 0;
- }
- }
+ /* Set up a destination surface for the texture update */
+ dst_fmt = SDL_AllocFormat(bpp, Rmask, Gmask, Bmask, Amask);
+ if (dst_fmt) {
+ if (SDL_ISPIXELFORMAT_INDEXED(format)) {
+ dst_fmt->palette =
+ SDL_AllocPalette((1 << SDL_BITSPERPIXEL(format)));
+ if (dst_fmt->palette) {
+ /*
+ * FIXME: Should we try to copy
+ * fmt->palette?
+ */
+ SDL_DitherColors(dst_fmt->palette->colors,
+ SDL_BITSPERPIXEL(format));
+ }
+ }
+ dst = SDL_ConvertSurface(surface, dst_fmt, 0);
+ if (dst) {
+ SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
+ SDL_FreeSurface(dst);
+ }
+ if (dst_fmt->palette) {
+ SDL_FreePalette(dst_fmt->palette);
+ }
+ SDL_FreeFormat(dst_fmt);
+ }
+ if (!dst) {
+ SDL_DestroyTexture(textureID);
+ return 0;
+ }
+ }
- if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
- SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
- fmt->palette->ncolors);
- }
- return textureID;
+ if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) {
+ SDL_SetTexturePalette(textureID, fmt->palette->colors, 0,
+ fmt->palette->ncolors);
+ }
+ return textureID;
}
static __inline__ SDL_Texture *
SDL_GetTextureFromID(SDL_TextureID textureID)
{
- int hash;
- SDL_Texture *texture;
+ int hash;
+ SDL_Texture *texture;
- if (!_this) {
- return NULL;
- }
- hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
- for (texture = SDL_CurrentDisplay.textures[hash]; texture;
- texture = texture->next) {
- if (texture->id == textureID) {
- return texture;
- }
- }
- return NULL;
+ if (!_this) {
+ return NULL;
+ }
+ hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
+ for (texture = SDL_CurrentDisplay.textures[hash]; texture;
+ texture = texture->next) {
+ if (texture->id == textureID) {
+ return texture;
+ }
+ }
+ return NULL;
}
int
SDL_QueryTexture(SDL_TextureID textureID, Uint32 * format, int *access,
- int *w, int *h)
+ int *w, int *h)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- if (!texture) {
- return -1;
- }
- if (format) {
- *format = texture->format;
- }
- if (access) {
- *access = texture->access;
- }
- if (w) {
- *w = texture->w;
- }
- if (h) {
- *h = texture->h;
- }
- return 0;
+ if (!texture) {
+ return -1;
+ }
+ if (format) {
+ *format = texture->format;
+ }
+ if (access) {
+ *access = texture->access;
+ }
+ if (w) {
+ *w = texture->w;
+ }
+ if (h) {
+ *h = texture->h;
+ }
+ return 0;
}
int
SDL_QueryTexturePixels(SDL_TextureID textureID, void **pixels, int *pitch)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->QueryTexturePixels) {
- return -1;
- }
- return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->QueryTexturePixels) {
+ return -1;
+ }
+ return renderer->QueryTexturePixels(renderer, texture, pixels, pitch);
}
int
SDL_SetTexturePalette(SDL_TextureID textureID, const SDL_Color * colors,
- int firstcolor, int ncolors)
+ int firstcolor, int ncolors)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->SetTexturePalette) {
- return -1;
- }
- return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
- ncolors);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->SetTexturePalette) {
+ return -1;
+ }
+ return renderer->SetTexturePalette(renderer, texture, colors, firstcolor,
+ ncolors);
}
int
SDL_GetTexturePalette(SDL_TextureID textureID, SDL_Color * colors,
- int firstcolor, int ncolors)
+ int firstcolor, int ncolors)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->GetTexturePalette) {
- return -1;
- }
- return renderer->GetTexturePalette(renderer, texture, colors, firstcolor,
- ncolors);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->GetTexturePalette) {
+ return -1;
+ }
+ return renderer->GetTexturePalette(renderer, texture, colors, firstcolor,
+ ncolors);
}
int
SDL_SetTextureColorMod(SDL_TextureID textureID, Uint8 r, Uint8 g, Uint8 b)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->SetTextureColorMod) {
- return -1;
- }
- if (r < 255 || g < 255 || b < 255) {
- texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
- } else {
- texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;
- }
- texture->r = r;
- texture->g = g;
- texture->b = b;
- return renderer->SetTextureColorMod(renderer, texture);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->SetTextureColorMod) {
+ return -1;
+ }
+ if (r < 255 || g < 255 || b < 255) {
+ texture->modMode |= SDL_TEXTUREMODULATE_COLOR;
+ } else {
+ texture->modMode &= ~SDL_TEXTUREMODULATE_COLOR;
+ }
+ texture->r = r;
+ texture->g = g;
+ texture->b = b;
+ return renderer->SetTextureColorMod(renderer, texture);
}
int
SDL_GetTextureColorMod(SDL_TextureID textureID, Uint8 * r, Uint8 * g,
- Uint8 * b)
+ Uint8 * b)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (r) {
- *r = texture->r;
- }
- if (g) {
- *g = texture->g;
- }
- if (b) {
- *b = texture->b;
- }
- return 0;
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (r) {
+ *r = texture->r;
+ }
+ if (g) {
+ *g = texture->g;
+ }
+ if (b) {
+ *b = texture->b;
+ }
+ return 0;
}
int
SDL_SetTextureAlphaMod(SDL_TextureID textureID, Uint8 alpha)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->SetTextureAlphaMod) {
- return -1;
- }
- if (alpha < 255) {
- texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
- } else {
- texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
- }
- texture->a = alpha;
- return renderer->SetTextureAlphaMod(renderer, texture);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->SetTextureAlphaMod) {
+ return -1;
+ }
+ if (alpha < 255) {
+ texture->modMode |= SDL_TEXTUREMODULATE_ALPHA;
+ } else {
+ texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
+ }
+ texture->a = alpha;
+ return renderer->SetTextureAlphaMod(renderer, texture);
}
int
SDL_GetTextureAlphaMod(SDL_TextureID textureID, Uint8 * alpha)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- if (!texture) {
- return -1;
- }
- if (alpha) {
- *alpha = texture->a;
- }
- return 0;
+ if (!texture) {
+ return -1;
+ }
+ if (alpha) {
+ *alpha = texture->a;
+ }
+ return 0;
}
int
SDL_SetTextureBlendMode(SDL_TextureID textureID, int blendMode)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->SetTextureBlendMode) {
- return -1;
- }
- texture->blendMode = blendMode;
- return renderer->SetTextureBlendMode(renderer, texture);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->SetTextureBlendMode) {
+ return -1;
+ }
+ texture->blendMode = blendMode;
+ return renderer->SetTextureBlendMode(renderer, texture);
}
int
SDL_GetTextureBlendMode(SDL_TextureID textureID, int *blendMode)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- if (!texture) {
- return -1;
- }
- if (blendMode) {
- *blendMode = texture->blendMode;
- }
- return 0;
+ if (!texture) {
+ return -1;
+ }
+ if (blendMode) {
+ *blendMode = texture->blendMode;
+ }
+ return 0;
}
int
SDL_SetTextureScaleMode(SDL_TextureID textureID, int scaleMode)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->SetTextureScaleMode) {
- return -1;
- }
- texture->scaleMode = scaleMode;
- return renderer->SetTextureScaleMode(renderer, texture);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->SetTextureScaleMode) {
+ return -1;
+ }
+ texture->scaleMode = scaleMode;
+ return renderer->SetTextureScaleMode(renderer, texture);
}
int
SDL_GetTextureScaleMode(SDL_TextureID textureID, int *scaleMode)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- if (!texture) {
- return -1;
- }
- if (scaleMode) {
- *scaleMode = texture->scaleMode;
- }
- return 0;
+ if (!texture) {
+ return -1;
+ }
+ if (scaleMode) {
+ *scaleMode = texture->scaleMode;
+ }
+ return 0;
}
int
SDL_UpdateTexture(SDL_TextureID textureID, const SDL_Rect * rect,
- const void *pixels, int pitch)
+ const void *pixels, int pitch)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
- SDL_Rect full_rect;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
+ SDL_Rect full_rect;
- if (!texture) {
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->UpdateTexture) {
- return -1;
- }
- if (!rect) {
- full_rect.x = 0;
- full_rect.y = 0;
- full_rect.w = texture->w;
- full_rect.h = texture->h;
- rect = &full_rect;
- }
- return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
+ if (!texture) {
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->UpdateTexture) {
+ return -1;
+ }
+ if (!rect) {
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+ }
+ return renderer->UpdateTexture(renderer, texture, rect, pixels, pitch);
}
int
SDL_LockTexture(SDL_TextureID textureID, const SDL_Rect * rect, int markDirty,
- void **pixels, int *pitch)
+ void **pixels, int *pitch)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
- SDL_Rect full_rect;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
+ SDL_Rect full_rect;
- if (!texture) {
- return -1;
- }
- if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
- SDL_SetError("SDL_LockTexture(): texture must be streaming");
- return -1;
- }
- renderer = texture->renderer;
- if (!renderer->LockTexture) {
- return -1;
- }
- if (!rect) {
- full_rect.x = 0;
- full_rect.y = 0;
- full_rect.w = texture->w;
- full_rect.h = texture->h;
- rect = &full_rect;
- }
- return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
- pitch);
+ if (!texture) {
+ return -1;
+ }
+ if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
+ SDL_SetError("SDL_LockTexture(): texture must be streaming");
+ return -1;
+ }
+ renderer = texture->renderer;
+ if (!renderer->LockTexture) {
+ return -1;
+ }
+ if (!rect) {
+ full_rect.x = 0;
+ full_rect.y = 0;
+ full_rect.w = texture->w;
+ full_rect.h = texture->h;
+ rect = &full_rect;
+ }
+ return renderer->LockTexture(renderer, texture, rect, markDirty, pixels,
+ pitch);
}
void
SDL_UnlockTexture(SDL_TextureID textureID)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return;
- }
- if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
- return;
- }
- renderer = texture->renderer;
- if (!renderer->UnlockTexture) {
- return;
- }
- renderer->UnlockTexture(renderer, texture);
+ if (!texture) {
+ return;
+ }
+ if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
+ return;
+ }
+ renderer = texture->renderer;
+ if (!renderer->UnlockTexture) {
+ return;
+ }
+ renderer->UnlockTexture(renderer, texture);
}
void
SDL_DirtyTexture(SDL_TextureID textureID, int numrects,
- const SDL_Rect * rects)
+ const SDL_Rect * rects)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
- if (!texture) {
- return;
- }
- if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
- return;
- }
- renderer = texture->renderer;
- if (!renderer->DirtyTexture) {
- return;
- }
- renderer->DirtyTexture(renderer, texture, numrects, rects);
+ if (!texture) {
+ return;
+ }
+ if (texture->access != SDL_TEXTUREACCESS_STREAMING) {
+ return;
+ }
+ renderer = texture->renderer;
+ if (!renderer->DirtyTexture) {
+ return;
+ }
+ renderer->DirtyTexture(renderer, texture, numrects, rects);
}
int
SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
{
- SDL_Renderer *renderer;
- SDL_Window *window;
- SDL_Rect real_rect;
+ SDL_Renderer *renderer;
+ SDL_Window *window;
+ SDL_Rect real_rect;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- renderer = SDL_CurrentDisplay.current_renderer;
- if (!renderer || !renderer->RenderFill) {
- return -1;
- }
- window = SDL_GetWindowFromID(renderer->window);
- real_rect.x = 0;
- real_rect.y = 0;
- real_rect.w = window->w;
- real_rect.h = window->h;
- if (rect) {
- if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
- return 0;
- }
- }
- return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ renderer = SDL_CurrentDisplay.current_renderer;
+ if (!renderer || !renderer->RenderFill) {
+ return -1;
+ }
+ window = SDL_GetWindowFromID(renderer->window);
+ real_rect.x = 0;
+ real_rect.y = 0;
+ real_rect.w = window->w;
+ real_rect.h = window->h;
+ if (rect) {
+ if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
+ return 0;
+ }
+ }
+ return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
}
int
SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect * srcrect,
- const SDL_Rect * dstrect)
+ const SDL_Rect * dstrect)
{
- SDL_Texture *texture = SDL_GetTextureFromID(textureID);
- SDL_Renderer *renderer;
- SDL_Window *window;
- SDL_Rect real_srcrect;
- SDL_Rect real_dstrect;
+ SDL_Texture *texture = SDL_GetTextureFromID(textureID);
+ SDL_Renderer *renderer;
+ SDL_Window *window;
+ SDL_Rect real_srcrect;
+ SDL_Rect real_dstrect;
- if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
- return -1;
- }
- renderer = SDL_CurrentDisplay.current_renderer;
- if (!renderer || !renderer->RenderCopy) {
- return -1;
- }
- window = SDL_GetWindowFromID(renderer->window);
- if (srcrect) {
- real_srcrect = *srcrect;
- } else {
- real_srcrect.x = 0;
- real_srcrect.y = 0;
- real_srcrect.w = texture->w;
- real_srcrect.h = texture->h;
- }
- if (dstrect) {
- real_dstrect = *dstrect;
- } else {
- real_dstrect.x = 0;
- real_dstrect.y = 0;
- real_dstrect.w = window->w;
- real_dstrect.h = window->h;
- }
+ if (!texture || texture->renderer != SDL_CurrentDisplay.current_renderer) {
+ return -1;
+ }
+ renderer = SDL_CurrentDisplay.current_renderer;
+ if (!renderer || !renderer->RenderCopy) {
+ return -1;
+ }
+ window = SDL_GetWindowFromID(renderer->window);
+ if (srcrect) {
+ real_srcrect = *srcrect;
+ } else {
+ real_srcrect.x = 0;
+ real_srcrect.y = 0;
+ real_srcrect.w = texture->w;
+ real_srcrect.h = texture->h;
+ }
+ if (dstrect) {
+ real_dstrect = *dstrect;
+ } else {
+ real_dstrect.x = 0;
+ real_dstrect.y = 0;
+ real_dstrect.w = window->w;
+ real_dstrect.h = window->h;
+ }
- return renderer->RenderCopy(renderer, texture, &real_srcrect,
- &real_dstrect);
+ return renderer->RenderCopy(renderer, texture, &real_srcrect,
+ &real_dstrect);
}
void
SDL_RenderPresent(void)
{
- SDL_Renderer *renderer;
+ SDL_Renderer *renderer;
- if (!_this) {
- SDL_UninitializedVideo();
- return;
- }
- renderer = SDL_CurrentDisplay.current_renderer;
- if (!renderer || !renderer->RenderPresent) {
- return;
- }
- renderer->RenderPresent(renderer);
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return;
+ }
+ renderer = SDL_CurrentDisplay.current_renderer;
+ if (!renderer || !renderer->RenderPresent) {
+ return;
+ }
+ renderer->RenderPresent(renderer);
}
void
SDL_DestroyTexture(SDL_TextureID textureID)
{
- int hash;
- SDL_Texture *prev, *texture;
- SDL_Renderer *renderer;
+ int hash;
+ SDL_Texture *prev, *texture;
+ SDL_Renderer *renderer;
- if (!_this) {
- SDL_UninitializedVideo();
- return;
- }
- /* Look up the texture in the hash table */
- hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
- prev = NULL;
- for (texture = SDL_CurrentDisplay.textures[hash]; texture;
- prev = texture, texture = texture->next) {
- if (texture->id == textureID) {
- break;
- }
- }
- if (!texture) {
- return;
- }
- /* Unlink the texture from the list */
- if (prev) {
- prev->next = texture->next;
- } else {
- SDL_CurrentDisplay.textures[hash] = texture->next;
- }
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return;
+ }
+ /* Look up the texture in the hash table */
+ hash = (textureID % SDL_arraysize(SDL_CurrentDisplay.textures));
+ prev = NULL;
+ for (texture = SDL_CurrentDisplay.textures[hash]; texture;
+ prev = texture, texture = texture->next) {
+ if (texture->id == textureID) {
+ break;
+ }
+ }
+ if (!texture) {
+ return;
+ }
+ /* Unlink the texture from the list */
+ if (prev) {
+ prev->next = texture->next;
+ } else {
+ SDL_CurrentDisplay.textures[hash] = texture->next;
+ }
- /* Free the texture */
- renderer = texture->renderer;
- renderer->DestroyTexture(renderer, texture);
- SDL_free(texture);
+ /* Free the texture */
+ renderer = texture->renderer;
+ renderer->DestroyTexture(renderer, texture);
+ SDL_free(texture);
}
void
SDL_DestroyRenderer(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
- SDL_Renderer *renderer;
- int i;
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Renderer *renderer;
+ int i;
- if (!window) {
- return;
- }
- renderer = window->renderer;
- if (!renderer) {
- return;
- }
- /* Free existing textures for this renderer */
- for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
- SDL_Texture *texture;
- SDL_Texture *prev = NULL;
- SDL_Texture *next;
- for (texture = SDL_CurrentDisplay.textures[i]; texture;
- texture = next) {
- next = texture->next;
- if (texture->renderer == renderer) {
- if (prev) {
- prev->next = next;
- } else {
- SDL_CurrentDisplay.textures[i] = next;
- }
- renderer->DestroyTexture(renderer, texture);
- SDL_free(texture);
- } else {
- prev = texture;
- }
- }
- }
+ if (!window) {
+ return;
+ }
+ renderer = window->renderer;
+ if (!renderer) {
+ return;
+ }
+ /* Free existing textures for this renderer */
+ for (i = 0; i < SDL_arraysize(SDL_CurrentDisplay.textures); ++i) {
+ SDL_Texture *texture;
+ SDL_Texture *prev = NULL;
+ SDL_Texture *next;
+ for (texture = SDL_CurrentDisplay.textures[i]; texture;
+ texture = next) {
+ next = texture->next;
+ if (texture->renderer == renderer) {
+ if (prev) {
+ prev->next = next;
+ } else {
+ SDL_CurrentDisplay.textures[i] = next;
+ }
+ renderer->DestroyTexture(renderer, texture);
+ SDL_free(texture);
+ } else {
+ prev = texture;
+ }
+ }
+ }
- /* Free the renderer instance */
- renderer->DestroyRenderer(renderer);
+ /* Free the renderer instance */
+ renderer->DestroyRenderer(renderer);
- /* Clear references */
- window->renderer = NULL;
- if (SDL_CurrentDisplay.current_renderer == renderer) {
- SDL_CurrentDisplay.current_renderer = NULL;
- }
+ /* Clear references */
+ window->renderer = NULL;
+ if (SDL_CurrentDisplay.current_renderer == renderer) {
+ SDL_CurrentDisplay.current_renderer = NULL;
+ }
}
void
SDL_VideoQuit(void)
{
- int i, j;
+ int i, j;
- if (!_this) {
- return;
- }
- /* Halt event processing before doing anything else */
- SDL_StopEventLoop();
+ if (!_this) {
+ return;
+ }
+ /* Halt event processing before doing anything else */
+ SDL_StopEventLoop();
- /* Clean up the system video */
- for (i = _this->num_displays; i--;) {
- SDL_VideoDisplay *display = &_this->displays[i];
- for (j = display->num_windows; j--;) {
- SDL_DestroyWindow(display->windows[i].id);
- }
- if (display->windows) {
- SDL_free(display->windows);
- display->windows = NULL;
- }
- display->num_windows = 0;
- if (display->render_drivers) {
- SDL_free(display->render_drivers);
- display->render_drivers = NULL;
- }
- display->num_render_drivers = 0;
- }
- _this->VideoQuit(_this);
+ /* Clean up the system video */
+ for (i = _this->num_displays; i--;) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ for (j = display->num_windows; j--;) {
+ SDL_DestroyWindow(display->windows[i].id);
+ }
+ if (display->windows) {
+ SDL_free(display->windows);
+ display->windows = NULL;
+ }
+ display->num_windows = 0;
+ if (display->render_drivers) {
+ SDL_free(display->render_drivers);
+ display->render_drivers = NULL;
+ }
+ display->num_render_drivers = 0;
+ }
+ _this->VideoQuit(_this);
- for (i = _this->num_displays; i--;) {
- SDL_VideoDisplay *display = &_this->displays[i];
- for (j = display->num_display_modes; j--;) {
- if (display->display_modes[j].driverdata) {
- SDL_free(display->display_modes[j].driverdata);
- display->display_modes[j].driverdata = NULL;
- }
- }
- if (display->display_modes) {
- SDL_free(display->display_modes);
- display->display_modes = NULL;
- }
- if (display->desktop_mode.driverdata) {
- SDL_free(display->desktop_mode.driverdata);
- display->desktop_mode.driverdata = NULL;
- }
- if (display->palette) {
- SDL_FreePalette(display->palette);
- display->palette = NULL;
- }
- if (display->gamma) {
- SDL_free(display->gamma);
- display->gamma = NULL;
- }
- if (display->driverdata) {
- SDL_free(display->driverdata);
- display->driverdata = NULL;
- }
- }
- if (_this->displays) {
- SDL_free(_this->displays);
- _this->displays = NULL;
- }
- _this->free(_this);
- _this = NULL;
+ for (i = _this->num_displays; i--;) {
+ SDL_VideoDisplay *display = &_this->displays[i];
+ for (j = display->num_display_modes; j--;) {
+ if (display->display_modes[j].driverdata) {
+ SDL_free(display->display_modes[j].driverdata);
+ display->display_modes[j].driverdata = NULL;
+ }
+ }
+ if (display->display_modes) {
+ SDL_free(display->display_modes);
+ display->display_modes = NULL;
+ }
+ if (display->desktop_mode.driverdata) {
+ SDL_free(display->desktop_mode.driverdata);
+ display->desktop_mode.driverdata = NULL;
+ }
+ if (display->palette) {
+ SDL_FreePalette(display->palette);
+ display->palette = NULL;
+ }
+ if (display->gamma) {
+ SDL_free(display->gamma);
+ display->gamma = NULL;
+ }
+ if (display->driverdata) {
+ SDL_free(display->driverdata);
+ display->driverdata = NULL;
+ }
+ }
+ if (_this->displays) {
+ SDL_free(_this->displays);
+ _this->displays = NULL;
+ }
+ _this->free(_this);
+ _this = NULL;
}
int
SDL_GL_LoadLibrary(const char *path)
{
- int retval;
+ int retval;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (_this->GL_LoadLibrary) {
- retval = _this->GL_LoadLibrary(_this, path);
- } else {
- SDL_SetError("No dynamic GL support in video driver");
- retval = -1;
- }
- return (retval);
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (_this->GL_LoadLibrary) {
+ retval = _this->GL_LoadLibrary(_this, path);
+ } else {
+ SDL_SetError("No dynamic GL support in video driver");
+ retval = -1;
+ }
+ return (retval);
}
-void *
+void *
SDL_GL_GetProcAddress(const char *proc)
{
- void *func;
+ void *func;
- if (!_this) {
- SDL_UninitializedVideo();
- return NULL;
- }
- func = NULL;
- if (_this->GL_GetProcAddress) {
- if (_this->gl_config.driver_loaded) {
- func = _this->GL_GetProcAddress(_this, proc);
- } else {
- SDL_SetError("No GL driver has been loaded");
- }
- } else {
- SDL_SetError("No dynamic GL support in video driver");
- }
- return func;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return NULL;
+ }
+ func = NULL;
+ if (_this->GL_GetProcAddress) {
+ if (_this->gl_config.driver_loaded) {
+ func = _this->GL_GetProcAddress(_this, proc);
+ } else {
+ SDL_SetError("No GL driver has been loaded");
+ }
+ } else {
+ SDL_SetError("No dynamic GL support in video driver");
+ }
+ return func;
}
SDL_bool
SDL_GL_ExtensionSupported(const char *extension)
{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
- const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
- const char *extensions;
- const char *start;
- const char *where, *terminator;
+ const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
+ const char *extensions;
+ const char *start;
+ const char *where, *terminator;
- /* Extension names should not have spaces. */
- where = SDL_strchr(extension, ' ');
- if (where || *extension == '\0') {
- return SDL_FALSE;
- }
- /* See if there's an environment variable override */
- start = SDL_getenv(extension);
- if (start && *start == '0') {
- return SDL_FALSE;
- }
- /* Lookup the available extensions */
- glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
- if (glGetStringFunc) {
- extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
- } else {
- extensions = NULL;
- }
- if (!extensions) {
- return SDL_FALSE;
- }
- /*
- * It takes a bit of care to be fool-proof about parsing the OpenGL
- * extensions string. Don't be fooled by sub-strings, etc.
- */
+ /* Extension names should not have spaces. */
+ where = SDL_strchr(extension, ' ');
+ if (where || *extension == '\0') {
+ return SDL_FALSE;
+ }
+ /* See if there's an environment variable override */
+ start = SDL_getenv(extension);
+ if (start && *start == '0') {
+ return SDL_FALSE;
+ }
+ /* Lookup the available extensions */
+ glGetStringFunc = SDL_GL_GetProcAddress("glGetString");
+ if (glGetStringFunc) {
+ extensions = (const char *) glGetStringFunc(GL_EXTENSIONS);
+ } else {
+ extensions = NULL;
+ }
+ if (!extensions) {
+ return SDL_FALSE;
+ }
+ /*
+ * It takes a bit of care to be fool-proof about parsing the OpenGL
+ * extensions string. Don't be fooled by sub-strings, etc.
+ */
- start = extensions;
+ start = extensions;
- for (;;) {
- where = SDL_strstr(start, extension);
- if (!where)
- break;
+ for (;;) {
+ where = SDL_strstr(start, extension);
+ if (!where)
+ break;
- terminator = where + SDL_strlen(extension);
- if (where == start || *(where - 1) == ' ')
- if (*terminator == ' ' || *terminator == '\0')
- return SDL_TRUE;
+ terminator = where + SDL_strlen(extension);
+ if (where == start || *(where - 1) == ' ')
+ if (*terminator == ' ' || *terminator == '\0')
+ return SDL_TRUE;
- start = terminator;
- }
- return SDL_FALSE;
+ start = terminator;
+ }
+ return SDL_FALSE;
#else
- return SDL_FALSE;
+ return SDL_FALSE;
#endif
}
@@ -2270,285 +2270,285 @@
SDL_GL_SetAttribute(SDL_GLattr attr, int value)
{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
- int retval;
+ int retval;
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- retval = 0;
- switch (attr) {
- case SDL_GL_RED_SIZE:
- _this->gl_config.red_size = value;
- break;
- case SDL_GL_GREEN_SIZE:
- _this->gl_config.green_size = value;
- break;
- case SDL_GL_BLUE_SIZE:
- _this->gl_config.blue_size = value;
- break;
- case SDL_GL_ALPHA_SIZE:
- _this->gl_config.alpha_size = value;
- break;
- case SDL_GL_DOUBLEBUFFER:
- _this->gl_config.double_buffer = value;
- break;
- case SDL_GL_BUFFER_SIZE:
- _this->gl_config.buffer_size = value;
- break;
- case SDL_GL_DEPTH_SIZE:
- _this->gl_config.depth_size = value;
- break;
- case SDL_GL_STENCIL_SIZE:
- _this->gl_config.stencil_size = value;
- break;
- case SDL_GL_ACCUM_RED_SIZE:
- _this->gl_config.accum_red_size = value;
- break;
- case SDL_GL_ACCUM_GREEN_SIZE:
- _this->gl_config.accum_green_size = value;
- break;
- case SDL_GL_ACCUM_BLUE_SIZE:
- _this->gl_config.accum_blue_size = value;
- break;
- case SDL_GL_ACCUM_ALPHA_SIZE:
- _this->gl_config.accum_alpha_size = value;
- break;
- case SDL_GL_STEREO:
- _this->gl_config.stereo = value;
- break;
- case SDL_GL_MULTISAMPLEBUFFERS:
- _this->gl_config.multisamplebuffers = value;
- break;
- case SDL_GL_MULTISAMPLESAMPLES:
- _this->gl_config.multisamplesamples = value;
- break;
- case SDL_GL_ACCELERATED_VISUAL:
- _this->gl_config.accelerated = value;
- break;
- case SDL_GL_RETAINED_BACKING:
- _this->gl_config.retained_backing = value;
- break;
- default:
- SDL_SetError("Unknown OpenGL attribute");
- retval = -1;
- break;
- }
- return retval;
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ retval = 0;
+ switch (attr) {
+ case SDL_GL_RED_SIZE:
+ _this->gl_config.red_size = value;
+ break;
+ case SDL_GL_GREEN_SIZE:
+ _this->gl_config.green_size = value;
+ break;
+ case SDL_GL_BLUE_SIZE:
+ _this->gl_config.blue_size = value;
+ break;
+ case SDL_GL_ALPHA_SIZE:
+ _this->gl_config.alpha_size = value;
+ break;
+ case SDL_GL_DOUBLEBUFFER:
+ _this->gl_config.double_buffer = value;
+ break;
+ case SDL_GL_BUFFER_SIZE:
+ _this->gl_config.buffer_size = value;
+ break;
+ case SDL_GL_DEPTH_SIZE:
+ _this->gl_config.depth_size = value;
+ break;
+ case SDL_GL_STENCIL_SIZE:
+ _this->gl_config.stencil_size = value;
+ break;
+ case SDL_GL_ACCUM_RED_SIZE:
+ _this->gl_config.accum_red_size = value;
+ break;
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ _this->gl_config.accum_green_size = value;
+ break;
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ _this->gl_config.accum_blue_size = value;
+ break;
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ _this->gl_config.accum_alpha_size = value;
+ break;
+ case SDL_GL_STEREO:
+ _this->gl_config.stereo = value;
+ break;
+ case SDL_GL_MULTISAMPLEBUFFERS:
+ _this->gl_config.multisamplebuffers = value;
+ break;
+ case SDL_GL_MULTISAMPLESAMPLES:
+ _this->gl_config.multisamplesamples = value;
+ break;
+ case SDL_GL_ACCELERATED_VISUAL:
+ _this->gl_config.accelerated = value;
+ break;
+ case SDL_GL_RETAINED_BACKING:
+ _this->gl_config.retained_backing = value;
+ break;
+ default:
+ SDL_SetError("Unknown OpenGL attribute");
+ retval = -1;
+ break;
+ }
+ return retval;
#else
- SDL_Unsupported();
- return -1;
-#endif /* SDL_VIDEO_OPENGL */
+ SDL_Unsupported();
+ return -1;
+#endif /* SDL_VIDEO_OPENGL */
}
int
SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
{
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
- void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
- GLenum attrib = 0;
+ void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
+ GLenum attrib = 0;
- glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
- if (!glGetIntegervFunc) {
- return -1;
- }
- switch (attr) {
- case SDL_GL_RETAINED_BACKING:
- *value = _this->gl_config.retained_backing;
- return 0;
- case SDL_GL_RED_SIZE:
- attrib = GL_RED_BITS;
- break;
- case SDL_GL_BLUE_SIZE:
- attrib = GL_BLUE_BITS;
- break;
- case SDL_GL_GREEN_SIZE:
- attrib = GL_GREEN_BITS;
- break;
- case SDL_GL_ALPHA_SIZE:
- attrib = GL_ALPHA_BITS;
- break;
- case SDL_GL_DOUBLEBUFFER:
+ glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv");
+ if (!glGetIntegervFunc) {
+ return -1;
+ }
+ switch (attr) {
+ case SDL_GL_RETAINED_BACKING:
+ *value = _this->gl_config.retained_backing;
+ return 0;
+ case SDL_GL_RED_SIZE:
+ attrib = GL_RED_BITS;
+ break;
+ case SDL_GL_BLUE_SIZE:
+ attrib = GL_BLUE_BITS;
+ break;
+ case SDL_GL_GREEN_SIZE:
+ attrib = GL_GREEN_BITS;
+ break;
+ case SDL_GL_ALPHA_SIZE:
+ attrib = GL_ALPHA_BITS;
+ break;
+ case SDL_GL_DOUBLEBUFFER:
#ifndef SDL_VIDEO_OPENGL_ES
- attrib = GL_DOUBLEBUFFER;
- break;
+ attrib = GL_DOUBLEBUFFER;
+ break;
#else
- /*
- * I believe double buffering is the only option in OpenGL ES
- * -- in any case, GL_DOUBLEBUFFER doesn't exist
- */
- *value = 1;
- return 0;
+ /*
+ * I believe double buffering is the only option in OpenGL ES
+ * -- in any case, GL_DOUBLEBUFFER doesn't exist
+ */
+ *value = 1;
+ return 0;
#endif
- case SDL_GL_DEPTH_SIZE:
- attrib = GL_DEPTH_BITS;
- break;
- case SDL_GL_STENCIL_SIZE:
- attrib = GL_STENCIL_BITS;
- break;
+ case SDL_GL_DEPTH_SIZE:
+ attrib = GL_DEPTH_BITS;
+ break;
+ case SDL_GL_STENCIL_SIZE:
+ attrib = GL_STENCIL_BITS;
+ break;
#ifndef SDL_VIDEO_OPENGL_ES
- case SDL_GL_ACCUM_RED_SIZE:
- attrib = GL_ACCUM_RED_BITS;
- break;
- case SDL_GL_ACCUM_GREEN_SIZE:
- attrib = GL_ACCUM_GREEN_BITS;
- break;
- case SDL_GL_ACCUM_BLUE_SIZE:
- attrib = GL_ACCUM_BLUE_BITS;
- break;
- case SDL_GL_ACCUM_ALPHA_SIZE:
- attrib = GL_ACCUM_ALPHA_BITS;
- break;
- case SDL_GL_STEREO:
- attrib = GL_STEREO;
- break;
+ case SDL_GL_ACCUM_RED_SIZE:
+ attrib = GL_ACCUM_RED_BITS;
+ break;
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ attrib = GL_ACCUM_GREEN_BITS;
+ break;
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ attrib = GL_ACCUM_BLUE_BITS;
+ break;
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ attrib = GL_ACCUM_ALPHA_BITS;
+ break;
+ case SDL_GL_STEREO:
+ attrib = GL_STEREO;
+ break;
#else
- case SDL_GL_ACCUM_RED_SIZE:
- case SDL_GL_ACCUM_GREEN_SIZE:
- case SDL_GL_ACCUM_BLUE_SIZE:
- case SDL_GL_ACCUM_ALPHA_SIZE:
- case SDL_GL_STEREO:
- /* none of these are supported in OpenGL ES */
- *value = 0;
- return 0;
+ case SDL_GL_ACCUM_RED_SIZE:
+ case SDL_GL_ACCUM_GREEN_SIZE:
+ case SDL_GL_ACCUM_BLUE_SIZE:
+ case SDL_GL_ACCUM_ALPHA_SIZE:
+ case SDL_GL_STEREO:
+ /* none of these are supported in OpenGL ES */
+ *value = 0;
+ return 0;
#endif
- case SDL_GL_MULTISAMPLEBUFFERS:
+ case SDL_GL_MULTISAMPLEBUFFERS:
#ifndef SDL_VIDEO_OPENGL_ES
- attrib = GL_SAMPLE_BUFFERS_ARB;
+ attrib = GL_SAMPLE_BUFFERS_ARB;
#else
- attrib = GL_SAMPLE_BUFFERS;
+ attrib = GL_SAMPLE_BUFFERS;
#endif
- break;
- case SDL_GL_MULTISAMPLESAMPLES:
+ break;
+ case SDL_GL_MULTISAMPLESAMPLES:
#ifndef SDL_VIDEO_OPENGL_ES
- attrib = GL_SAMPLES_ARB;
+ attrib = GL_SAMPLES_ARB;
#else
- attrib = GL_SAMPLES;
+ attrib = GL_SAMPLES;
#endif
- break;
- case SDL_GL_BUFFER_SIZE:
- {
- GLint bits = 0;
- GLint component;
+ break;
+ case SDL_GL_BUFFER_SIZE:
+ {
+ GLint bits = 0;
+ GLint component;
- /*
- * there doesn't seem to be a single flag in OpenGL
- * for this!
- */
- glGetIntegervFunc(GL_RED_BITS, &component);
- bits += component;
- glGetIntegervFunc(GL_GREEN_BITS, &component);
- bits += component;
- glGetIntegervFunc(GL_BLUE_BITS, &component);
- bits += component;
- glGetIntegervFunc(GL_ALPHA_BITS, &component);
- bits += component;
+ /*
+ * there doesn't seem to be a single flag in OpenGL
+ * for this!
+ */
+ glGetIntegervFunc(GL_RED_BITS, &component);
+ bits += component;
+ glGetIntegervFunc(GL_GREEN_BITS, &component);
+ bits += component;
+ glGetIntegervFunc(GL_BLUE_BITS, &component);
+ bits += component;
+ glGetIntegervFunc(GL_ALPHA_BITS, &component);
+ bits += component;
- *value = bits;
- return 0;
- }
- case SDL_GL_ACCELERATED_VISUAL:
- {
- /* FIXME: How do we get this information? */
- *value = (_this->gl_config.accelerated != 0);
- return 0;
- }
- default:
- SDL_SetError("Unknown OpenGL attribute");
- return -1;
- }
+ *value = bits;
+ return 0;
+ }
+ case SDL_GL_ACCELERATED_VISUAL:
+ {
+ /* FIXME: How do we get this information? */
+ *value = (_this->gl_config.accelerated != 0);
+ return 0;
+ }
+ default:
+ SDL_SetError("Unknown OpenGL attribute");
+ return -1;
+ }
- glGetIntegervFunc(attrib, (GLint *) value);
- return 0;
+ glGetIntegervFunc(attrib, (GLint *) value);
+ return 0;
#else
- SDL_Unsupported();
- return -1;
-#endif /* SDL_VIDEO_OPENGL */
+ SDL_Unsupported();
+ return -1;
+#endif /* SDL_VIDEO_OPENGL */
}
SDL_GLContext
SDL_GL_CreateContext(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return NULL;
- }
- if (!(window->flags & SDL_WINDOW_OPENGL)) {
- SDL_SetError("The specified window isn't an OpenGL window");
- return NULL;
- }
- return _this->GL_CreateContext(_this, window);
+ if (!window) {
+ return NULL;
+ }
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ SDL_SetError("The specified window isn't an OpenGL window");
+ return NULL;
+ }
+ return _this->GL_CreateContext(_this, window);
}
int
SDL_GL_MakeCurrent(SDL_WindowID windowID, SDL_GLContext context)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (window && !(window->flags & SDL_WINDOW_OPENGL)) {
- SDL_SetError("The specified window isn't an OpenGL window");
- return -1;
- }
- if (!context) {
- window = NULL;
- }
- return _this->GL_MakeCurrent(_this, window, context);
+ if (window && !(window->flags & SDL_WINDOW_OPENGL)) {
+ SDL_SetError("The specified window isn't an OpenGL window");
+ return -1;
+ }
+ if (!context) {
+ window = NULL;
+ }
+ return _this->GL_MakeCurrent(_this, window, context);
}
int
SDL_GL_SetSwapInterval(int interval)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (_this->GL_SetSwapInterval) {
- return _this->GL_SetSwapInterval(_this, interval);
- } else {
- SDL_SetError("Setting the swap interval is not supported");
- return -1;
- }
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (_this->GL_SetSwapInterval) {
+ return _this->GL_SetSwapInterval(_this, interval);
+ } else {
+ SDL_SetError("Setting the swap interval is not supported");
+ return -1;
+ }
}
int
SDL_GL_GetSwapInterval(void)
{
- if (!_this) {
- SDL_UninitializedVideo();
- return -1;
- }
- if (_this->GL_GetSwapInterval) {
- return _this->GL_GetSwapInterval(_this);
- } else {
- SDL_SetError("Getting the swap interval is not supported");
- return -1;
- }
+ if (!_this) {
+ SDL_UninitializedVideo();
+ return -1;
+ }
+ if (_this->GL_GetSwapInterval) {
+ return _this->GL_GetSwapInterval(_this);
+ } else {
+ SDL_SetError("Getting the swap interval is not supported");
+ return -1;
+ }
}
void
SDL_GL_SwapWindow(SDL_WindowID windowID)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window) {
- return;
- }
- if (!(window->flags & SDL_WINDOW_OPENGL)) {
- SDL_SetError("The specified window isn't an OpenGL window");
- return;
- }
- _this->GL_SwapWindow(_this, window);
+ if (!window) {
+ return;
+ }
+ if (!(window->flags & SDL_WINDOW_OPENGL)) {
+ SDL_SetError("The specified window isn't an OpenGL window");
+ return;
+ }
+ _this->GL_SwapWindow(_this, window);
}
void
SDL_GL_DeleteContext(SDL_GLContext context)
{
- if (!_this || !context) {
- return;
- }
- _this->GL_MakeCurrent(_this, NULL, NULL);
- _this->GL_DeleteContext(_this, context);
+ if (!_this || !context) {
+ return;
+ }
+ _this->GL_MakeCurrent(_this, NULL, NULL);
+ _this->GL_DeleteContext(_this, context);
}
#if 0 // FIXME
@@ -2559,63 +2559,63 @@
static void
CreateMaskFromColorKeyOrAlpha(SDL_Surface * icon, Uint8 * mask, int flags)
{
- int x, y;
- Uint32 colorkey;
+ int x, y;
+ Uint32 colorkey;
#define SET_MASKBIT(icon, x, y, mask) \
mask[(y*((icon->w+7)/8))+(x/8)] &= ~(0x01<<(7-(x%8)))
- colorkey = icon->format->colorkey;
- switch (icon->format->BytesPerPixel) {
- case 1:
- {
- Uint8 *pixels;
- for (y = 0; y < icon->h; ++y) {
- pixels = (Uint8 *) icon->pixels + y * icon->pitch;
- for (x = 0; x < icon->w; ++x) {
- if (*pixels++ == colorkey) {
- SET_MASKBIT(icon, x, y, mask);
- }
- }
- }
- }
- break;
+ colorkey = icon->format->colorkey;
+ switch (icon->format->BytesPerPixel) {
+ case 1:
+ {
+ Uint8 *pixels;
+ for (y = 0; y < icon->h; ++y) {
+ pixels = (Uint8 *) icon->pixels + y * icon->pitch;
+ for (x = 0; x < icon->w; ++x) {
+ if (*pixels++ == colorkey) {
+ SET_MASKBIT(icon, x, y, mask);
+ }
+ }
+ }
+ }
+ break;
- case 2:
- {
- Uint16 *pixels;
- for (y = 0; y < icon->h; ++y) {
- pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2;
- for (x = 0; x < icon->w; ++x) {
- if ((flags & 1) && *pixels == colorkey) {
- SET_MASKBIT(icon, x, y, mask);
- } else if ((flags & 2)
- && (*pixels & icon->format->Amask) == 0) {
- SET_MASKBIT(icon, x, y, mask);
- }
- pixels++;
- }
- }
- }
- break;
+ case 2:
+ {
+ Uint16 *pixels;
+ for (y = 0; y < icon->h; ++y) {
+ pixels = (Uint16 *) icon->pixels + y * icon->pitch / 2;
+ for (x = 0; x < icon->w; ++x) {
+ if ((flags & 1) && *pixels == colorkey) {
+ SET_MASKBIT(icon, x, y, mask);
+ } else if ((flags & 2)
+ && (*pixels & icon->format->Amask) == 0) {
+ SET_MASKBIT(icon, x, y, mask);
+ }
+ pixels++;
+ }
+ }
+ }
+ break;
- case 4:
- {
- Uint32 *pixels;
- for (y = 0; y < icon->h; ++y) {
- pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4;
- for (x = 0; x < icon->w; ++x) {
- if ((flags & 1) && *pixels == colorkey) {
- SET_MASKBIT(icon, x, y, mask);
- } else if ((flags & 2)
- && (*pixels & icon->format->Amask) == 0) {
- SET_MASKBIT(icon, x, y, mask);
- }
- pixels++;
- }
- }
- }
- break;
- }
+ case 4:
+ {
+ Uint32 *pixels;
+ for (y = 0; y < icon->h; ++y) {
+ pixels = (Uint32 *) icon->pixels + y * icon->pitch / 4;
+ for (x = 0; x < icon->w; ++x) {
+ if ((flags & 1) && *pixels == colorkey) {
+ SET_MASKBIT(icon, x, y, mask);
+ } else if ((flags & 2)
+ && (*pixels & icon->format->Amask) == 0) {
+ SET_MASKBIT(icon, x, y, mask);
+ }
+ pixels++;
+ }
+ }
+ }
+ break;
+ }
}
/*
@@ -2624,41 +2624,41 @@
void
SDL_WM_SetIcon(SDL_Surface * icon, Uint8 * mask)
{
- if (icon && _this->SetIcon) {
- /* Generate a mask if necessary, and create the icon! */
- if (mask == NULL) {
- int mask_len = icon->h * (icon->w + 7) / 8;
- int flags = 0;
- mask = (Uint8 *) SDL_malloc(mask_len);
- if (mask == NULL) {
- return;
- }
- SDL_memset(mask, ~0, mask_len);
- if (icon->flags & SDL_SRCCOLORKEY)
- flags |= 1;
- if (icon->flags & SDL_SRCALPHA)
- flags |= 2;
- if (flags) {
- CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
- }
- _this->SetIcon(_this, icon, mask);
- SDL_free(mask);
- } else {
- _this->SetIcon(_this, icon, mask);
- }
- }
+ if (icon && _this->SetIcon) {
+ /* Generate a mask if necessary, and create the icon! */
+ if (mask == NULL) {
+ int mask_len = icon->h * (icon->w + 7) / 8;
+ int flags = 0;
+ mask = (Uint8 *) SDL_malloc(mask_len);
+ if (mask == NULL) {
+ return;
+ }
+ SDL_memset(mask, ~0, mask_len);
+ if (icon->flags & SDL_SRCCOLORKEY)
+ flags |= 1;
+ if (icon->flags & SDL_SRCALPHA)
+ flags |= 2;
+ if (flags) {
+ CreateMaskFromColorKeyOrAlpha(icon, mask, flags);
+ }
+ _this->SetIcon(_this, icon, mask);
+ SDL_free(mask);
+ } else {
+ _this->SetIcon(_this, icon, mask);
+ }
+ }
}
#endif
SDL_bool
-SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo * info)
+SDL_GetWindowWMInfo(SDL_WindowID windowID, struct SDL_SysWMinfo *info)
{
- SDL_Window *window = SDL_GetWindowFromID(windowID);
+ SDL_Window *window = SDL_GetWindowFromID(windowID);
- if (!window || !_this->GetWindowWMInfo) {
- return SDL_FALSE;
- }
- return (_this->GetWindowWMInfo(_this, window, info));
+ if (!window || !_this->GetWindowWMInfo) {
+ return SDL_FALSE;
+ }
+ return (_this->GetWindowWMInfo(_this, window, info));
}
/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/Xext/Xxf86vm/XF86VMode.c Mon Sep 15 04:31:30 2008 +0000
+++ b/src/video/Xext/Xxf86vm/XF86VMode.c Mon Sep 15 04:32:36 2008 +0000
@@ -292,7 +292,7 @@
_XRead(dpy, (char *) modeline->private,
modeline->privsize * sizeof(INT32));
} else {
- zap_ptr((char *)&modeline->private, sizeof(modeline->private))
+ zap_ptr((char *) &modeline->private, sizeof(modeline->private))
}
UnlockDisplay(dpy);
SyncHandle();