summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-07-20 09:52:04 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-07-20 09:54:06 +0200
commitcbc50c90ad63f0e59b8cf3bbfb6b5b1f61db09b9 (patch)
treef7f16f697db2350632e1fc45d0dfded9ac0752a6
parent46cea34638b371570073c0e86f79969753c543ed (diff)
Fix OpenGL chart reinitializing
Problem after ChartWindow was disabled and enabled again, OpenGL content was lost. Two things: -After setting a new OpenGLWindow the corresponding IRenderer must be set (x3DWindowProvider->update) -InitOpenGL() call should not depend on DummyChart, but on OpenGLWindow (OpenGLContext). Change-Id: If74e1945de9973d3921ceea1ca6fef39311add7a
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx2
-rw-r--r--chart2/source/view/inc/AbstractShapeFactory.hxx2
-rw-r--r--chart2/source/view/inc/OpenglShapeFactory.hxx2
-rw-r--r--chart2/source/view/inc/ShapeFactory.hxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx8
-rw-r--r--chart2/source/view/main/DummyXShape.hxx1
-rw-r--r--chart2/source/view/main/OpenglShapeFactory.cxx6
7 files changed, 18 insertions, 5 deletions
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 37335c4b87a2..40e69333c4f7 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -64,6 +64,7 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(pController->getModel(), uno::UNO_QUERY_THROW);
sal_uInt64 nWindowPtr = reinterpret_cast<sal_uInt64>(m_pOpenGLWindow);
x3DWindowProvider->setWindow(nWindowPtr);
+ x3DWindowProvider->update();
}
ChartWindow::~ChartWindow()
@@ -72,6 +73,7 @@ ChartWindow::~ChartWindow()
{
uno::Reference< chart2::X3DChartWindowProvider > x3DWindowProvider(m_pWindowController->getModel(), uno::UNO_QUERY_THROW);
x3DWindowProvider->setWindow(0);
+ x3DWindowProvider->update();
}
delete m_pOpenGLWindow;
}
diff --git a/chart2/source/view/inc/AbstractShapeFactory.hxx b/chart2/source/view/inc/AbstractShapeFactory.hxx
index 9cb3e470ed90..3e55165e11a3 100644
--- a/chart2/source/view/inc/AbstractShapeFactory.hxx
+++ b/chart2/source/view/inc/AbstractShapeFactory.hxx
@@ -238,7 +238,7 @@ 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::XShapes > xRootShape, bool bInitOpenGL = true) = 0;
virtual bool preRender(OpenGLWindow* pWindow) = 0;
virtual void postRender(OpenGLWindow* pWindow) = 0;
diff --git a/chart2/source/view/inc/OpenglShapeFactory.hxx b/chart2/source/view/inc/OpenglShapeFactory.hxx
index 896249e90dab..7907d0d781b3 100644
--- a/chart2/source/view/inc/OpenglShapeFactory.hxx
+++ b/chart2/source/view/inc/OpenglShapeFactory.hxx
@@ -184,7 +184,7 @@ 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 > xDrawPage) SAL_OVERRIDE;
+ virtual void render(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xDrawPage, bool bInitOpenGL = true) SAL_OVERRIDE;
virtual bool preRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
virtual void postRender(OpenGLWindow* pWindow) SAL_OVERRIDE;
diff --git a/chart2/source/view/inc/ShapeFactory.hxx b/chart2/source/view/inc/ShapeFactory.hxx
index 171daad05779..480c1b14a244 100644
--- a/chart2/source/view/inc/ShapeFactory.hxx
+++ b/chart2/source/view/inc/ShapeFactory.hxx
@@ -197,7 +197,7 @@ 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::XShapes >, bool ) SAL_OVERRIDE {}
virtual bool preRender(OpenGLWindow*) SAL_OVERRIDE { return true; }
virtual void postRender(OpenGLWindow*) SAL_OVERRIDE {}
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 8dc8046c514b..d6f043015242 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -166,6 +166,7 @@ public:
virtual void scroll(long nDelta) SAL_OVERRIDE;
virtual void contextDestroyed() SAL_OVERRIDE;
+ const OpenGLWindow* getOpenGLWindow() const;
void updateOpenGLWindow();
private:
ChartView* mpView;
@@ -208,6 +209,11 @@ void GL2DRenderer::contextDestroyed()
mbContextDestroyed = true;
}
+const OpenGLWindow* GL2DRenderer::getOpenGLWindow() const
+{
+ return mpWindow;
+}
+
void GL2DRenderer::updateOpenGLWindow()
{
if(mbContextDestroyed)
@@ -2765,7 +2771,7 @@ void ChartView::render()
bool bRender = pShapeFactory->preRender(pWindow);
if(bRender)
{
- pShapeFactory->render(mxRootShape);
+ pShapeFactory->render(mxRootShape, pWindow != mp2DRenderer->getOpenGLWindow());
pShapeFactory->postRender(pWindow);
}
}
diff --git a/chart2/source/view/main/DummyXShape.hxx b/chart2/source/view/main/DummyXShape.hxx
index ee9e1afa93fd..54f5df42f343 100644
--- a/chart2/source/view/main/DummyXShape.hxx
+++ b/chart2/source/view/main/DummyXShape.hxx
@@ -395,6 +395,7 @@ public:
virtual void render() SAL_OVERRIDE;
void clear();
+ void invalidateInit() { mbNotInit = true; }
TextCache& getTextCache() { return maTextCache;}
private:
diff --git a/chart2/source/view/main/OpenglShapeFactory.cxx b/chart2/source/view/main/OpenglShapeFactory.cxx
index c486f01c08e1..a26024eb4a5a 100644
--- a/chart2/source/view/main/OpenglShapeFactory.cxx
+++ b/chart2/source/view/main/OpenglShapeFactory.cxx
@@ -446,9 +446,13 @@ uno::Reference< drawing::XShape >
return pText;
}
-void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape)
+void OpenglShapeFactory::render(uno::Reference< drawing::XShapes > xRootShape, bool bInitOpenGL)
{
dummy::DummyChart& rChart = dynamic_cast<dummy::DummyChart&>(*xRootShape.get());
+ if(bInitOpenGL)
+ {
+ rChart.invalidateInit();
+ }
rChart.render();
}