X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5ec69e9666e300c9ba210812a11ca5dc9111b5f9..0c14b6c3241d48d9cc36a2fd0aeab0ba330d96de:/src/common/glcmn.cpp diff --git a/src/common/glcmn.cpp b/src/common/glcmn.cpp index 07db44d4c8..b3e1f57502 100644 --- a/src/common/glcmn.cpp +++ b/src/common/glcmn.cpp @@ -59,7 +59,7 @@ bool wxGLCanvasBase::SetCurrent(const wxGLContext& context) const // that SetCurrent() can only be called for a shown window, so check for it wxASSERT_MSG( IsShownOnScreen(), _T("can't make hidden GL canvas current") ); - return context.SetCurrent(*wx_static_cast(const wxGLCanvas *, this)); + return context.SetCurrent(*static_cast(this)); } bool wxGLCanvasBase::SetColour(const wxString& colour) @@ -115,5 +115,29 @@ void wxGLCanvasBase::OnSize(wxSizeEvent& WXUNUSED(event)) #endif // WXWIN_COMPATIBILITY_2_8 +/* static */ +bool wxGLCanvasBase::IsExtensionInList(const char *list, const char *extension) +{ + for ( const char *p = list; *p; p++ ) + { + // advance up to the next possible match + p = wxStrstr(p, extension); + if ( !p ) + break; + + // check that the extension appears at the beginning/ending of the list + // or is preceded/followed by a space to avoid mistakenly finding + // "glExtension" in a list containing some "glFunkyglExtension" + if ( (p == list || p[-1] == ' ') ) + { + char c = p[strlen(extension)]; + if ( c == '\0' || c == ' ' ) + return true; + } + } + + return false; +} + #endif // wxUSE_GLCANVAS