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

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Nov 5 20:21:27 PST 2014


 vcl/opengl/gdiimpl.cxx              |   26 ++++++++++++++------------
 vcl/opengl/salbmp.cxx               |    1 -
 vcl/source/opengl/OpenGLContext.cxx |    2 ++
 vcl/win/source/gdi/gdiimpl.cxx      |    4 ++++
 vcl/win/source/gdi/gdiimpl.hxx      |    4 ++++
 5 files changed, 24 insertions(+), 13 deletions(-)

New commits:
commit 54d6a64d6db4976699095e69a8ece60445735fb9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Nov 6 05:19:54 2014 +0100

    implement abstract virtual methods in windows classes
    
    Change-Id: Ifd34cdab725c2d8f2417585b1b90c79cfa977bd1

diff --git a/vcl/win/source/gdi/gdiimpl.cxx b/vcl/win/source/gdi/gdiimpl.cxx
index 453033f..de9b6e3 100644
--- a/vcl/win/source/gdi/gdiimpl.cxx
+++ b/vcl/win/source/gdi/gdiimpl.cxx
@@ -294,6 +294,10 @@ WinSalGraphicsImpl::~WinSalGraphicsImpl()
 
 }
 
+void WinSalGraphicsImpl::Init(SalFrame* /*pFrame*/)
+{
+}
+
 void WinSalGraphicsImpl::freeResources()
 {
 }
diff --git a/vcl/win/source/gdi/gdiimpl.hxx b/vcl/win/source/gdi/gdiimpl.hxx
index c10a143..ebef9ea 100644
--- a/vcl/win/source/gdi/gdiimpl.hxx
+++ b/vcl/win/source/gdi/gdiimpl.hxx
@@ -52,6 +52,8 @@ public:
 
     virtual ~WinSalGraphicsImpl();
 
+    virtual void Init(SalFrame* pFrame) SAL_OVERRIDE;
+
     virtual void freeResources() SAL_OVERRIDE;
 
     virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE;
@@ -211,6 +213,8 @@ public:
 
     virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
             const Gradient& rGradient) SAL_OVERRIDE;
+
+    virtual bool swapBuffers() SAL_OVERRIDE { return false; }
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ac37e7ba056f9043a31aab1cf5166ea436e12c0b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Nov 6 05:18:48 2014 +0100

    ifdef linux only code
    
    Change-Id: I56b13dee13373d7fc24efa37680e9010a73f4d04

diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 32a0126..14807ca 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -26,7 +26,6 @@
 #include "salgdi.hxx"
 
 #include "opengl/salbmp.hxx"
-#include "unx/salbmp.h"
 
 static bool isValidBitCount( sal_uInt16 nBitCount )
 {
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index b1cec57..9a74d7f 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -25,7 +25,9 @@
 
 using namespace com::sun::star;
 
+#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
 static std::vector< GLXContext > vShareList;
+#endif
 
 GLWindow::~GLWindow()
 {
commit dc9ed60a6eba83a07cc1eac5fb4b12d51e6c33f5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu Nov 6 03:37:47 2014 +0100

    MSVC does not support VLA
    
    Change-Id: I46654d81b99051f764d829a262a14f8f0c5f536b

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index ef398b7..82b3393 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -27,6 +27,8 @@
 #include <vcl/opengl/OpenGLHelper.hxx>
 #include "opengl/salbmp.hxx"
 
+#include <vector>
+
 #define GL_ATTRIB_POS 0
 #define GL_ATTRIB_TEX 1
 
@@ -272,17 +274,17 @@ void OpenGLSalGraphicsImpl::DrawLine( long nX1, long nY1, long nX2, long nY2 )
 
 void OpenGLSalGraphicsImpl::DrawLines( sal_uInt32 nPoints, const SalPoint* pPtAry, bool bClose )
 {
-    GLfloat pPoints[nPoints * 2];
+    std::vector<GLfloat> aPoints(nPoints * 2);
     sal_uInt32 i, j;
 
     for( i = 0, j = 0; i < nPoints; i++ )
     {
-        pPoints[j++] = (2 * pPtAry[i].mnX) / GetWidth()  - 1.0;
-        pPoints[j++] = (2 * pPtAry[i].mnY) / GetHeight() - 1.0;
+        aPoints[j++] = (2 * pPtAry[i].mnX) / GetWidth()  - 1.0;
+        aPoints[j++] = (2 * pPtAry[i].mnY) / GetHeight() - 1.0;
     }
 
     glEnableVertexAttribArray( GL_ATTRIB_POS );
-    glVertexAttribPointer( GL_ATTRIB_POS, nPoints * 2, GL_FLOAT, GL_FALSE, 0, pPoints );
+    glVertexAttribPointer( GL_ATTRIB_POS, nPoints * 2, GL_FLOAT, GL_FALSE, 0, &aPoints[0] );
     if( bClose )
         glDrawArrays( GL_LINE_LOOP, 0, nPoints );
     else
@@ -292,17 +294,17 @@ void OpenGLSalGraphicsImpl::DrawLines( sal_uInt32 nPoints, const SalPoint* pPtAr
 
 void OpenGLSalGraphicsImpl::DrawConvexPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry )
 {
-    GLfloat pVertices[nPoints * 2];
+    std::vector<GLfloat> aVertices(nPoints * 2);
     sal_uInt32 i, j;
 
     for( i = 0, j = 0; i < nPoints; i++, j += 2 )
     {
-        pVertices[j] = (2 * pPtAry[i].mnX) / GetWidth() - 1.0;
-        pVertices[j+1] = (2 * pPtAry[i].mnY) / GetHeight() - 1.0;
+        aVertices[j] = (2 * pPtAry[i].mnX) / GetWidth() - 1.0;
+        aVertices[j+1] = (2 * pPtAry[i].mnY) / GetHeight() - 1.0;
     }
 
     glEnableVertexAttribArray( GL_ATTRIB_POS );
-    glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, pVertices );
+    glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_FLOAT, GL_FALSE, 0, &aVertices[0] );
     glDrawArrays( GL_TRIANGLE_FAN, 0, nPoints );
     glDisableVertexAttribArray( GL_ATTRIB_POS );
 }
@@ -338,18 +340,18 @@ void OpenGLSalGraphicsImpl::DrawPolygon( sal_uInt32 nPoints, const SalPoint* pPt
     {
         const ::basegfx::B2DPolygon& aResult(
             ::basegfx::triangulator::triangulate( aPolygon ) );
-        GLushort pVertices[aResult.count() * 2];
+        std::vector<GLushort> aVertices(aResult.count() * 2);
         sal_uInt32 j( 0 );
 
         for( sal_uInt32 i = 0; i < aResult.count(); i++ )
         {
             const ::basegfx::B2DPoint& rPt( aResult.getB2DPoint(i) );
-            pVertices[j++] = rPt.getX();
-            pVertices[j++] = rPt.getY();
+            aVertices[j++] = rPt.getX();
+            aVertices[j++] = rPt.getY();
         }
 
         glEnableVertexAttribArray( GL_ATTRIB_POS );
-        glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_UNSIGNED_SHORT, GL_FALSE, 0, pVertices );
+        glVertexAttribPointer( GL_ATTRIB_POS, 2, GL_UNSIGNED_SHORT, GL_FALSE, 0, &aVertices[0] );
         glDrawArrays( GL_TRIANGLES, 0, aResult.count() );
         glDisableVertexAttribArray( GL_ATTRIB_POS );
     }


More information about the Libreoffice-commits mailing list