[Libreoffice-commits] core.git: Branch 'private/moggi/chart-opengl-window-version2' - chart2/inc chart2/source
Markus Mohrhard
markus.mohrhard at collabora.co.uk
Tue May 6 20:15:06 PDT 2014
chart2/inc/ChartModel.hxx | 4 ++++
chart2/source/model/main/ChartModel.cxx | 8 ++++++++
chart2/source/view/charttypes/GL3DBarChart.cxx | 9 +++++----
chart2/source/view/inc/GL3DBarChart.hxx | 4 ++--
chart2/source/view/main/ChartView.cxx | 8 +++++++-
5 files changed, 26 insertions(+), 7 deletions(-)
New commits:
commit c647aeec41897d2f79ab34fd6a629ecc8cb75837
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date: Wed May 7 05:10:12 2014 +0200
the rendering is working on-screen
I can't believe that I finally see something on the screen.
Change-Id: Ic374c8a0d0fa5050b0701a5553136759c9c7602c
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx
index fc0741d..6ea16fd 100644
--- a/chart2/inc/ChartModel.hxx
+++ b/chart2/inc/ChartModel.hxx
@@ -70,6 +70,7 @@
#include <boost/scoped_ptr.hpp>
class SvNumberFormatter;
+class OpenGLWindow;
namespace chart
{
@@ -595,10 +596,13 @@ public:
void getNextTimePoint();
void setTimeBasedRange(sal_Int32 nStart, sal_Int32 nEnd);
+ OpenGLWindow* getOpenGLWindow();
+
private:
sal_Int32 mnStart;
sal_Int32 mnEnd;
bool bSet;
+ OpenGLWindow* mpOpenGLWindow;
};
} // namespace chart
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx
index cf52cac..f876a88 100644
--- a/chart2/source/model/main/ChartModel.cxx
+++ b/chart2/source/model/main/ChartModel.cxx
@@ -108,6 +108,7 @@ ChartModel::ChartModel(uno::Reference<uno::XComponentContext > const & xContext)
, mnStart(0)
, mnEnd(0)
,bSet(false)
+ , mpOpenGLWindow(NULL)
{
OSL_TRACE( "ChartModel: CTOR called" );
@@ -153,6 +154,7 @@ ChartModel::ChartModel( const ChartModel & rOther )
, mnStart(rOther.mnStart)
, mnEnd(rOther.mnEnd)
, bSet(false)
+ , mpOpenGLWindow(NULL)
{
OSL_TRACE( "ChartModel: Copy-CTOR called" );
@@ -1415,6 +1417,12 @@ void ChartModel::setWindow( const sal_uInt64 nWindowPtr )
void* pPtr = (void*)nWindowPtr;
OpenGLWindow* pWindow = reinterpret_cast<OpenGLWindow*>(pPtr);
assert(pWindow);
+ mpOpenGLWindow = pWindow;
+}
+
+OpenGLWindow* ChartModel::getOpenGLWindow()
+{
+ return mpOpenGLWindow;
}
} // namespace chart
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index b29d193..f19ab64 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -19,10 +19,11 @@
namespace chart {
-GL3DBarChart::GL3DBarChart(const std::vector<VDataSeries*>& rDataSeries):
+GL3DBarChart::GL3DBarChart(const std::vector<VDataSeries*>& rDataSeries,
+ OpenGLContext& rContext):
maDataSeries(rDataSeries),
mpRenderer(new opengl3D::OpenGL3DRenderer()),
- mxContext(new opengl3D::temporary::TemporaryContext(mpRenderer.get()))
+ mrContext(rContext)
{
}
@@ -65,13 +66,13 @@ void GL3DBarChart::create3DShapes()
void GL3DBarChart::render()
{
- mxContext->init();
+ mrContext.makeCurrent();
for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
itrEnd = maShapes.end(); itr != itrEnd; ++itr)
{
itr->render();
}
- mxContext->render();
+ mrContext.swapBuffers();
}
}
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index da3d1e1..6efc86c 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -32,7 +32,7 @@ class TemporaryContext;
class GL3DBarChart
{
public:
- GL3DBarChart(const std::vector<VDataSeries*>& rDataSeries);
+ GL3DBarChart(const std::vector<VDataSeries*>& rDataSeries, OpenGLContext& rContext);
~GL3DBarChart();
void create3DShapes();
@@ -45,7 +45,7 @@ private:
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
- boost::scoped_ptr<opengl3D::temporary::TemporaryContext> mxContext;
+ OpenGLContext& mrContext;
};
}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 88c3103..98c9b91 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -65,6 +65,8 @@
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
#include <svx/unofill.hxx>
+#include <vcl/openglwin.hxx>
+#include <vcl/opengl/OpenGLContext.hxx>
#include <drawinglayer/XShapeDumper.hxx>
@@ -3143,7 +3145,11 @@ void ChartView::createShapes3D()
}
}
- GL3DBarChart aBarChart(aDataSeries);
+ OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
+ if(!pWindow)
+ return;
+
+ GL3DBarChart aBarChart(aDataSeries, *pWindow->getContext());
aBarChart.create3DShapes();
aBarChart.render();
}
More information about the Libreoffice-commits
mailing list