Kaydet (Commit) bb34de01 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Move checkExtension() to a more private location

Change-Id: I9f8a4ca0991b59bb9b6af4d40e3136ce5c986731
üst 11fc639c
...@@ -72,43 +72,6 @@ class OpenGLTests; ...@@ -72,43 +72,6 @@ class OpenGLTests;
/// Holds the information of our new child window /// Holds the information of our new child window
struct GLWindow struct GLWindow
{ {
// Copy of gluCheckExtension(), from the Apache-licensed
// https://code.google.com/p/glues/source/browse/trunk/glues/source/glues_registry.c
static GLboolean checkExtension(const GLubyte* extName, const GLubyte* extString)
{
GLboolean flag=GL_FALSE;
char* word;
char* lookHere;
char* deleteThis;
if (extString==nullptr)
{
return GL_FALSE;
}
deleteThis=lookHere=static_cast<char*>(malloc(strlen(reinterpret_cast<const char*>(extString))+1));
if (lookHere==nullptr)
{
return GL_FALSE;
}
/* strtok() will modify string, so copy it somewhere */
strcpy(lookHere, reinterpret_cast<const char*>(extString));
while ((word=strtok(lookHere, " "))!=nullptr)
{
if (strcmp(word, reinterpret_cast<const char*>(extName))==0)
{
flag=GL_TRUE;
break;
}
lookHere=nullptr; /* get next token */
}
free(static_cast<void*>(deleteThis));
return flag;
}
#if defined( _WIN32 ) #if defined( _WIN32 )
HWND hWnd; HWND hWnd;
HDC hDC; HDC hDC;
...@@ -129,7 +92,7 @@ struct GLWindow ...@@ -129,7 +92,7 @@ struct GLWindow
GLXContext ctx; GLXContext ctx;
GLXPixmap glPix; GLXPixmap glPix;
bool HasGLXExtension( const char* name ) { return checkExtension( reinterpret_cast<const GLubyte*>(name), reinterpret_cast<const GLubyte*>(GLXExtensions) ); } bool HasGLXExtension( const char* name ) const;
const char* GLXExtensions; const char* GLXExtensions;
#endif #endif
unsigned int bpp; unsigned int bpp;
......
...@@ -665,7 +665,47 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen) ...@@ -665,7 +665,47 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen)
return ImplInit(); return ImplInit();
} }
// Copy of gluCheckExtension(), from the Apache-licensed
// https://code.google.com/p/glues/source/browse/trunk/glues/source/glues_registry.c
static GLboolean checkExtension(const GLubyte* extName, const GLubyte* extString)
{
GLboolean flag=GL_FALSE;
char* word;
char* lookHere;
char* deleteThis;
if (extString==nullptr)
{
return GL_FALSE;
}
deleteThis=lookHere=static_cast<char*>(malloc(strlen(reinterpret_cast<const char*>(extString))+1));
if (lookHere==nullptr)
{
return GL_FALSE;
}
/* strtok() will modify string, so copy it somewhere */
strcpy(lookHere, reinterpret_cast<const char*>(extString));
while ((word=strtok(lookHere, " "))!=nullptr)
{
if (strcmp(word, reinterpret_cast<const char*>(extName))==0)
{
flag=GL_TRUE;
break;
}
lookHere=nullptr; /* get next token */
}
free(static_cast<void*>(deleteThis));
return flag;
}
bool GLWindow::HasGLXExtension( const char* name ) const
{
return checkExtension( reinterpret_cast<const GLubyte*>(name), reinterpret_cast<const GLubyte*>(GLXExtensions) );
}
bool OpenGLContext::ImplInit() bool OpenGLContext::ImplInit()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment