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

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sat Nov 1 16:16:08 PDT 2014


 chart2/source/view/main/GL3DRenderer.cxx |    3 +++
 include/vcl/opengl/OpenGLHelper.hxx      |    5 +++++
 vcl/source/opengl/OpenGLHelper.cxx       |    5 +++++
 vcl/unx/generic/gdi/salgdi.cxx           |    5 ++++-
 4 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit b0350404832a992a1d1db5075821a9a50b31d3fb
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Nov 2 00:12:21 2014 +0100

    add possibility to check if system can run OpenGL VCL backend
    
    Change-Id: If3475c6b2c76e4634f16053928b43a94c83be6ee

diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index 8c04e32..be2dfda 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -46,6 +46,11 @@ public:
     static float getGLVersion();
 
     static void checkGLError(const char* aFile, size_t nLine);
+
+    /**
+     * checks if the system supports all features that are necessary for the OpenGL VCL support
+     */
+    static bool supportsVCLOpenGL();
 };
 
 #define CHECK_GL_ERROR() OpenGLHelper::checkGLError(__FILE__, __LINE__)
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index c94e290..9811b99 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -358,4 +358,9 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine)
     }
 }
 
+bool OpenGLHelper::supportsVCLOpenGL()
+{
+    return true;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index a87eb33..c5dd0be 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -60,6 +60,8 @@
 
 #include <officecfg/Office/Common.hxx>
 
+#include <vcl/opengl/OpenGLHelper.hxx>
+
 X11SalGraphics::X11SalGraphics():
     m_pFrame(NULL),
     m_pVDev(NULL),
@@ -79,7 +81,8 @@ X11SalGraphics::X11SalGraphics():
     bPrinter_(false),
     bVirDev_(false)
 {
-    bool bUseOpenGL = officecfg::Office::Common::VCL::UseOpenGL::get();
+    static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
+    bool bUseOpenGL = bOpenGLPossible ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
     if (bUseOpenGL)
         mpImpl.reset(new OpenGLSalGraphicsImpl());
     else
commit 4f65d229da71e055e10cd7063b96e1bf5a58d89a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Nov 1 16:05:14 2014 +0100

    prevent crash with empty chart scene
    
    Change-Id: I9eb8adf887532c62af6efeac5b0eeec1419b7252

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 6b0004f..b2dfc6f 100755
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -2487,6 +2487,9 @@ glm::mat4 OpenGL3DRenderer::GetGlobalScaleMatrix()
 
 void OpenGL3DRenderer::RenderBatchBars(bool bNewScene)
 {
+    if (m_BarSurface[0].modelMatrixList.empty())
+        return;
+
     if(bNewScene)
     {
         GetBatchBarsInfo();


More information about the Libreoffice-commits mailing list