From 389d8e9f5232501ac782562ba7c07c052f19766d Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 1 Jun 2014 19:36:39 +0200 Subject: [PATCH] fix refresh problem with 2D OpenGL chart and OpenGLWindow Change-Id: I32f23967a826262051495d57a4dd529ca3694548 --- chart2/inc/ChartView.hxx | 3 ++ chart2/source/view/main/ChartView.cxx | 43 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/chart2/inc/ChartView.hxx b/chart2/inc/ChartView.hxx index ab552f9fa250..d69aa9f86225 100644 --- a/chart2/inc/ChartView.hxx +++ b/chart2/inc/ChartView.hxx @@ -55,6 +55,7 @@ class DrawModelWrapper; class SeriesPlotterContainer; class VDataSeries; class GL3DPlotterBase; +class GL2DRenderer; enum TimeBasedMode { @@ -103,6 +104,7 @@ class ChartView : public ::cppu::WeakImplHelper10< , public ExplicitValueProvider , private SfxListener { + friend class GL2DRenderer; private: void init(); @@ -277,6 +279,7 @@ private: //member boost::shared_ptr m_pGL3DPlotter; TimeBasedInfo maTimeBased; osl::Mutex maTimeMutex; + boost::scoped_ptr mp2DRenderer; }; } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index f9b7d70401a7..5a2b3e424cdb 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -154,6 +154,46 @@ void debugGL3DOutput( ChartModel& rModel ) } +class GL2DRenderer : public IRenderer +{ +public: + GL2DRenderer(ChartView* pView); + + virtual void update() SAL_OVERRIDE; + virtual void clickedAt(const Point& rPos, sal_uInt16 nButton) SAL_OVERRIDE; + virtual void mouseDragMove(const Point& rBegin, const Point& rEnd, sal_uInt16 nButton) SAL_OVERRIDE; + virtual void scroll(long nDelta) SAL_OVERRIDE; + virtual void contextDestroyed() SAL_OVERRIDE; +private: + ChartView* mpView; +}; + +GL2DRenderer::GL2DRenderer(ChartView* pView): + mpView(pView) +{ +} + +void GL2DRenderer::update() +{ + mpView->render(); +} + +void GL2DRenderer::clickedAt(const Point&, sal_uInt16 ) +{ +} + +void GL2DRenderer::mouseDragMove(const Point& , const Point& , sal_uInt16 ) +{ +} + +void GL2DRenderer::scroll(long ) +{ +} + +void GL2DRenderer::contextDestroyed() +{ +} + const uno::Sequence& ExplicitValueProvider::getUnoTunnelId() { return theExplicitValueProviderUnoTunnelId::get().getSeq(); @@ -195,6 +235,7 @@ ChartView::ChartView( , m_nScaleYDenominator(1) , m_bSdrViewIsInEditMode(false) , m_aResultingDiagramRectangleExcludingAxes(0,0,0,0) + , mp2DRenderer(new GL2DRenderer(this)) { init(); } @@ -2674,6 +2715,8 @@ void ChartView::render() { AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(m_xShapeFactory); OpenGLWindow* pWindow = mrChartModel.getOpenGLWindow(); + if(pWindow) + pWindow->setRenderer(mp2DRenderer.get()); bool bRender = pShapeFactory->preRender(pWindow); if(bRender) {