[Libreoffice-commits] core.git: 5 commits - chart2/opengl chart2/source oox/source

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Jan 31 09:49:50 PST 2014


 chart2/opengl/symbolFragmentShader.glsl  |    2 +-
 chart2/opengl/symbolVertexShader.glsl    |    2 +-
 chart2/source/view/main/DummyXShape.cxx  |    5 ++---
 chart2/source/view/main/OpenGLRender.cxx |   30 ++++++++++++++++++++----------
 oox/source/shape/ShapeContextHandler.cxx |    7 ++++---
 5 files changed, 28 insertions(+), 18 deletions(-)

New commits:
commit 9aa225f0cb980d81bf0fdcc91dede3c7a3bdf99f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 31 13:55:57 2014 +0100

    better OpenGL debug output
    
    Change-Id: I90a3883c0bbead0de02c8d4096eccecc59f1b0e3

diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 1e401dc..da99f81 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -364,11 +364,15 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
     glGenBuffers(1, &m_VertexBuffer);
     glGenBuffers(1, &m_ColorBuffer);
 
+    CHECK_GL_ERROR();
+
     m_RenderProID = LoadShaders("renderVertexShader", "renderFragmentShader");
     m_RenderVertexID = glGetAttribLocation(m_RenderProID, "vPosition");
     m_RenderTexCoordID = glGetAttribLocation(m_RenderProID, "texCoord");
     m_RenderTexID = glGetUniformLocation(m_RenderProID, "RenderTex");
 
+    CHECK_GL_ERROR();
+
     m_CommonProID = LoadShaders("commonVertexShader", "commonFragmentShader");
     m_MatrixID = glGetUniformLocation(m_CommonProID, "MVP");
     m_2DVertexID = glGetAttribLocation(m_CommonProID, "vPosition");
@@ -378,19 +382,23 @@ int OpenGLRender::InitOpenGL(GLWindow aWindow)
 #if DEBUG_POSITIONING
     m_DebugProID = LoadShaders("debugVertexShader", "debugFragmentShader");
     m_DebugVertexID = glGetAttribLocation(m_DebugProID, "vPosition");
-#endif
     CHECK_GL_ERROR();
+#endif
 
     m_BackgroundProID = LoadShaders("backgroundVertexShader", "backgroundFragmentShader");
     m_BackgroundMatrixID = glGetUniformLocation(m_BackgroundProID, "MVP");
     m_BackgroundVertexID = glGetAttribLocation(m_BackgroundProID, "vPosition");
     m_BackgroundColorID = glGetAttribLocation(m_BackgroundProID, "vColor");
 
+    CHECK_GL_ERROR();
+
     m_SymbolProID = LoadShaders("symbolVertexShader", "symbolFragmentShader");
     m_SymbolVertexID = glGetAttribLocation(m_SymbolProID, "vPosition");
     m_SymbolMatrixID = glGetAttribLocation(m_SymbolProID, "MVP");
     m_SymbolColorID = glGetAttribLocation(m_SymbolProID, "vColor");
 
+    CHECK_GL_ERROR();
+
     m_TextProID = LoadShaders("textVertexShader", "textFragmentShader");
     m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP");
     m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition");
@@ -1734,6 +1742,7 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float width, float heigh
     glDisable(GL_POINT_SMOOTH);
     glDisable(GL_MULTISAMPLE);
     glPointSize(10.f);
+    CHECK_GL_ERROR();
     PosVecf3 trans = {x/OPENGL_SCALE_VALUE, y/OPENGL_SCALE_VALUE, m_fZStep};
     PosVecf3 angle = {0.0f, 0.0f, 0.0f};
     PosVecf3 scale = {width/OPENGL_SCALE_VALUE, height/OPENGL_SCALE_VALUE, 1.0f};
@@ -1744,12 +1753,11 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float width, float heigh
     //fill vertex buffer
     glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
     glBufferData(GL_ARRAY_BUFFER, 3 * sizeof(float), aPos, GL_STATIC_DRAW);
+    CHECK_GL_ERROR();
 
     // Use our shader
     glUseProgram(m_SymbolProID);
-
     glUniform4fv(m_SymbolColorID, 1, &m_2DColor[0]);
-
     glUniformMatrix4fv(m_SymbolMatrixID, 1, GL_FALSE, &m_MVP[0][0]);
 
     // 1rst attribute buffer : vertices
@@ -1769,9 +1777,9 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float width, float heigh
     glUseProgram(0);
     glEnable(GL_MULTISAMPLE);
     glEnable(GL_POINT_SMOOTH);
-    CHECK_GL_ERROR();
     m_fZStep += Z_STEP;
 
+    CHECK_GL_ERROR();
     return 0;
 }
 
commit 9741870c3e149befcee34fe01d12e3e7ab6670f2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 31 13:54:59 2014 +0100

    extract the Z_STEP value into a define
    
    Change-Id: I38ccce4c35f6cdaa2df0dfc250fcea72a8b79049

diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx
index 474a125..1e401dc 100755
--- a/chart2/source/view/main/OpenGLRender.cxx
+++ b/chart2/source/view/main/OpenGLRender.cxx
@@ -62,6 +62,8 @@ using namespace std;
 #define WGL_SAMPLES_ARB          0x2042
 #endif
 
+#define Z_STEP 0.001;
+
 // end shaders
 
 static GLfloat squareVertices[] = {
@@ -497,7 +499,7 @@ int OpenGLRender::SetLine2DShapePoint(float x, float y, int listLength)
 
 int OpenGLRender::RenderLine2FBO(int)
 {
-    m_fZStep += 0.001f;
+    m_fZStep += Z_STEP;
     CHECK_GL_ERROR();
     glLineWidth(m_fLineWidth);
     size_t listNum = m_Line2DShapePointList.size();
@@ -1276,7 +1278,7 @@ int OpenGLRender::RectangleShapePoint(float x, float y, float directionX, float
 
 int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
 {
-    m_fZStep += 0.001f;
+    m_fZStep += Z_STEP;
     size_t listNum = m_RectangleShapePointList.size();
     for (size_t i = 0; i < listNum; i++)
     {
@@ -1477,7 +1479,7 @@ int OpenGLRender::CreateTextTexture(const BitmapEx& rBitmapEx, awt::Point aPos,
 int OpenGLRender::RenderTextShape()
 {
     CHECK_GL_ERROR();
-    m_fZStep += 0.01f;
+    m_fZStep += Z_STEP;
     size_t listNum = m_TextInfoList.size();
     for (size_t i = 0; i < listNum; i++)
     {
@@ -1591,7 +1593,7 @@ int OpenGLRender::RenderArea2DShape()
         m_Area2DShapePointList.pop_front();
     }
     glEnable(GL_MULTISAMPLE);
-    m_fZStep += 0.01f;
+    m_fZStep += Z_STEP;
 
     CHECK_GL_ERROR();
 
@@ -1719,11 +1721,12 @@ int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY)
         CHECK_GL_ERROR();
 
     }
-    m_fZStep += 0.01f;
+    m_fZStep += Z_STEP;
 
     CHECK_GL_ERROR();
     return 0;
 }
+
 int OpenGLRender::RenderSymbol2DShape(float x, float y, float width, float height, sal_Int32)
 {
     CHECK_GL_ERROR();
@@ -1766,9 +1769,8 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, float width, float heigh
     glUseProgram(0);
     glEnable(GL_MULTISAMPLE);
     glEnable(GL_POINT_SMOOTH);
-    m_fZStep += 0.01f;
-
     CHECK_GL_ERROR();
+    m_fZStep += Z_STEP;
 
     return 0;
 }
commit f3444316a722f74e25990cf31bb5caed80c0ceb2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 31 13:49:17 2014 +0100

    apparently the OpenGL doc is wrong, we need GLSL 1.20
    
    Change-Id: I00a98b8a564c7d36f30672ba91593096e460ef8c

diff --git a/chart2/opengl/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl
index 0567321..6d60436 100644
--- a/chart2/opengl/symbolFragmentShader.glsl
+++ b/chart2/opengl/symbolFragmentShader.glsl
@@ -1,4 +1,4 @@
-#version 110
+#version 120
 
 varying vec4 fragmentColor;
 
diff --git a/chart2/opengl/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl
index 0ab01d3..b7a9af2 100644
--- a/chart2/opengl/symbolVertexShader.glsl
+++ b/chart2/opengl/symbolVertexShader.glsl
@@ -1,4 +1,4 @@
-#version 110
+#version 120
 
 attribute vec3 vPosition;
 uniform mat4 MVP;
commit fbcb4011c261449ea35416fdba121dc9ec2fc585
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Jan 31 13:14:21 2014 +0100

    use fmod and make code simpler
    
    Change-Id: I09cc4fa8288fafa78083da5bdfb8ddc6fc273da9

diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 44da917..d7dcf1d 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -351,9 +351,8 @@ void DummyPieSegment2D::render()
 {
     DummyChart* pChart = getRootShape();
 
-    while(mfUnitCircleWidthAngleDegree>360)
-        mfUnitCircleWidthAngleDegree -= 360.0;
-    while(mfUnitCircleWidthAngleDegree<0)
+    mfUnitCircleWidthAngleDegree = std::fmod(mfUnitCircleWidthAngleDegree, 360.0);
+    if(mfUnitCircleWidthAngleDegree)
         mfUnitCircleWidthAngleDegree += 360.0;
 
     pChart->m_GLRender.GeneratePieSegment2D(mfUnitCircleInnerRadius, mfUnitCircleOuterRadius,
commit f5fd26fda6e17ff5c4a59e544512b3970fdb8a3e
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Jan 19 20:46:52 2014 +0100

    CID#1103719: fix memory leak

diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 6cd8e82..6b992d9 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -27,6 +27,7 @@
 #include "oox/vml/vmldrawingfragment.hxx"
 #include "oox/vml/vmlshape.hxx"
 #include "oox/drawingml/themefragmenthandler.hxx"
+#include <boost/scoped_ptr.hpp>
 
 namespace oox { namespace shape {
 
@@ -103,10 +104,10 @@ uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getChartShape
         {
             case XML_chart:
             {
-                ContextHandler2Helper *rFragmentHandler
-                            (new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
+                boost::scoped_ptr<ContextHandler2Helper> pFragmentHandler(
+                        new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
                 mpShape.reset(new Shape("com.sun.star.drawing.OLE2Shape" ));
-                mxChartShapeContext.set(new ChartGraphicDataContext(*rFragmentHandler, mpShape, true));
+                mxChartShapeContext.set(new ChartGraphicDataContext(*pFragmentHandler, mpShape, true));
                 break;
             }
             default:


More information about the Libreoffice-commits mailing list