]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/glcanvas.cpp
make the Pen/Brush code backward compatible as discussed on wx-dev; marked the blocks...
[wxWidgets.git] / src / msw / glcanvas.cpp
index a95e48a54be6981ccbb149ff1fab0368433f4acb..ce18ac742a25adde2cdde7212047a2f52f2b6979 100644 (file)
@@ -200,12 +200,14 @@ wxGLContext::~wxGLContext()
     wglDeleteContext(m_glContext);
 }
 
-void wxGLContext::SetCurrent(const wxGLCanvas& win) const
+bool wxGLContext::SetCurrent(const wxGLCanvas& win) const
 {
     if ( !wglMakeCurrent(win.GetHDC(), m_glContext) )
     {
         wxLogLastError(_T("wglMakeCurrent"));
+        return false;
     }
+    return true;
 }
 
 // ============================================================================
@@ -247,10 +249,6 @@ wxGLCanvas::wxGLCanvas(wxWindow *parent,
 
 wxGLCanvas::~wxGLCanvas()
 {
-#if WXWIN_COMPATIBILITY_2_8
-    delete m_glContext;
-#endif
-
     ::ReleaseDC(GetHwnd(), m_hDC);
 }
 
@@ -313,10 +311,14 @@ bool wxGLCanvas::Create(wxWindow *parent,
 // operations
 // ----------------------------------------------------------------------------
 
-void wxGLCanvas::SwapBuffers()
+bool wxGLCanvas::SwapBuffers()
 {
     if ( !::SwapBuffers(m_hDC) )
+    {
+        return false;
         wxLogLastError(_T("SwapBuffers"));
+    }
+    return true;
 }
 
 // ----------------------------------------------------------------------------
@@ -444,6 +446,14 @@ wxGLCanvas::ChooseMatchingPixelFormat(HDC hdc,
     return ::ChoosePixelFormat(hdc, ppfd);
 }
 
+/* static */
+bool wxGLCanvasBase::IsDisplaySupported(const int *attribList)
+{
+    // We need a device context to test the pixel format, so get one
+    // for the root window.
+    return wxGLCanvas::ChooseMatchingPixelFormat(ScreenHDC(), attribList) > 0;
+}
+
 bool wxGLCanvas::DoSetup(const int *attribList)
 {
     PIXELFORMATDESCRIPTOR pfd;