diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-05-07 05:10:12 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-05-07 21:23:04 +0200 |
commit | a7eba60df0a8ce190015a54f8fa919c1bb377a7e (patch) | |
tree | 1a28ed3b2b91963de9c6d3dc2590c8d3653d73f5 /chart2 | |
parent | af578839ca4bfd3dfc09203994189254a60e5ea9 (diff) |
the rendering is working on-screen
I can't believe that I finally see something on the screen.
Change-Id: Ic374c8a0d0fa5050b0701a5553136759c9c7602c
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/inc/ChartModel.hxx | 4 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 8 | ||||
-rw-r--r-- | chart2/source/view/charttypes/GL3DBarChart.cxx | 9 | ||||
-rw-r--r-- | chart2/source/view/inc/GL3DBarChart.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 8 |
5 files changed, 26 insertions, 7 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index fc0741d06a42..6ea16fd25d06 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 cf52cacd37cf..f876a88d09dd 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 b29d1935662f..f19ab641dd39 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 da3d1e14056d..6efc86c85aa3 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 88c31039b7e6..98c9b9136b6c 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(); } |