[Libreoffice-commits] core.git: Branch 'feature/chart_opengl_window' - 2 commits - chart2/source

Zolnai Tamás tamas.zolnai at collabora.com
Thu Aug 21 08:05:14 PDT 2014


 chart2/source/controller/main/ChartWindow.cxx  |   18 +++++++++++-------
 chart2/source/view/charttypes/GL3DBarChart.cxx |    7 +++++++
 2 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit a17fc5252bedac1eadbad8f68adea043a27c84ac
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Aug 21 17:02:32 2014 +0200

    Reinitialize GL3D renderer when OpenGL window is changed
    
    Without it when we switch sheets in Calc or slides in Impress
    and go back to that page where the GL3DBar chart is then the
    renderer does not work.
    
    Change-Id: I9aa6203ed5aa7f94627d886b2f2e5ad34d493843

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 75449b4..af6f20c 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -939,7 +939,14 @@ void GL3DBarChart::contextDestroyed()
 void GL3DBarChart::setOpenGLWindow(OpenGLWindow* pWindow)
 {
     if (mpWindow != pWindow)
+    {
         mpWindow = pWindow;
+        Size aSize = mpWindow->GetSizePixel();
+        mpRenderer->SetSize(aSize);
+        mpWindow->setRenderer(this);
+        mpRenderer->init();
+        mbValidContext = true;
+    }
 }
 
 }
commit 1c42b785884eb97daeb861f958a4d84457a44e71
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Aug 21 16:00:14 2014 +0200

    Don't create an OpenGL window in case of normal charts.
    
    Change-Id: Idb4506712d3902c12aa881a85ddf69a281edff82

diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 40e6933..dde5006 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -49,7 +49,7 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
         : Window(pParent, nStyle)
         , m_pWindowController( pController )
         , m_bInPaint(false)
-        , m_pOpenGLWindow(new OpenGLWindow(this))
+        , m_pOpenGLWindow(getenv("CHART_DUMMY_FACTORY") ? new OpenGLWindow(this) : 0)
 {
     this->SetHelpId( HID_SCH_WIN_DOCUMENT );
     this->SetMapMode( MapMode(MAP_100TH_MM) );
@@ -60,11 +60,14 @@ ChartWindow::ChartWindow( ChartController* pController, Window* pParent, WinBits
     if( pParent )
         pParent->EnableRTL( false );// #i96215# necessary for a correct position of the context menu in rtl mode
 
-    m_pOpenGLWindow->Show();
-    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();
+    if( m_pOpenGLWindow )
+    {
+        m_pOpenGLWindow->Show();
+        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()
@@ -150,7 +153,8 @@ void ChartWindow::Resize()
     else
         Window::Resize();
 
-    m_pOpenGLWindow->SetSizePixel(GetSizePixel());
+    if( m_pOpenGLWindow )
+        m_pOpenGLWindow->SetSizePixel(GetSizePixel());
 }
 
 void ChartWindow::Activate()


More information about the Libreoffice-commits mailing list