[Libreoffice-commits] core.git: 3 commits - chart2/source include/vcl sc/Module_sc.mk vcl/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Mon May 12 20:40:34 PDT 2014


 chart2/source/view/charttypes/GL3DBarChart.cxx |   30 +++++---
 chart2/source/view/inc/GL3DBarChart.hxx        |   14 ++-
 chart2/source/view/inc/GL3DPlotterBase.hxx     |    8 +-
 chart2/source/view/main/ChartView.cxx          |   90 ++++++++++++-------------
 include/vcl/openglwin.hxx                      |   13 +++
 sc/Module_sc.mk                                |    2 
 vcl/source/window/openglwin.cxx                |   14 +++
 7 files changed, 107 insertions(+), 64 deletions(-)

New commits:
commit 15e2c82acb60a2f9916f55a144299f64513fdde0
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue May 13 05:28:18 2014 +0200

    restore correct repaint after changed value in 3D chart
    
    Change-Id: Ied1904a56b8d526288a89fd8df0bed639cd317d0

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index c164bd2..35bcb51 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -25,13 +25,10 @@ namespace chart {
 
 GL3DBarChart::GL3DBarChart(
     const css::uno::Reference<css::chart2::XChartType>& xChartType,
-    const boost::ptr_vector<VDataSeries>& rDataSeries,
-    OpenGLWindow& rWindow, ExplicitCategoriesProvider& rCatProvider ) :
+    OpenGLWindow& rWindow) :
     mxChartType(xChartType),
-    maDataSeries(rDataSeries),
     mpRenderer(new opengl3D::OpenGL3DRenderer()),
-    mrWindow(rWindow),
-    mrCatProvider(rCatProvider)
+    mrWindow(rWindow)
 {
     mrWindow.setRenderer(this);
     mpRenderer->init();
@@ -42,7 +39,8 @@ GL3DBarChart::~GL3DBarChart()
     mrWindow.setRenderer(NULL);
 }
 
-void GL3DBarChart::create3DShapes()
+void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeriesContainer,
+        ExplicitCategoriesProvider& rCatProvider)
 {
     // Each series of data flows from left to right, and multiple series are
     // stacked vertically along y axis.
@@ -68,8 +66,8 @@ void GL3DBarChart::create3DShapes()
     maShapes.clear();
     maShapes.push_back(new opengl3D::Camera(mpRenderer.get()));
     sal_Int32 nSeriesIndex = 0;
-    for (boost::ptr_vector<VDataSeries>::const_iterator itr = maDataSeries.begin(),
-            itrEnd = maDataSeries.end(); itr != itrEnd; ++itr)
+    for (boost::ptr_vector<VDataSeries>::const_iterator itr = rDataSeriesContainer.begin(),
+            itrEnd = rDataSeriesContainer.end(); itr != itrEnd; ++itr)
     {
         nYPos = nSeriesIndex * (nBarSizeY + nBarDistanceY) + nBarSizeY;
 
@@ -147,7 +145,7 @@ void GL3DBarChart::create3DShapes()
     pRect->setLineColor(COL_BLUE);
 
     // Create category texts along X-axis at the bottom.
-    uno::Sequence<OUString> aCats = mrCatProvider.getSimpleCategories();
+    uno::Sequence<OUString> aCats = rCatProvider.getSimpleCategories();
     for (sal_Int32 i = 0; i < aCats.getLength(); ++i)
     {
         float nXPos = i * (nBarSizeX + nBarDistanceX);
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 7c1fc51..1741b3d 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -34,12 +34,12 @@ class GL3DBarChart : public GL3DPlotterBase, public IRenderer
 public:
     GL3DBarChart(
         const css::uno::Reference<css::chart2::XChartType>& xChartType,
-        const boost::ptr_vector<VDataSeries>& rDataSeries, OpenGLWindow& rContext,
-        ExplicitCategoriesProvider& rCatProvider );
+        OpenGLWindow& rContext);
 
     virtual ~GL3DBarChart();
 
-    virtual void create3DShapes() SAL_OVERRIDE;
+    virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
+        ExplicitCategoriesProvider& rCatProvider) SAL_OVERRIDE;
 
     virtual void render() SAL_OVERRIDE;
 
@@ -49,12 +49,10 @@ public:
 
 private:
     css::uno::Reference<css::chart2::XChartType> mxChartType;
-    const boost::ptr_vector<VDataSeries>& maDataSeries;
     boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
 
     boost::scoped_ptr<opengl3D::OpenGL3DRenderer> mpRenderer;
     OpenGLWindow& mrWindow;
-    ExplicitCategoriesProvider& mrCatProvider;
 };
 
 }
diff --git a/chart2/source/view/inc/GL3DPlotterBase.hxx b/chart2/source/view/inc/GL3DPlotterBase.hxx
index 9c89008..cd69bf2 100644
--- a/chart2/source/view/inc/GL3DPlotterBase.hxx
+++ b/chart2/source/view/inc/GL3DPlotterBase.hxx
@@ -10,14 +10,20 @@
 #ifndef CHART2_GL3DPLOTTERBASE_HXX
 #define CHART2_GL3DPLOTTERBASE_HXX
 
+#include <boost/ptr_container/ptr_vector.hpp>
+#include "VDataSeries.hxx"
+
 namespace chart {
 
+class ExplicitCategoriesProvider;
+
 class GL3DPlotterBase
 {
 public:
     virtual ~GL3DPlotterBase();
 
-    virtual void create3DShapes() = 0;
+    virtual void create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSeries,
+        ExplicitCategoriesProvider& rCatProvider) = 0;
     virtual void render() = 0;
 };
 
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 49c3202..6c5d725 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -3115,65 +3115,67 @@ IMPL_LINK_NOARG(ChartView, UpdateTimeBased)
 
 void ChartView::createShapes3D()
 {
-    if (!m_pGL3DPlotter)
-    {
-        uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
-        uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
-        if( !xCooSysContainer.is())
-            return;
-
-        uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
-        boost::ptr_vector<VDataSeries> aDataSeries;
+    OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
+    if(!pWindow)
+        return;
 
-        if (aCooSysList.getLength() != 1)
-            // Supporting multiple coordinates in a truly 3D chart (which implies
-            // it's a Cartesian coordinate system) is a bit of a challenge, if not
-            // impossible.
-            return;
+    uno::Reference< XDiagram > xDiagram( mrChartModel.getFirstDiagram() );
+    uno::Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+    if( !xCooSysContainer.is())
+        return;
 
-        uno::Reference<XCoordinateSystem> xCooSys( aCooSysList[0] );
+    uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
 
-        //iterate through all chart types in the current coordinate system
-        uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
-        OSL_ASSERT( xChartTypeContainer.is());
-        if( !xChartTypeContainer.is() )
-            return;
+    if (aCooSysList.getLength() != 1)
+        // Supporting multiple coordinates in a truly 3D chart (which implies
+        // it's a Cartesian coordinate system) is a bit of a challenge, if not
+        // impossible.
+        return;
 
-        uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
-        if (aChartTypeList.getLength() != 1)
-            // Likewise, we can't really support multiple chart types here.
-            return;
+    uno::Reference<XCoordinateSystem> xCooSys( aCooSysList[0] );
 
-        uno::Reference< XChartType > xChartType( aChartTypeList[0] );
+    //iterate through all chart types in the current coordinate system
+    uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
+    OSL_ASSERT( xChartTypeContainer.is());
+    if( !xChartTypeContainer.is() )
+        return;
 
-        uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
-        OSL_ASSERT( xDataSeriesContainer.is());
-        if( !xDataSeriesContainer.is() )
-            return;
+    uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
+    if (aChartTypeList.getLength() != 1)
+        // Likewise, we can't really support multiple chart types here.
+        return;
 
-        uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
-        for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
-        {
-            uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
-            if(!xDataSeries.is())
-                continue;
+    uno::Reference< XChartType > xChartType( aChartTypeList[0] );
 
-            aDataSeries.push_back(new VDataSeries(xDataSeries));
-        }
+    if (!m_pGL3DPlotter)
+    {
+        m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, *pWindow));
+    }
 
-        OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow();
-        if(!pWindow)
-            return;
 
-        boost::scoped_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));
+    uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xChartType, uno::UNO_QUERY );
+    OSL_ASSERT( xDataSeriesContainer.is());
+    if( !xDataSeriesContainer.is() )
+        return;
 
-        pWindow->Show();
+    boost::ptr_vector<VDataSeries> aDataSeries;
+    uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() );
+    for( sal_Int32 nS = 0; nS < aSeriesList.getLength(); ++nS )
+    {
+        uno::Reference< XDataSeries > xDataSeries( aSeriesList[nS], uno::UNO_QUERY );
+        if(!xDataSeries.is())
+            continue;
 
-        m_pGL3DPlotter.reset(new GL3DBarChart(xChartType, aDataSeries, *pWindow, *pCatProvider));
-        m_pGL3DPlotter->create3DShapes();
+        aDataSeries.push_back(new VDataSeries(xDataSeries));
     }
 
+    boost::scoped_ptr<ExplicitCategoriesProvider> pCatProvider(new ExplicitCategoriesProvider(xCooSys, mrChartModel));
+
+
+    m_pGL3DPlotter->create3DShapes(aDataSeries, *pCatProvider);
+
     m_pGL3DPlotter->render();
+    pWindow->Show();
 }
 
 } //namespace chart
commit 9fbafe9fe867fa727ce38612bd24431afd0100c1
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue May 13 05:12:55 2014 +0200

    rerender after redrawing of the window
    
    Change-Id: Ia967ba08a9bd0499ae5fb0865492783834204963

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index a5d4a36..c164bd2 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -33,10 +33,13 @@ GL3DBarChart::GL3DBarChart(
     mrWindow(rWindow),
     mrCatProvider(rCatProvider)
 {
+    mrWindow.setRenderer(this);
+    mpRenderer->init();
 }
 
 GL3DBarChart::~GL3DBarChart()
 {
+    mrWindow.setRenderer(NULL);
 }
 
 void GL3DBarChart::create3DShapes()
@@ -166,7 +169,6 @@ void GL3DBarChart::render()
 {
     mrWindow.getContext()->makeCurrent();
     Size aSize = mrWindow.GetSizePixel();
-    mpRenderer->init();
     mpRenderer->SetSize(aSize);
     mrWindow.getContext()->setWinSize(aSize);
     for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
@@ -178,6 +180,16 @@ void GL3DBarChart::render()
     mrWindow.getContext()->swapBuffers();
 }
 
+void GL3DBarChart::update()
+{
+    render();
+}
+
+void GL3DBarChart::clickedAt(const Point& )
+{
+
+}
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/GL3DBarChart.hxx b/chart2/source/view/inc/GL3DBarChart.hxx
index 7a1733e..7c1fc51 100644
--- a/chart2/source/view/inc/GL3DBarChart.hxx
+++ b/chart2/source/view/inc/GL3DBarChart.hxx
@@ -29,7 +29,7 @@ class OpenGL3DRenderer;
 
 }
 
-class GL3DBarChart : public GL3DPlotterBase
+class GL3DBarChart : public GL3DPlotterBase, public IRenderer
 {
 public:
     GL3DBarChart(
@@ -43,6 +43,10 @@ public:
 
     virtual void render() SAL_OVERRIDE;
 
+    virtual void update() SAL_OVERRIDE;
+
+    virtual void clickedAt(const Point& rPos) SAL_OVERRIDE;
+
 private:
     css::uno::Reference<css::chart2::XChartType> mxChartType;
     const boost::ptr_vector<VDataSeries>& maDataSeries;
diff --git a/include/vcl/openglwin.hxx b/include/vcl/openglwin.hxx
index b766f05..e9b823e 100644
--- a/include/vcl/openglwin.hxx
+++ b/include/vcl/openglwin.hxx
@@ -18,6 +18,14 @@
 class OpenGLContext;
 class OpenGLWindowImpl;
 
+class VCLOPENGL_DLLPUBLIC IRenderer
+{
+public:
+    virtual ~IRenderer() {}
+    virtual void update() = 0;
+    virtual void clickedAt(const Point& rPos) = 0;
+};
+
 // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
 class VCLOPENGL_DLLPUBLIC OpenGLWindow : public SystemChildWindow
 {
@@ -26,11 +34,14 @@ public:
     virtual ~OpenGLWindow();
     OpenGLContext* getContext();
 
-    virtual void Paint(const Rectangle&) SAL_OVERRIDE {}
+    void setRenderer(IRenderer* pRenderer);
+
+    virtual void Paint(const Rectangle&) SAL_OVERRIDE;
     virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
 
 private:
     boost::scoped_ptr<OpenGLWindowImpl> mpImpl;
+    IRenderer* mpRenderer;
 };
 
 #endif
diff --git a/vcl/source/window/openglwin.cxx b/vcl/source/window/openglwin.cxx
index 77ab2d9..c1716b7 100644
--- a/vcl/source/window/openglwin.cxx
+++ b/vcl/source/window/openglwin.cxx
@@ -32,7 +32,8 @@ OpenGLContext* OpenGLWindowImpl::getContext()
 
 OpenGLWindow::OpenGLWindow(Window* pParent):
     SystemChildWindow(pParent, 0),
-    mpImpl(new OpenGLWindowImpl(this))
+    mpImpl(new OpenGLWindowImpl(this)),
+    mpRenderer(NULL)
 {
 }
 
@@ -45,6 +46,12 @@ OpenGLContext* OpenGLWindow::getContext()
     return mpImpl->getContext();
 }
 
+void OpenGLWindow::Paint(const Rectangle&)
+{
+    if(mpRenderer)
+        mpRenderer->update();
+}
+
 void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt )
 {
     Point aPoint = rMEvt.GetPosPixel();
@@ -53,4 +60,9 @@ void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt )
     SAL_WARN("vcl.opengl", aColor.GetColor());
 }
 
+void OpenGLWindow::setRenderer(IRenderer* pRenderer)
+{
+    mpRenderer = pRenderer;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit f02999aa267c40876f29edf37d39694b619e69ba
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Tue May 13 03:31:19 2014 +0200

    move the test to slowcheck
    
    Change-Id: I628ff6af8fb28b86fbf74b547504721718e48606

diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 41804b2..2b82efa 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -54,12 +54,12 @@ $(eval $(call gb_Module_add_check_targets,sc,\
     CppunitTest_sc_ucalc \
     CppunitTest_sc_filters_test \
     CppunitTest_sc_rangelst_test \
-    CppunitTest_sc_html_export_test \
 ))
 
 $(eval $(call gb_Module_add_slowcheck_targets,sc, \
     CppunitTest_sc_subsequent_filters_test \
     CppunitTest_sc_subsequent_export_test \
+    CppunitTest_sc_html_export_test \
     CppunitTest_sc_opencl_test \
 ))
 


More information about the Libreoffice-commits mailing list