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

Markus Mohrhard markus.mohrhard at googlemail.com
Mon Sep 1 15:01:29 PDT 2014


 include/vcl/opengl/OpenGLContext.hxx |    2 -
 include/vcl/sysdata.hxx              |    1 
 vcl/osx/salobj.cxx                   |   41 +++++++++++++++++++++++++++--------
 vcl/source/opengl/OpenGLContext.cxx  |   12 +++++-----
 4 files changed, 41 insertions(+), 15 deletions(-)

New commits:
commit 2a1804e9dd04a66b4686b22c9befbb64381c5f1d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Sep 2 00:00:11 2014 +0200

    fix indentation
    
    Change-Id: I4f299e510fecb57f763818743d357ae6bf2333af

diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx
index 816eaf1..8cccd1b 100644
--- a/vcl/osx/salobj.cxx
+++ b/vcl/osx/salobj.cxx
@@ -87,7 +87,8 @@ AquaSalObject::AquaSalObject( AquaSalFrame* pFrame, SystemWindowData* pWindowDat
     {
         maSysData.mpNSView = [[NSView alloc] initWithFrame: aInitFrame];
     }
-        if( maSysData.mpNSView )
+
+    if( maSysData.mpNSView )
     {
         if( mpClipView )
             [mpClipView setDocumentView: maSysData.mpNSView];
commit 49c40d4ec5b7e13370ff33b0d94f9c35fc500de3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Sep 1 23:59:24 2014 +0200

    support legacy and core context on OSX
    
    Change-Id: Ib8cadb3f182ce49c0ca8b6ccaa95960eb8e5f9ae

diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 7ce6763..79f97fc 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -181,7 +181,7 @@ public:
 
     bool supportMultiSampling() const;
 
-    static SystemWindowData generateWinData(Window* pParent);
+    static SystemWindowData generateWinData(Window* pParent, bool bRequestLegacyContext);
 
 private:
     SAL_DLLPRIVATE bool initWindow();
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index 8ac816a..4cfc737 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -178,6 +178,7 @@ struct SystemWindowData
 #if defined( WNT )                  // meaningless on Windows
 #elif defined( MACOSX )
     bool            bOpenGL;        // create a OpenGL providing NSView
+    bool            bLegacy;        // create a 2.1 legacy context, only valid if bOpenGL == true
     // Nothing
 #elif defined( ANDROID )
     // Nothing
diff --git a/vcl/osx/salobj.cxx b/vcl/osx/salobj.cxx
index 7c7ad5d..816eaf1 100644
--- a/vcl/osx/salobj.cxx
+++ b/vcl/osx/salobj.cxx
@@ -49,17 +49,39 @@ AquaSalObject::AquaSalObject( AquaSalFrame* pFrame, SystemWindowData* pWindowDat
     }
     if (pWindowData->bOpenGL)
     {
-        NSOpenGLPixelFormatAttribute aAttributes[] =
+        NSOpenGLPixelFormat* pixFormat = NULL;
+
+        if (pWindowData->bLegacy)
+        {
+            NSOpenGLPixelFormatAttribute aAttributes[] =
+            {
+                NSOpenGLPFADoubleBuffer,
+                NSOpenGLPFAAlphaSize, 8,
+                NSOpenGLPFAColorSize, 24,
+                NSOpenGLPFAMultisample,
+                NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
+                NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)4,
+                0
+            };
+            pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:aAttributes];
+        }
+        else
         {
-            NSOpenGLPFADoubleBuffer,
-            NSOpenGLPFAAlphaSize, 8,
-            NSOpenGLPFAColorSize, 24,
-            0
-        };
+            NSOpenGLPixelFormatAttribute aAttributes[] =
+            {
+                NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core,
+                NSOpenGLPFADoubleBuffer,
+                NSOpenGLPFAAlphaSize, 8,
+                NSOpenGLPFAColorSize, 24,
+                NSOpenGLPFAMultisample,
+                NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
+                NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)4,
+                0
+            };
+            pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:aAttributes];
+        }
 
-        NSOpenGLPixelFormat* pixFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:aAttributes];
         maSysData.mpNSView = [[NSOpenGLView alloc] initWithFrame: aInitFrame pixelFormat:pixFormat];
-
     }
     else
     {
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d7ea0ee..18e0a02 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -615,7 +615,7 @@ bool OpenGLContext::initWindow()
 {
     if( !m_pChildWindow )
     {
-        SystemWindowData winData = generateWinData(mpWindow);
+        SystemWindowData winData = generateWinData(mpWindow, false);
         m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false);
         m_pChildWindowGC.reset(m_pChildWindow);
     }
@@ -642,7 +642,7 @@ bool OpenGLContext::initWindow()
 {
     if( !m_pChildWindow )
     {
-        SystemWindowData winData = generateWinData(mpWindow);
+        SystemWindowData winData = generateWinData(mpWindow, mbRequestLegacyContext);
         m_pChildWindow = new SystemChildWindow(mpWindow, 0, &winData, false);
         m_pChildWindowGC.reset(m_pChildWindow);
     }
@@ -673,7 +673,7 @@ bool OpenGLContext::initWindow()
 bool OpenGLContext::initWindow()
 {
     const SystemEnvData* pChildSysData = 0;
-    SystemWindowData winData = generateWinData(mpWindow);
+    SystemWindowData winData = generateWinData(mpWindow, false);
     if( winData.pVisual )
     {
         if( !m_pChildWindow )
@@ -725,11 +725,13 @@ bool OpenGLContext::initWindow()
 
 #if defined( WNT ) || defined( MACOSX ) || defined( IOS ) || defined( ANDROID )
 
-SystemWindowData OpenGLContext::generateWinData(Window* /*pParent*/)
+SystemWindowData OpenGLContext::generateWinData(Window* /*pParent*/, bool bRequestLegacyContext)
 {
+    (void) bRequestLegacyContext;
     SystemWindowData aWinData;
 #if defined(MACOSX)
     aWinData.bOpenGL = true;
+    aWinData.bLegacy = bRequestLegacyContext;
 #endif
     aWinData.nSize = sizeof(aWinData);
     return aWinData;
@@ -750,7 +752,7 @@ void initOpenGLFunctionPointers()
 
 }
 
-SystemWindowData OpenGLContext::generateWinData(Window* pParent)
+SystemWindowData OpenGLContext::generateWinData(Window* pParent, bool)
 {
     SystemWindowData aWinData;
     aWinData.nSize = sizeof(aWinData);


More information about the Libreoffice-commits mailing list