diff options
-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 | ||||
-rw-r--r-- | include/svx/svdoopengl.hxx | 4 | ||||
-rw-r--r-- | include/vcl/IOpenGLRenderer.hxx | 28 | ||||
-rw-r--r-- | include/vcl/OpenGLContext.hxx | 5 | ||||
-rw-r--r-- | svx/source/svdraw/svdoopengl.cxx | 6 |
9 files changed, 69 insertions, 14 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(); diff --git a/include/svx/svdoopengl.hxx b/include/svx/svdoopengl.hxx index 7760b823717d..a8e7a422d4c9 100644 --- a/include/svx/svdoopengl.hxx +++ b/include/svx/svdoopengl.hxx @@ -23,7 +23,7 @@ namespace sdr { namespace contact { class IOpenGLRenderer; -class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject +class SVX_DLLPUBLIC SdrOpenGLObj : public SdrObject, public IOpenGLInfoProvider { public: virtual ~SdrOpenGLObj(); @@ -36,6 +36,8 @@ public: void setRenderer(IOpenGLRenderer* pRenderer); IOpenGLRenderer* getRenderer(); + virtual bool isOpenGLInitialized(); + private: OpenGLContext maContext; diff --git a/include/vcl/IOpenGLRenderer.hxx b/include/vcl/IOpenGLRenderer.hxx index 3efb2c5f3b38..b5b723bbe6e8 100644 --- a/include/vcl/IOpenGLRenderer.hxx +++ b/include/vcl/IOpenGLRenderer.hxx @@ -10,12 +10,36 @@ #ifndef VCL_IOPENGLRENDER_HXX #define VCL_IOPENGLRENDER_HXX +class IOpenGLInfoProvider +{ +public: + virtual ~IOpenGLInfoProvider() {} + + virtual bool isOpenGLInitialized() = 0; +}; + class IOpenGLRenderer { public: - virtual ~IOpenGLRenderer() {}; - virtual void operator()() = 0; + IOpenGLRenderer(): + mpInfoProvider(NULL) {} + virtual ~IOpenGLRenderer() {} + + bool isOpenGLInitialized() + { + if(mpInfoProvider) + return mpInfoProvider->isOpenGLInitialized(); + + return false; + } + + void setInfoProvider(IOpenGLInfoProvider* pInfo) + { + mpInfoProvider = pInfo; + } +private: + IOpenGLInfoProvider* mpInfoProvider; }; #endif diff --git a/include/vcl/OpenGLContext.hxx b/include/vcl/OpenGLContext.hxx index 220efb5b75e4..56d6a56890c3 100644 --- a/include/vcl/OpenGLContext.hxx +++ b/include/vcl/OpenGLContext.hxx @@ -152,6 +152,11 @@ public: void renderToFile(); + bool isInitialized() + { + return mbInitialized; + } + private: SAL_DLLPRIVATE bool initWindow(); diff --git a/svx/source/svdraw/svdoopengl.cxx b/svx/source/svdraw/svdoopengl.cxx index df2f07b7d04b..ce11c0d71009 100644 --- a/svx/source/svdraw/svdoopengl.cxx +++ b/svx/source/svdraw/svdoopengl.cxx @@ -38,6 +38,7 @@ void SdrOpenGLObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fra void SdrOpenGLObj::setRenderer(IOpenGLRenderer* pRenderer) { mpRenderer.reset(pRenderer); + mpRenderer->setInfoProvider(this); } IOpenGLRenderer* SdrOpenGLObj::getRenderer() @@ -45,4 +46,9 @@ IOpenGLRenderer* SdrOpenGLObj::getRenderer() return mpRenderer.get(); } +bool SdrOpenGLObj::isOpenGLInitialized() +{ + return maContext.isInitialized(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |