diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-15 00:27:25 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-04-15 01:51:27 +0200 |
commit | 3bd173af500d2e30f004cac4ca5a9309c5a49741 (patch) | |
tree | b583ea83a29c803844645b1614b0edf400db0d7f /chart2 | |
parent | d321709febe1222e582614b200e7c155b2f0ee7b (diff) |
only render through OpenGL after successful context creation
Change-Id: I60ebceee2bf0eca1c7022e14fc43128347d682b5
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/inc/AbstractShapeFactory.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/inc/OpenglShapeFactory.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/inc/ShapeFactory.hxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/OpenglShapeFactory.cxx | 24 |
5 files changed, 29 insertions, 11 deletions
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx index 525220aa3207..833380ceff3a 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 e9b2614131fa..c93199f9b802 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 74a4d3825d0e..87a4387a3a47 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 c2056520aa40..a94b53c956be 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 75992c0f3c49..34c2ea682f99 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(); |