[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 2 commits - include/vcl vcl/source vcl/win

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Nov 3 19:04:34 PST 2014


 include/vcl/opengl/OpenGLContext.hxx |    2 ++
 vcl/source/opengl/OpenGLContext.cxx  |   31 +++++++++++++++++++++++++------
 vcl/win/source/gdi/salgdi.cxx        |    2 ++
 3 files changed, 29 insertions(+), 6 deletions(-)

New commits:
commit ade03f86a390889d3888c7c1c603f5b415446d76
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Nov 4 01:19:12 2014 +0100

    use the new virtual device support in OpenGL for win backend
    
    Change-Id: Icd67dd7bad1399c861db41c418095c2b6b1d6d78

diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 9dfcf74..17074a8 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -487,6 +487,8 @@ void WinSalGraphics::InitGraphics()
     OpenGLSalGraphicsImpl* pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get());
     if (pImpl)
     {
+        if (mbVirDev)
+            pImpl->GetOpenGLContext().requestVirtualDevice();
         pImpl->GetOpenGLContext().init(mhLocalDC, mhWnd);
     }
 }
commit 6dfbb195d18047b9808abe1a58801606da8d7245
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Nov 4 01:15:30 2014 +0100

    support rendering to memory device contexts on Windows
    
    Change-Id: I91fdd429663fae76bfe17d37de86d118621cf160

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 3a8ec9a..a8344d6 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -156,6 +156,7 @@ public:
 
     void requestLegacyContext();
     void requestSingleBufferedRendering();
+    void requestVirtualDevice();
 
     bool init(vcl::Window* pParent = 0);
     bool init(SystemChildWindow* pChildWindow);
@@ -211,6 +212,7 @@ private:
     bool mbInitialized;
     bool mbRequestLegacyContext;
     bool mbUseDoubleBufferedRendering;
+    bool mbRequestVirtualDevice;
 };
 
 #endif
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index fe97372..508bf0b 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -37,7 +37,8 @@ OpenGLContext::OpenGLContext():
     m_pChildWindow(NULL),
     mbInitialized(false),
     mbRequestLegacyContext(false),
-    mbUseDoubleBufferedRendering(true)
+    mbUseDoubleBufferedRendering(true),
+    mbRequestVirtualDevice(false)
 {
 }
 
@@ -77,6 +78,11 @@ void OpenGLContext::requestSingleBufferedRendering()
     mbUseDoubleBufferedRendering = false;
 }
 
+void OpenGLContext::requestVirtualDevice()
+{
+    mbRequestVirtualDevice = true;
+}
+
 #if defined( _WIN32 )
 static LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 {
@@ -182,7 +188,8 @@ bool WGLisExtensionSupported(const char *extension)
     }
 }
 
-bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat, bool bUseDoubleBufferedRendering)
+bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat,
+        bool bUseDoubleBufferedRendering, bool bRequestVirtualDevice)
 {
     HWND hWnd = NULL;
     GLWindow glWin;
@@ -235,6 +242,11 @@ bool InitMultisample(PIXELFORMATDESCRIPTOR pfd, int& rPixelFormat, bool bUseDoub
     if (!bUseDoubleBufferedRendering)
         iAttributes[1] = GL_FALSE;
 
+    if (bRequestVirtualDevice)
+    {
+        iAttributes[2] = WGL_DRAW_TO_BITMAP_ARB;
+    }
+
     bool bArbMultisampleSupported = true;
 
     // First We Check To See If We Can Get A Pixel Format For 4 Samples
@@ -589,9 +601,7 @@ bool OpenGLContext::ImplInit()
     {
         sizeof(PIXELFORMATDESCRIPTOR),
         1,                              // Version Number
-        PFD_DRAW_TO_WINDOW |
-        PFD_SUPPORT_OPENGL |
-        PFD_DOUBLEBUFFER,
+        PFD_SUPPORT_OPENGL,
         PFD_TYPE_RGBA,                  // Request An RGBA Format
         (BYTE)32,                       // Select Our Color Depth
         0, 0, 0, 0, 0, 0,               // Color Bits Ignored
@@ -607,9 +617,18 @@ bool OpenGLContext::ImplInit()
         0, 0, 0                         // Layer Masks Ignored
     };
 
+    if (mbUseDoubleBufferedRendering)
+        PixelFormatFront.dwFlags |= PFD_DOUBLEBUFFER;
+
+    if (mbRequestVirtualDevice)
+        PixelFormatFront.dwFlags |= PFD_DRAW_TO_BITMAP;
+    else
+        PixelFormatFront.dwFlags |= PFD_DRAW_TO_WINDOW;
+
     //  we must check whether can set the MSAA
     int WindowPix = 0;
-    bool bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix, mbUseDoubleBufferedRendering);
+    bool bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix,
+            mbUseDoubleBufferedRendering, mbRequestVirtualDevice);
     if (bMultiSampleSupport && WindowPix != 0)
     {
         m_aGLWin.bMultiSampleSupported = true;


More information about the Libreoffice-commits mailing list