[Libreoffice-commits] core.git: 2 commits - chart2/source sc/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Fri May 30 13:51:20 PDT 2014


 chart2/source/view/inc/GL3DRenderer.hxx  |   22 ++++++++++------------
 chart2/source/view/main/GL3DRenderer.cxx |   20 ++++++++++----------
 sc/source/core/data/documen5.cxx         |    3 +++
 sc/source/ui/view/tabvwsh4.cxx           |    3 +++
 4 files changed, 26 insertions(+), 22 deletions(-)

New commits:
commit 561b6824e6cbb8762f667e3bcc087a6105ee78b7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri May 30 22:44:21 2014 +0200

    avoid crash when finding a non chart OLE2 shape
    
    Change-Id: I5f69e3dabe67aa09f6a77c65e196401622f4b951

diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index 4076b43..d89be23 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -688,6 +688,9 @@ std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> > ScDoc
                 continue;
 
             uno::Reference< chart2::XChartDocument > xChartDoc( ScChartHelper::GetChartFromSdrObject( pObject ) );
+            if(!xChartDoc.is())
+                continue;
+
             Rectangle aRect = pObject->GetLastBoundRect();
             aRet.push_back(std::pair<uno::Reference<chart2::XChartDocument>, Rectangle>(xChartDoc, aRect));
         }
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 338405a..80b7e77 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -581,7 +581,10 @@ void ScTabViewShell::AddOpenGLChartWindows()
     for(std::vector<std::pair<uno::Reference<chart2::XChartDocument>, Rectangle> >::iterator itr = aCharts.begin(),
             itrEnd = aCharts.end(); itr != itrEnd; ++itr)
     {
+        if(!itr->first.is())
+            return;
         OpenGLWindow* pOpenGLWindow = new OpenGLWindow(pParentWindow);
+
         pOpenGLWindow->Show(false);
         Size aSize = itr->second.GetSize();
         Size aWindowSize = pOpenGLWindow->LogicToPixel( aSize, MapMode( MAP_100TH_MM ) );
commit e7aa4170212612f8b6bead91ceb6b4e86cf008d4
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu May 29 02:00:24 2014 +0200

    pass more parameters by const reference
    
    Change-Id: I46be96d6ba9f3fecb590c4be62775824194c380a

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index a0036ed..61d297b 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -168,17 +168,15 @@ public:
     void AddShape3DExtrudeObject(bool roundedCorner, sal_uInt32 color, sal_uInt32 specular, const glm::mat4& modelMatrix, sal_uInt32 nUniqueId);
     void EndAddShape3DExtrudeObject();
     void SetSize(const Size& rSize);
-    void SetCameraInfo(glm::vec3 pos, glm::vec3 direction, glm::vec3 up);
+    void SetCameraInfo(const glm::vec3& pos, const glm::vec3& direction, const glm::vec3& up);
     void CreateTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
                            ::Size maSizePixels,
-                           glm::vec3 vTopLeft,glm::vec3 vTopRight,
-                           glm::vec3 vBottomRight, glm::vec3 vBottomLeft,
+                           const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
+                           const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
                            sal_uInt32 nUniqueId);
     void CreateScreenTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
-                                 ::Size maSizePixels,
-
-                                 glm::vec2 vTopLeft, glm::vec2 vBottomRight,
-                                 sal_uInt32 nUniqueId);
+                                 ::Size maSizePixels, const glm::vec2& vTopLeft,
+                                 const glm::vec2& vBottomRight, sal_uInt32 nUniqueId);
     void ProcessUnrenderedShape(bool bNewScene);
 
     void SetPickingMode(bool bPickingMode);
@@ -188,12 +186,12 @@ public:
     void ReleaseShapes();
     void ReleaseScreenTextShapes();
 private:
-    void MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale);
+    void MoveModelf( const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale);
 
     void ClearBuffer();
     void RenderPolygon3DObject();
-    void RenderLine3D(Polygon3DInfo &polygon);
-    void RenderPolygon3D(Polygon3DInfo &polygon);
+    void RenderLine3D(const Polygon3DInfo &polygon);
+    void RenderPolygon3D(const Polygon3DInfo &polygon);
     void Init3DUniformBlock();
     void Update3DUniformBlock();
     void RenderExtrude3DObject();
@@ -228,8 +226,8 @@ private:
     void ReleaseTextShapes();
     void ReleaseBatchBarInfo();
     void GetBatchBarsInfo();
-    void GetBatchTopAndFlatInfo(Extrude3DInfo &extrude3D);
-    void GetBatchMiddleInfo(Extrude3DInfo &extrude3D);
+    void GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D);
+    void GetBatchMiddleInfo(const Extrude3DInfo &extrude3D);
     void InitBatch3DUniformBlock();
     void UpdateBatch3DUniformBlock();
     void RenderBatchBars(bool bNewScene);
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 8ee66c2..5281387 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -227,7 +227,7 @@ void OpenGL3DRenderer::PickingShaderResources::LoadShaders()
     m_2DColorID = glGetUniformLocation(m_CommonProID, "vColor");
 }
 
-void OpenGL3DRenderer::SetCameraInfo(glm::vec3 pos, glm::vec3 direction, glm::vec3 up)
+void OpenGL3DRenderer::SetCameraInfo(const glm::vec3& pos, const glm::vec3& direction, const glm::vec3& up)
 {
     m_CameraInfo.cameraPos = pos;
     m_CameraInfo.cameraOrg = direction;
@@ -712,7 +712,7 @@ int OpenGL3DRenderer::GenerateRoundCornerBar(std::vector<glm::vec3> &vertices, s
     return iFacesAdded;
 }
 
-void OpenGL3DRenderer::RenderLine3D(Polygon3DInfo &polygon)
+void OpenGL3DRenderer::RenderLine3D(const Polygon3DInfo& polygon)
 {
     glUseProgram(maResources.m_CommonProID);
     PosVecf3 trans = {0.0f, 0, 0.0};
@@ -756,7 +756,7 @@ void OpenGL3DRenderer::RenderLine3D(Polygon3DInfo &polygon)
     glUseProgram(0);
 }
 
-void OpenGL3DRenderer::RenderPolygon3D(Polygon3DInfo &polygon)
+void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
 {
     size_t verticesNum = polygon.verticesList.size();
     size_t normalsNum = polygon.normalsList.size();
@@ -1455,8 +1455,8 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
 
 void OpenGL3DRenderer::CreateScreenTextTexture(
         const boost::shared_array<sal_uInt8> &bitmapBuf,
-        ::Size maSizePixels,
-        glm::vec2 vTopLeft, glm::vec2 vBottomRight, sal_uInt32 nUniqueId)
+        ::Size maSizePixels, const glm::vec2& vTopLeft,
+        const glm::vec2& vBottomRight, sal_uInt32 nUniqueId)
 {
     long bmpWidth = maSizePixels.Width();
     long bmpHeight = maSizePixels.Height();
@@ -1501,8 +1501,8 @@ void OpenGL3DRenderer::CreateScreenTextTexture(
 
 void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
                                          ::Size maSizePixels,
-                                         glm::vec3 vTopLeft,glm::vec3 vTopRight,
-                                         glm::vec3 vBottomRight, glm::vec3 vBottomLeft,
+                                         const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
+                                         const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
                                          sal_uInt32 nUniqueId)
 {
     long bmpWidth = maSizePixels.Width();
@@ -1744,7 +1744,7 @@ void OpenGL3DRenderer::ProcessUnrenderedShape(bool bNewScene)
 #endif
 }
 
-void OpenGL3DRenderer::MoveModelf(PosVecf3& trans,PosVecf3& angle,PosVecf3& scale)
+void OpenGL3DRenderer::MoveModelf(const PosVecf3& trans, const PosVecf3& angle, const PosVecf3& scale)
 {
     glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
     glm::mat4 aScaleMatrix = glm::scale(glm::vec3(scale.x, scale.y, scale.z));
@@ -1797,7 +1797,7 @@ void OpenGL3DRenderer::ReleaseShapes()
     ReleaseBatchBarInfo();
 }
 
-void OpenGL3DRenderer::GetBatchMiddleInfo(Extrude3DInfo &extrude3D)
+void OpenGL3DRenderer::GetBatchMiddleInfo(const Extrude3DInfo &extrude3D)
 {
     float xyScale = extrude3D.xScale;
     float zScale = extrude3D.zScale;
@@ -1822,7 +1822,7 @@ void OpenGL3DRenderer::GetBatchMiddleInfo(Extrude3DInfo &extrude3D)
     m_BarSurface[MIDDLE_SURFACE].colorList.push_back(extrude3D.material.materialColor);
 }
 
-void OpenGL3DRenderer::GetBatchTopAndFlatInfo(Extrude3DInfo &extrude3D)
+void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
 {
     float xyScale = extrude3D.xScale;
     float zScale = extrude3D.zScale;


More information about the Libreoffice-commits mailing list