[Libreoffice-commits] core.git: 11 commits - chart2/source include/svx include/vcl svx/source vcl/Library_vclopengl.mk vcl/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Mon Apr 14 16:54:06 PDT 2014
chart2/source/view/inc/3DChartObjects.hxx | 2
chart2/source/view/inc/AbstractShapeFactory.hxx | 4
chart2/source/view/inc/GL3DBarChart.hxx | 2
chart2/source/view/inc/OpenglShapeFactory.hxx | 4
chart2/source/view/inc/ShapeFactory.hxx | 4
chart2/source/view/main/ChartView.cxx | 4
chart2/source/view/main/DummyXShape.cxx | 10
chart2/source/view/main/DummyXShape.hxx | 4
chart2/source/view/main/OpenGLRender.cxx | 155 -------------
chart2/source/view/main/OpenGLRender.hxx | 3
chart2/source/view/main/OpenglShapeFactory.cxx | 86 +++++--
include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx | 2
include/svx/svdoopengl.hxx | 18 +
include/svx/unoshape.hxx | 6
include/vcl/OpenGLContext.hxx | 167 --------------
include/vcl/opengl/IOpenGLRenderer.hxx | 47 ++++
include/vcl/opengl/OpenGLContext.hxx | 172 +++++++++++++++
include/vcl/opengl/OpenGLHelper.hxx | 27 ++
svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx | 5
svx/source/svdraw/svdoopengl.cxx | 21 +
svx/source/unodraw/unoshap4.cxx | 12 +
vcl/Library_vclopengl.mk | 1
vcl/source/opengl/OpenGLContext.cxx | 2
vcl/source/opengl/OpenGLHelper.cxx | 145 ++++++++++++
24 files changed, 547 insertions(+), 356 deletions(-)
New commits:
commit 2be4ee667237a688a863d446d32b74189f796c0b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Apr 15 01:42:42 2014 +0200
don't try to init OpenGLRender in the constructor
wait until the context has been created and we can actually render
Change-Id: I841d64ae847a2fdc74954887d3a6fcfcd06fc6a3
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 5a0f88e..dc22de2 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -1143,11 +1143,11 @@ void DummyXShapes::render()
}
DummyChart::DummyChart(uno::Reference< drawing::XShape > xTarget):
- m_GLRender(xTarget)
+ m_GLRender(xTarget),
+ mbNotInit(true)
{
SAL_INFO("chart2.opengl", "DummyXShape::DummyChart()-----test: ");
setName("com.sun.star.chart2.shapes");
- m_GLRender.InitOpenGL();
}
void SAL_CALL DummyChart::setPosition( const awt::Point& aPosition )
@@ -1173,6 +1173,12 @@ void SAL_CALL DummyChart::setSize( const awt::Size& aSize )
void DummyChart::render()
{
+ if(mbNotInit)
+ {
+ m_GLRender.InitOpenGL();
+ mbNotInit = false;
+ }
+
SAL_INFO("chart2.opengl", "render chart");
m_GLRender.prepareToRender();
#if 0
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index b5aeb26..0cff72f 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -407,6 +407,8 @@ private:
public:
OpenGLRender m_GLRender;
+
+ bool mbNotInit;
};
class DummyGroup2D : public DummyXShapes
commit 34bd4798c56b5ad84450593f150ce97d912e6a2f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Apr 15 01:37:45 2014 +0200
remove the glew part in OpenGLRender.cxx
The glew init part is now in vcl"s OpenGLContext class.
Change-Id: I423e45cf7297df87cb8668b43f9243589b7e26ff
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 0ccb353..8ab05b7 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -81,8 +81,6 @@ int static checkGLError(const char *file, int line)
return retCode;
}
-static bool bGlewInit = false;
-
#define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__)
#define CHECK_GL_FRAME_BUFFER_STATUS() \
@@ -107,19 +105,7 @@ int OpenGLRender::InitOpenGL()
{
//TODO: moggi: get the information from the context
mbArbMultisampleSupported = true;
- if(!bGlewInit)
- {
- glewExperimental = GL_TRUE;
- if (glewInit() != GLEW_OK)
- {
- SAL_WARN("chart2.opengl", "Failed to initialize GLEW");
- return -1;
- }
- else
- bGlewInit = true;
- }
- // These guys don't just check support but setup the vtables.
if (glewIsSupported("framebuffer_object") != GLEW_OK)
{
SAL_WARN("chart2.opengl", "GL stack has no framebuffer support");
commit 6ef014e597571557b6e45edf29c756fac0b9614c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Apr 15 01:24:32 2014 +0200
initialize the OpenGL context as soon as possible
Change-Id: I58051695d0ca8384fb771bfc74aeb228145f77e6
diff --git a/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx b/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
index 2cf0086..a4a8d90 100644
--- a/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofopenglobj.cxx
@@ -8,6 +8,9 @@
*/
#include <svx/sdr/contact/viewobjectcontactofopenglobj.hxx>
+#include <svx/sdr/contact/viewcontactofopenglobj.hxx>
+
+#include <svx/svdoopengl.hxx>
#include <vcl/outdev.hxx>
#include <vcl/window.hxx>
@@ -18,6 +21,8 @@ ViewObjectContactOfOpenGLObj::ViewObjectContactOfOpenGLObj(
ObjectContact& rObjectContact, ViewContact& rViewContact )
: ViewObjectContactOfSdrObj( rObjectContact, rViewContact )
{
+ OpenGLContext& rContext = static_cast<SdrOpenGLObj&>(static_cast<ViewContactOfSdrObj&>(rViewContact).GetSdrObject()).getOpenGLContext();
+ rContext.init(getWindow());
}
ViewObjectContactOfOpenGLObj::~ViewObjectContactOfOpenGLObj()
commit cd56c7bcf375a2ec9b93496f37ab781887fc12f1
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Apr 15 00:55:07 2014 +0200
move some common OpenGL methods to vcl
Change-Id: Ic96487afce64bfb0c1dfcc03c088e5d6e1b34ad3
diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 01331a0..0ccb353 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -35,9 +35,7 @@
#include <vcl/virdev.hxx>
#include <vcl/dibtools.hxx>
-#include <osl/file.hxx>
-#include <rtl/bootstrap.hxx>
-#include <config_folders.h>
+#include <vcl/opengl/OpenGLHelper.hxx>
#include <boost/scoped_array.hpp>
@@ -96,133 +94,6 @@ static bool bGlewInit = false;
namespace {
-OUString getShaderFolder()
-{
- OUString aUrl("$BRAND_BASE_DIR/" LIBO_ETC_FOLDER);
- rtl::Bootstrap::expandMacros(aUrl);
-
- return aUrl + "/opengl/";
-}
-
-OUString maShaderFolder = getShaderFolder();
-
-OString loadShader(const OUString& rFilename)
-{
- OUString aFileURL = maShaderFolder + rFilename +".glsl";
- osl::File aFile(aFileURL);
- if(aFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None)
- {
- sal_uInt64 nSize = 0;
- aFile.getSize(nSize);
- char* content = new char[nSize+1];
- sal_uInt64 nBytesRead = 0;
- aFile.read(content, nSize, nBytesRead);
- if(nSize != nBytesRead)
- assert(false);
-
- content[nSize] = 0;
- return OString(content);
- }
- else
- {
- SAL_WARN("chart2.opengl", "could not load the file: " << aFileURL);
- }
-
- return OString();
-}
-
-}
-
-GLint OpenGLRender::LoadShaders(const OUString& rVertexShaderName,const OUString& rFragmentShaderName)
-{
- // Create the shaders
- GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
- GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
-
- GLint Result = GL_FALSE;
- int InfoLogLength;
-
- // Compile Vertex Shader
- OString aVertexShaderSource = loadShader(rVertexShaderName);
- char const * VertexSourcePointer = aVertexShaderSource.getStr();
- glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
- glCompileShader(VertexShaderID);
-
- // Check Vertex Shader
- glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
- if ( !Result )
- {
- glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
- if ( InfoLogLength > 0 )
- {
- std::vector<char> VertexShaderErrorMessage(InfoLogLength+1);
- glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
- VertexShaderErrorMessage.push_back('\0');
- SAL_WARN("chart2.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]);
- }
- else
- SAL_WARN("chart2.opengl", "vertex shader compile failed without error log");
-
- return 0;
- }
-
- // Compile Fragment Shader
- OString aFragmentShaderSource = loadShader(rFragmentShaderName);
- char const * FragmentSourcePointer = aFragmentShaderSource.getStr();
- glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
- glCompileShader(FragmentShaderID);
-
- // Check Fragment Shader
- glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
- if ( !Result )
- {
- glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
- if ( InfoLogLength > 0 )
- {
- std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1);
- glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
- FragmentShaderErrorMessage.push_back('\0');
- SAL_WARN("chart2.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]);
- }
- else
- SAL_WARN("chart2.opengl", "fragment shader compile failed without error log");
-
-
- return 0;
- }
-
- // Link the program
- GLint ProgramID = glCreateProgram();
- glAttachShader(ProgramID, VertexShaderID);
- glAttachShader(ProgramID, FragmentShaderID);
- glLinkProgram(ProgramID);
-
- // Check the program
- glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
- if ( !Result )
- {
- glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
- if ( InfoLogLength > 0 )
- {
- std::vector<char> ProgramErrorMessage(InfoLogLength+1);
- glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
- ProgramErrorMessage.push_back('\0');
- SAL_WARN("chart2.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]);
- }
- else
- SAL_WARN("chart2.opengl", "shader program link failed without error log");
-
- return 0;
- }
-
- glDeleteShader(VertexShaderID);
- glDeleteShader(FragmentShaderID);
-
- return ProgramID;
-}
-
-namespace {
-
GLfloat texCoords[] = {
0.0f, 0.0f,
1.0f, 0.0f,
@@ -287,26 +158,26 @@ int OpenGLRender::InitOpenGL()
CHECK_GL_ERROR();
- m_CommonProID = LoadShaders("commonVertexShader", "commonFragmentShader");
+ m_CommonProID = OpenGLHelper::LoadShaders("commonVertexShader", "commonFragmentShader");
m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
m_2DColorID = glGetUniformLocation(m_CommonProID, "vColor");
CHECK_GL_ERROR();
#if DEBUG_POSITIONING
- m_DebugProID = LoadShaders("debugVertexShader", "debugFragmentShader");
+ m_DebugProID = OpenGLHelper::LoadShaders("debugVertexShader", "debugFragmentShader");
m_DebugVertexID = glGetAttribLocation(m_DebugProID, "vPosition");
CHECK_GL_ERROR();
#endif
- m_BackgroundProID = LoadShaders("backgroundVertexShader", "backgroundFragmentShader");
+ m_BackgroundProID = OpenGLHelper::LoadShaders("backgroundVertexShader", "backgroundFragmentShader");
m_BackgroundMatrixID = glGetUniformLocation(m_BackgroundProID, "MVP");
m_BackgroundVertexID = glGetAttribLocation(m_BackgroundProID, "vPosition");
m_BackgroundColorID = glGetAttribLocation(m_BackgroundProID, "vColor");
CHECK_GL_ERROR();
- m_SymbolProID = LoadShaders("symbolVertexShader", "symbolFragmentShader");
+ m_SymbolProID = OpenGLHelper::LoadShaders("symbolVertexShader", "symbolFragmentShader");
m_SymbolVertexID = glGetAttribLocation(m_SymbolProID, "vPosition");
m_SymbolMatrixID = glGetUniformLocation(m_SymbolProID, "MVP");
m_SymbolColorID = glGetUniformLocation(m_SymbolProID, "vColor");
@@ -314,7 +185,7 @@ int OpenGLRender::InitOpenGL()
CHECK_GL_ERROR();
- m_TextProID = LoadShaders("textVertexShader", "textFragmentShader");
+ m_TextProID = OpenGLHelper::LoadShaders("textVertexShader", "textFragmentShader");
m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP");
m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition");
m_TextTexCoordID = glGetAttribLocation(m_TextProID, "texCoord");
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index d0121ad..2f79e1c 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -108,7 +108,6 @@ public:
void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha);
private:
- GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
int CreateTextureObj(int width, int height);
int CreateRenderObj(int width, int height);
int CreateFrameBufferObj();
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
new file mode 100644
index 0000000..77d1b28
--- /dev/null
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef VCL_OPENGLHELPERS_HXX
+#define VCL_OPENGLHELPERS_HXX
+
+#include <GL/glew.h>
+#include <vcl/vclopengl_dllapi.hxx>
+
+#include <rtl/ustring.hxx>
+
+class VCLOPENGL_DLLPUBLIC OpenGLHelper
+{
+public:
+ static GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName);
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vclopengl.mk b/vcl/Library_vclopengl.mk
index e14899b..84310bb8 100644
--- a/vcl/Library_vclopengl.mk
+++ b/vcl/Library_vclopengl.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,vclopengl,\
$(eval $(call gb_Library_add_exception_objects,vclopengl,\
vcl/source/opengl/OpenGLContext \
+ vcl/source/opengl/OpenGLHelper \
))
ifeq ($(strip $(OS)),WNT)
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
new file mode 100644
index 0000000..75eefe7
--- /dev/null
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -0,0 +1,145 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vcl/opengl/OpenGLHelper.hxx>
+
+#include <osl/file.hxx>
+#include <rtl/bootstrap.hxx>
+#include <config_folders.h>
+
+#include <vector>
+
+namespace {
+
+OUString getShaderFolder()
+{
+ OUString aUrl("$BRAND_BASE_DIR/" LIBO_ETC_FOLDER);
+ rtl::Bootstrap::expandMacros(aUrl);
+
+ return aUrl + "/opengl/";
+}
+
+OUString maShaderFolder = getShaderFolder();
+
+OString loadShader(const OUString& rFilename)
+{
+ OUString aFileURL = maShaderFolder + rFilename +".glsl";
+ osl::File aFile(aFileURL);
+ if(aFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None)
+ {
+ sal_uInt64 nSize = 0;
+ aFile.getSize(nSize);
+ char* content = new char[nSize+1];
+ sal_uInt64 nBytesRead = 0;
+ aFile.read(content, nSize, nBytesRead);
+ if(nSize != nBytesRead)
+ assert(false);
+
+ content[nSize] = 0;
+ return OString(content);
+ }
+ else
+ {
+ SAL_WARN("vcl.opengl", "could not load the file: " << aFileURL);
+ }
+
+ return OString();
+}
+
+}
+
+GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName,const OUString& rFragmentShaderName)
+{
+ // Create the shaders
+ GLuint VertexShaderID = glCreateShader(GL_VERTEX_SHADER);
+ GLuint FragmentShaderID = glCreateShader(GL_FRAGMENT_SHADER);
+
+ GLint Result = GL_FALSE;
+ int InfoLogLength;
+
+ // Compile Vertex Shader
+ OString aVertexShaderSource = loadShader(rVertexShaderName);
+ char const * VertexSourcePointer = aVertexShaderSource.getStr();
+ glShaderSource(VertexShaderID, 1, &VertexSourcePointer , NULL);
+ glCompileShader(VertexShaderID);
+
+ // Check Vertex Shader
+ glGetShaderiv(VertexShaderID, GL_COMPILE_STATUS, &Result);
+ if ( !Result )
+ {
+ glGetShaderiv(VertexShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
+ if ( InfoLogLength > 0 )
+ {
+ std::vector<char> VertexShaderErrorMessage(InfoLogLength+1);
+ glGetShaderInfoLog(VertexShaderID, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
+ VertexShaderErrorMessage.push_back('\0');
+ SAL_WARN("vcl.opengl", "vertex shader compile failed : " << &VertexShaderErrorMessage[0]);
+ }
+ else
+ SAL_WARN("vcl.opengl", "vertex shader compile failed without error log");
+
+ return 0;
+ }
+
+ // Compile Fragment Shader
+ OString aFragmentShaderSource = loadShader(rFragmentShaderName);
+ char const * FragmentSourcePointer = aFragmentShaderSource.getStr();
+ glShaderSource(FragmentShaderID, 1, &FragmentSourcePointer , NULL);
+ glCompileShader(FragmentShaderID);
+
+ // Check Fragment Shader
+ glGetShaderiv(FragmentShaderID, GL_COMPILE_STATUS, &Result);
+ if ( !Result )
+ {
+ glGetShaderiv(FragmentShaderID, GL_INFO_LOG_LENGTH, &InfoLogLength);
+ if ( InfoLogLength > 0 )
+ {
+ std::vector<char> FragmentShaderErrorMessage(InfoLogLength+1);
+ glGetShaderInfoLog(FragmentShaderID, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
+ FragmentShaderErrorMessage.push_back('\0');
+ SAL_WARN("vcl.opengl", "fragment shader compile failed : " << &FragmentShaderErrorMessage[0]);
+ }
+ else
+ SAL_WARN("vcl.opengl", "fragment shader compile failed without error log");
+
+
+ return 0;
+ }
+
+ // Link the program
+ GLint ProgramID = glCreateProgram();
+ glAttachShader(ProgramID, VertexShaderID);
+ glAttachShader(ProgramID, FragmentShaderID);
+ glLinkProgram(ProgramID);
+
+ // Check the program
+ glGetProgramiv(ProgramID, GL_LINK_STATUS, &Result);
+ if ( !Result )
+ {
+ glGetProgramiv(ProgramID, GL_INFO_LOG_LENGTH, &InfoLogLength);
+ if ( InfoLogLength > 0 )
+ {
+ std::vector<char> ProgramErrorMessage(InfoLogLength+1);
+ glGetProgramInfoLog(ProgramID, InfoLogLength, NULL, &ProgramErrorMessage[0]);
+ ProgramErrorMessage.push_back('\0');
+ SAL_WARN("vcl.opengl", "Shader Program failed : " << &ProgramErrorMessage[0]);
+ }
+ else
+ SAL_WARN("vcl.opengl", "shader program link failed without error log");
+
+ return 0;
+ }
+
+ glDeleteShader(VertexShaderID);
+ glDeleteShader(FragmentShaderID);
+
+ return ProgramID;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ce9f9de1971285d41831fa5a5df7462889155afe
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Apr 15 00:43:50 2014 +0200
move the opengl headers to vcl/opengl for better separation
Change-Id: I1bdd0fe0d27674da69a61bd8b438f0c9b050a337
diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx
index edcd273..0483a74 100644
--- a/chart2/source/view/inc/3DChartObjects.hxx
+++ b/chart2/source/view/inc/3DChartObjects.hxx
@@ -12,7 +12,7 @@
#include <tools/color.hxx>
#include <vcl/bitmapex.hxx>
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
namespace chart {
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 6191fc1..4eefdaa 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -14,7 +14,7 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include "VDataSeries.hxx"
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
namespace chart {
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index 81a088a..b5aeb26 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -12,7 +12,7 @@
#include <cppuhelper/implbase6.hxx>
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
#include "OpenGLRender.hxx"
#include <com/sun/star/drawing/XShape.hpp>
diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx
index 6fde176..d0121ad 100755
--- a/chart2/source/view/main/OpenGLRender.hxx
+++ b/chart2/source/view/main/OpenGLRender.hxx
@@ -11,7 +11,7 @@
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <vcl/font.hxx>
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
// Include GLM
#include <list>
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 34c2ea6..64b517e 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -47,7 +47,7 @@
#include <rtl/math.hxx>
#include <svx/svdocirc.hxx>
#include <svx/svdopath.hxx>
-#include <vcl/IOpenGLRenderer.hxx>
+#include <vcl/opengl/IOpenGLRenderer.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
diff --git a/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx b/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
index f540624c..837f637 100644
--- a/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
+++ b/include/svx/sdr/contact/viewobjectcontactofopenglobj.hxx
@@ -11,7 +11,7 @@
#define INCLUDED_SVX_SDR_CONTACT_VIEWOBJECTCONTACTOFOPENGL_HXX
#include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx>
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
class Window;
diff --git a/include/svx/svdoopengl.hxx b/include/svx/svdoopengl.hxx
index a8e7a42..3fcbba2 100644
--- a/include/svx/svdoopengl.hxx
+++ b/include/svx/svdoopengl.hxx
@@ -11,9 +11,9 @@
#define INCLUDED_SVX_SVDO_OPENGL_HXX
#include <svx/svdobj.hxx>
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
-#include <vcl/IOpenGLRenderer.hxx>
+#include <vcl/opengl/IOpenGLRenderer.hxx>
#include <boost/scoped_ptr.hpp>
diff --git a/include/vcl/IOpenGLRenderer.hxx b/include/vcl/opengl/IOpenGLRenderer.hxx
similarity index 100%
rename from include/vcl/IOpenGLRenderer.hxx
rename to include/vcl/opengl/IOpenGLRenderer.hxx
diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
similarity index 100%
rename from include/vcl/OpenGLContext.hxx
rename to include/vcl/opengl/OpenGLContext.hxx
diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx
index ce11c0d..178afcc 100644
--- a/svx/source/svdraw/svdoopengl.cxx
+++ b/svx/source/svdraw/svdoopengl.cxx
@@ -10,7 +10,7 @@
#include <svx/svdoopengl.hxx>
#include <svx/sdr/contact/viewcontactofopenglobj.hxx>
-#include <vcl/IOpenGLRenderer.hxx>
+#include <vcl/opengl/IOpenGLRenderer.hxx>
SdrOpenGLObj::~SdrOpenGLObj()
{
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index bd8065a..4b420182 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -7,7 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#include <vcl/OpenGLContext.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
#include <vcl/syschild.hxx>
#include <vcl/sysdata.hxx>
commit 3bd173af500d2e30f004cac4ca5a9309c5a49741
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Tue Apr 15 00:27:25 2014 +0200
only render through OpenGL after successful context creation
Change-Id: I60ebceee2bf0eca1c7022e14fc43128347d682b5
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 525220a..833380c 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -239,9 +239,9 @@ public:
/**
* Only necessary for stateless implementations
*/
- virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) = 0;
- virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) = 0;
+ virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) = 0;
static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
getChartRootShape( const ::com::sun::star::uno::Reference<
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index e9b2614..c93199f 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -184,9 +184,9 @@ public:
virtual void setPageSize( com::sun::star::uno::Reference < com::sun::star::drawing::XShapes > xChartShapes, const com::sun::star::awt::Size& rSize ) SAL_OVERRIDE;
- virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) SAL_OVERRIDE;
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) SAL_OVERRIDE;
- virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xRootShape) SAL_OVERRIDE;
+ virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage) SAL_OVERRIDE;
};
}
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 74a4d38..87a4387 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -197,9 +197,9 @@ public:
/**
* not necessary right now
*/
- virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > ) SAL_OVERRIDE {}
- virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > ) SAL_OVERRIDE {}
+ virtual void clearPage(com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > ) SAL_OVERRIDE {}
private:
ShapeFactory();
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index c205652..a94b53c 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -2453,7 +2453,7 @@ void ChartView::createShapes()
OSL_FAIL("could not set page size correctly");
}
pShapeFactory->setPageSize(mxRootShape, aPageSize);
- pShapeFactory->clearPage(mxRootShape);
+ pShapeFactory->clearPage(m_xDrawPage);
if(isReal3DChart())
{
@@ -2606,7 +2606,7 @@ void ChartView::createShapes()
//cleanup: remove all empty group shapes to avoid grey border lines:
lcl_removeEmptyGroupShapes( mxRootShape );
- pShapeFactory->render( mxRootShape );
+ pShapeFactory->render( m_xDrawPage );
if(maTimeBased.bTimeBased && maTimeBased.nFrame % 60 == 0)
{
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 75992c0..34c2ea6 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -71,7 +71,6 @@ public:
mxShapes(xShapes) {}
virtual ~OpenGLChartAdapter() {}
- virtual void operator()() {}
uno::Reference<drawing::XShapes> getShapes()
{
@@ -483,15 +482,34 @@ uno::Reference< drawing::XShape >
return pText;
}
-void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape)
+void OpenglShapeFactory::render(uno::Reference< drawing::XDrawPage > xDrawPage)
{
+ IOpenGLRenderer* pRenderer = getRenderer(xDrawPage);
+ if(!pRenderer)
+ return;
+
+ if(!pRenderer->isOpenGLInitialized())
+ return;
+
+ OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
+ if(!pAdapter)
+ return;
+
+ uno::Reference< drawing::XShapes > xRootShape = pAdapter->getShapes();
dummy::DummyChart* pChart = dynamic_cast<dummy::DummyChart*>(xRootShape.get());
assert(pChart);
pChart->render();
}
-void OpenglShapeFactory::clearPage(uno::Reference< drawing::XShapes > xRootShape)
+void OpenglShapeFactory::clearPage(uno::Reference< drawing::XDrawPage > xDrawPage)
{
+ IOpenGLRenderer* pRenderer = getRenderer(xDrawPage);
+
+ OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
+ if(!pAdapter)
+ return;
+
+ uno::Reference< drawing::XShapes > xRootShape = pAdapter->getShapes();
dummy::DummyChart* pChart = dynamic_cast<dummy::DummyChart*>(xRootShape.get());
assert(pChart);
pChart->clear();
diff --git a/include/svx/svdoopengl.hxx b/include/svx/svdoopengl.hxx
index 7760b82..a8e7a42 100644
--- a/include/svx/svdoopengl.hxx
+++ b/include/svx/svdoopengl.hxx
@@ -23,7 +23,7 @@ namespace sdr { namespace contact {
class IOpenGLRenderer;
-class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject
+class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject, public IOpenGLInfoProvider
{
public:
virtual ~SdrOpenGLObj();
@@ -36,6 +36,8 @@ public:
void setRenderer(IOpenGLRenderer* pRenderer);
IOpenGLRenderer* getRenderer();
+ virtual bool isOpenGLInitialized();
+
private:
OpenGLContext maContext;
diff --git a/include/vcl/IOpenGLRenderer.hxx b/include/vcl/IOpenGLRenderer.hxx
index 3efb2c5..b5b723b 100644
--- a/include/vcl/IOpenGLRenderer.hxx
+++ b/include/vcl/IOpenGLRenderer.hxx
@@ -10,12 +10,36 @@
#ifndef VCL_IOPENGLRENDER_HXX
#define VCL_IOPENGLRENDER_HXX
+class IOpenGLInfoProvider
+{
+public:
+ virtual ~IOpenGLInfoProvider() {}
+
+ virtual bool isOpenGLInitialized() = 0;
+};
+
class IOpenGLRenderer
{
public:
- virtual ~IOpenGLRenderer() {};
- virtual void operator()() = 0;
+ IOpenGLRenderer():
+ mpInfoProvider(NULL) {}
+ virtual ~IOpenGLRenderer() {}
+
+ bool isOpenGLInitialized()
+ {
+ if(mpInfoProvider)
+ return mpInfoProvider->isOpenGLInitialized();
+
+ return false;
+ }
+
+ void setInfoProvider(IOpenGLInfoProvider* pInfo)
+ {
+ mpInfoProvider = pInfo;
+ }
+private:
+ IOpenGLInfoProvider* mpInfoProvider;
};
#endif
diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx
index 220efb5..56d6a56 100644
--- a/include/vcl/OpenGLContext.hxx
+++ b/include/vcl/OpenGLContext.hxx
@@ -152,6 +152,11 @@ public:
void renderToFile();
+ bool isInitialized()
+ {
+ return mbInitialized;
+ }
+
private:
SAL_DLLPRIVATE bool initWindow();
diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx
index df2f07b..ce11c0d 100644
--- a/svx/source/svdraw/svdoopengl.cxx
+++ b/svx/source/svdraw/svdoopengl.cxx
@@ -38,6 +38,7 @@ void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fra
void SdrOpenGLObj::setRenderer(IOpenGLRenderer* pRenderer)
{
mpRenderer.reset(pRenderer);
+ mpRenderer->setInfoProvider(this);
}
IOpenGLRenderer* SdrOpenGLObj::getRenderer()
@@ -45,4 +46,9 @@ IOpenGLRenderer* SdrOpenGLObj::getRenderer()
return mpRenderer.get();
}
+bool SdrOpenGLObj::isOpenGLInitialized()
+{
+ return maContext.isInitialized();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d321709febe1222e582614b200e7c155b2f0ee7b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Apr 14 23:51:13 2014 +0200
extract method
Change-Id: I95aacfa9dacd42936ca648ed42b55aa9ec50ebde
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 56b8d28..75992c0 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -94,10 +94,8 @@ namespace opengl {
namespace {
-uno::Reference< drawing::XShapes > getChartShape(
- const uno::Reference< drawing::XDrawPage>& xDrawPage )
+IOpenGLRenderer* getRenderer(const uno::Reference< drawing::XDrawPage>& xDrawPage )
{
- uno::Reference< drawing::XShapes > xRet;
uno::Reference< drawing::XShapes > xShapes( xDrawPage, uno::UNO_QUERY );
if( xShapes.is() )
{
@@ -114,15 +112,25 @@ uno::Reference< drawing::XShapes > getChartShape(
if( aRet.equals("com.sun.star.chart2.shapes") )
{
IOpenGLRenderer* pRenderer = dynamic_cast<SvxOpenGLObject*>(xShape.get())->getRenderer();
- OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
- if(pAdapter)
- xRet = pAdapter->getShapes();
- break;
+ if(pRenderer)
+ return pRenderer;
}
}
}
}
- return xRet;
+
+ return NULL;
+}
+
+uno::Reference< drawing::XShapes > getChartShape(
+ const uno::Reference< drawing::XDrawPage>& xDrawPage )
+{
+ IOpenGLRenderer* pRenderer = getRenderer(xDrawPage);
+ OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
+ if(pAdapter)
+ return pAdapter->getShapes();
+
+ return uno::Reference< drawing::XShapes> ();
}
}
commit d5e1fcdea39f257c4b10e3ef05acf00b21bf6a3a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Apr 14 03:38:54 2014 +0200
remove include and using
Change-Id: I329e02d1e91b8c566d147cd753dca48bf2abf23a
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index e39a154..56b8d28 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -54,11 +54,7 @@
#include "RelativeSizeHelper.hxx"
-#include <algorithm>
-using namespace std;
-
using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
namespace chart
{
commit a3125e805bdc735a00af8dcc5a94b7b6a6a712e9
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Apr 14 03:16:45 2014 +0200
switch to IOpenGLRenderer in chart2 2D rendering
Change-Id: If2351186e6e6612a84b1c98c28bbb7f2c3dc49ab
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index 7cc420c..e39a154 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -47,6 +47,7 @@
#include <rtl/math.hxx>
#include <svx/svdocirc.hxx>
#include <svx/svdopath.hxx>
+#include <vcl/IOpenGLRenderer.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/matrix/b3dhommatrix.hxx>
@@ -67,6 +68,24 @@ extern "C" {
{ return new opengl::OpenglShapeFactory();}
}
+class OpenGLChartAdapter : public IOpenGLRenderer
+{
+public:
+ OpenGLChartAdapter(uno::Reference<drawing::XShapes> xShapes):
+ mxShapes(xShapes) {}
+
+ virtual ~OpenGLChartAdapter() {}
+ virtual void operator()() {}
+
+ uno::Reference<drawing::XShapes> getShapes()
+ {
+ return mxShapes;
+ }
+
+private:
+ uno::Reference<drawing::XShapes> mxShapes; // here to fix lifetime
+};
+
using dummy::DummyXShape;
using dummy::DummyXShapes;
@@ -92,14 +111,16 @@ uno::Reference< drawing::XShapes > getChartShape(
{
if( xShapes->getByIndex( nN ) >>= xShape )
{
-
OUString aRet;
uno::Reference< beans::XPropertySet > xProp( xShape, uno::UNO_QUERY );
xProp->getPropertyValue( UNO_NAME_MISC_OBJ_NAME ) >>= aRet;
if( aRet.equals("com.sun.star.chart2.shapes") )
{
- xRet = dynamic_cast<SvxDummyShapeContainer*>(xShape.get())->getWrappedShape();
+ IOpenGLRenderer* pRenderer = dynamic_cast<SvxOpenGLObject*>(xShape.get())->getRenderer();
+ OpenGLChartAdapter* pAdapter = dynamic_cast<OpenGLChartAdapter*>(pRenderer);
+ if(pAdapter)
+ xRet = pAdapter->getShapes();
break;
}
}
@@ -121,12 +142,17 @@ uno::Reference< drawing::XShapes > OpenglShapeFactory::getOrCreateChartRootShape
uno::Reference< drawing::XShape > xTarget (m_xShapeFactory->createInstance(
"com.sun.star.drawing.OpenGLObject" ), uno::UNO_QUERY );
- dummy::DummyChart *pChart = new dummy::DummyChart(xTarget);
- SvxDummyShapeContainer* pContainer = new SvxDummyShapeContainer(pChart);
- pContainer->setSize(awt::Size(0,0));
- xRet = pChart;
+ uno::Reference<drawing::XShapes> xChart(new dummy::DummyChart(xTarget));
xDrawPage->add(xTarget);
- xDrawPage->add(pContainer);
+ uno::Any aName;
+ aName <<= OUString("com.sun.star.chart2.shapes");
+ uno::Reference<beans::XPropertySet> xPropSet( xTarget, uno::UNO_QUERY_THROW );
+ xPropSet->setPropertyValue( UNO_NAME_MISC_OBJ_NAME, aName );
+
+ SvxOpenGLObject* pObj = dynamic_cast<SvxOpenGLObject*>(xTarget.get());
+ pObj->setRenderer(new OpenGLChartAdapter(xChart));
+
+ xRet = getChartShape( xDrawPage );
}
return xRet;
}
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 60775f6..a500224 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -877,7 +877,7 @@ private:
OUString referer_;
};
-class SvxOpenGLObject : public SvxShape
+class SVX_DLLPUBLIC SvxOpenGLObject : public SvxShape
{
public:
SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){}
diff --git a/include/vcl/IOpenGLRenderer.hxx b/include/vcl/IOpenGLRenderer.hxx
index 92ce064..3efb2c5 100644
--- a/include/vcl/IOpenGLRenderer.hxx
+++ b/include/vcl/IOpenGLRenderer.hxx
@@ -13,7 +13,7 @@
class IOpenGLRenderer
{
public:
- virtual ~IOpenGLRenderer();
+ virtual ~IOpenGLRenderer() {};
virtual void operator()() = 0;
};
commit 7f6b1560e970ea7b2a7397cc427ea9d996c65d9a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Apr 14 02:02:39 2014 +0200
tie lifetime of some objects together
It is just too complicated to follow the different OpenGL contexts in
our current desing. This will at least simplify our handling a bit.
IOpenGLRenderer is an abstract interface that should be implemented by
the code using SdrOpenGLObj to paint with OpenGL.
Change-Id: Ib4bfc0350b4345bc27af8bed037c48c11bb67300
diff --git a/include/svx/svdoopengl.hxx b/include/svx/svdoopengl.hxx
index 68428da..7760b82 100644
--- a/include/svx/svdoopengl.hxx
+++ b/include/svx/svdoopengl.hxx
@@ -13,22 +13,34 @@
#include <svx/svdobj.hxx>
#include <vcl/OpenGLContext.hxx>
+#include <vcl/IOpenGLRenderer.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
namespace sdr { namespace contact {
class ViewContact;
} }
+class IOpenGLRenderer;
+
class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject
{
public:
+ virtual ~SdrOpenGLObj();
virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
OpenGLContext& getOpenGLContext();
virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
+ void setRenderer(IOpenGLRenderer* pRenderer);
+ IOpenGLRenderer* getRenderer();
+
private:
OpenGLContext maContext;
+
+ boost::scoped_ptr<IOpenGLRenderer> mpRenderer;
};
#endif
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 54a784c..60775f6 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -66,6 +66,7 @@ class SdrModel;
class SvxDrawPage;
class SvGlobalName;
class Pair;
+class IOpenGLRenderer;
// Dimension arrows change size/position on save/reload (#i59051#)
namespace basegfx
@@ -881,6 +882,9 @@ class SvxOpenGLObject : public SvxShape
public:
SvxOpenGLObject( SdrObject* pObj ) throw() : SvxShape(pObj){}
virtual ~SvxOpenGLObject() throw() {}
+
+ void setRenderer(IOpenGLRenderer* pRenderer);
+ IOpenGLRenderer* getRenderer();
};
/*
diff --git a/include/vcl/IOpenGLRenderer.hxx b/include/vcl/IOpenGLRenderer.hxx
new file mode 100644
index 0000000..92ce064
--- /dev/null
+++ b/include/vcl/IOpenGLRenderer.hxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef VCL_IOPENGLRENDER_HXX
+#define VCL_IOPENGLRENDER_HXX
+
+class IOpenGLRenderer
+{
+public:
+ virtual ~IOpenGLRenderer();
+ virtual void operator()() = 0;
+
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx
index 45d23ae..df2f07b 100644
--- a/svx/source/svdraw/svdoopengl.cxx
+++ b/svx/source/svdraw/svdoopengl.cxx
@@ -10,6 +10,12 @@
#include <svx/svdoopengl.hxx>
#include <svx/sdr/contact/viewcontactofopenglobj.hxx>
+#include <vcl/IOpenGLRenderer.hxx>
+
+SdrOpenGLObj::~SdrOpenGLObj()
+{
+}
+
sdr::contact::ViewContact* SdrOpenGLObj::CreateObjectSpecificViewContact()
{
return new sdr::contact::ViewContactOfOpenGLObj(*this);
@@ -29,5 +35,14 @@ void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fra
SAL_WARN("svx.opengl", "resized opengl drawinglayer object");
}
+void SdrOpenGLObj::setRenderer(IOpenGLRenderer* pRenderer)
+{
+ mpRenderer.reset(pRenderer);
+}
+
+IOpenGLRenderer* SdrOpenGLObj::getRenderer()
+{
+ return mpRenderer.get();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 239328d..40a2067 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -50,6 +50,7 @@
#include "svx/svdview.hxx"
#include "svx/svdglob.hxx"
#include "svx/svdstr.hrc"
+#include <svx/svdoopengl.hxx>
#include <vcl/wmf.hxx>
@@ -968,4 +969,15 @@ SvxDummyShapeContainer::SvxDummyShapeContainer(uno::Reference< drawing::XShapes
SvxDummyShapeContainer::~SvxDummyShapeContainer() throw()
{
}
+
+void SvxOpenGLObject::setRenderer(IOpenGLRenderer* pRenderer)
+{
+ static_cast<SdrOpenGLObj*>(GetSdrObject())->setRenderer(pRenderer);
+}
+
+IOpenGLRenderer* SvxOpenGLObject::getRenderer()
+{
+ return static_cast<SdrOpenGLObj*>(GetSdrObject())->getRenderer();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 64dada726815b22eb943dc6fa68d86dd896ba32a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Mon Apr 14 01:25:23 2014 +0200
remove unused include
Change-Id: I6303f9b1f0aa8a01a20275c92df026d69632db1d
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index ce8db18..7cc420c 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -54,10 +54,8 @@
#include "RelativeSizeHelper.hxx"
#include <algorithm>
-#include <iostream>
using namespace std;
-
using namespace ::com::sun::star;
using ::com::sun::star::uno::Reference;
More information about the Libreoffice-commits
mailing list