Kaydet (Commit) 9fbafe9f authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

rerender after redrawing of the window

Change-Id: Ia967ba08a9bd0499ae5fb0865492783834204963
üst f02999aa
...@@ -33,10 +33,13 @@ GL3DBarChart::GL3DBarChart( ...@@ -33,10 +33,13 @@ GL3DBarChart::GL3DBarChart(
mrWindow(rWindow), mrWindow(rWindow),
mrCatProvider(rCatProvider) mrCatProvider(rCatProvider)
{ {
mrWindow.setRenderer(this);
mpRenderer->init();
} }
GL3DBarChart::~GL3DBarChart() GL3DBarChart::~GL3DBarChart()
{ {
mrWindow.setRenderer(NULL);
} }
void GL3DBarChart::create3DShapes() void GL3DBarChart::create3DShapes()
...@@ -166,7 +169,6 @@ void GL3DBarChart::render() ...@@ -166,7 +169,6 @@ void GL3DBarChart::render()
{ {
mrWindow.getContext()->makeCurrent(); mrWindow.getContext()->makeCurrent();
Size aSize = mrWindow.GetSizePixel(); Size aSize = mrWindow.GetSizePixel();
mpRenderer->init();
mpRenderer->SetSize(aSize); mpRenderer->SetSize(aSize);
mrWindow.getContext()->setWinSize(aSize); mrWindow.getContext()->setWinSize(aSize);
for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(), for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
...@@ -178,6 +180,16 @@ void GL3DBarChart::render() ...@@ -178,6 +180,16 @@ void GL3DBarChart::render()
mrWindow.getContext()->swapBuffers(); mrWindow.getContext()->swapBuffers();
} }
void GL3DBarChart::update()
{
render();
}
void GL3DBarChart::clickedAt(const Point& )
{
}
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -29,7 +29,7 @@ class OpenGL3DRenderer; ...@@ -29,7 +29,7 @@ class OpenGL3DRenderer;
} }
class GL3DBarChart : public GL3DPlotterBase class GL3DBarChart : public GL3DPlotterBase, public IRenderer
{ {
public: public:
GL3DBarChart( GL3DBarChart(
...@@ -43,6 +43,10 @@ public: ...@@ -43,6 +43,10 @@ public:
virtual void render() SAL_OVERRIDE; virtual void render() SAL_OVERRIDE;
virtual void update() SAL_OVERRIDE;
virtual void clickedAt(const Point& rPos) SAL_OVERRIDE;
private: private:
css::uno::Reference<css::chart2::XChartType> mxChartType; css::uno::Reference<css::chart2::XChartType> mxChartType;
const boost::ptr_vector<VDataSeries>& maDataSeries; const boost::ptr_vector<VDataSeries>& maDataSeries;
......
...@@ -18,6 +18,14 @@ ...@@ -18,6 +18,14 @@
class OpenGLContext; class OpenGLContext;
class OpenGLWindowImpl; 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 // pImpl Pattern to avoid linking against OpenGL libs when using the class without the context
class VCLOPENGL_DLLPUBLIC OpenGLWindow : public SystemChildWindow class VCLOPENGL_DLLPUBLIC OpenGLWindow : public SystemChildWindow
{ {
...@@ -26,11 +34,14 @@ public: ...@@ -26,11 +34,14 @@ public:
virtual ~OpenGLWindow(); virtual ~OpenGLWindow();
OpenGLContext* getContext(); 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; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
private: private:
boost::scoped_ptr<OpenGLWindowImpl> mpImpl; boost::scoped_ptr<OpenGLWindowImpl> mpImpl;
IRenderer* mpRenderer;
}; };
#endif #endif
......
...@@ -32,7 +32,8 @@ OpenGLContext* OpenGLWindowImpl::getContext() ...@@ -32,7 +32,8 @@ OpenGLContext* OpenGLWindowImpl::getContext()
OpenGLWindow::OpenGLWindow(Window* pParent): OpenGLWindow::OpenGLWindow(Window* pParent):
SystemChildWindow(pParent, 0), SystemChildWindow(pParent, 0),
mpImpl(new OpenGLWindowImpl(this)) mpImpl(new OpenGLWindowImpl(this)),
mpRenderer(NULL)
{ {
} }
...@@ -45,6 +46,12 @@ OpenGLContext* OpenGLWindow::getContext() ...@@ -45,6 +46,12 @@ OpenGLContext* OpenGLWindow::getContext()
return mpImpl->getContext(); return mpImpl->getContext();
} }
void OpenGLWindow::Paint(const Rectangle&)
{
if(mpRenderer)
mpRenderer->update();
}
void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt ) void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt )
{ {
Point aPoint = rMEvt.GetPosPixel(); Point aPoint = rMEvt.GetPosPixel();
...@@ -53,4 +60,9 @@ void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt ) ...@@ -53,4 +60,9 @@ void OpenGLWindow::MouseButtonDown( const MouseEvent& rMEvt )
SAL_WARN("vcl.opengl", aColor.GetColor()); SAL_WARN("vcl.opengl", aColor.GetColor());
} }
void OpenGLWindow::setRenderer(IRenderer* pRenderer)
{
mpRenderer = pRenderer;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment