[Libreoffice-commits] core.git: 13 commits - chart2/opengl chart2/Package_opengl.mk chart2/source sdext/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Fri Jun 20 19:27:47 PDT 2014


 chart2/Package_opengl.mk                                 |    2 
 chart2/opengl/screenTextFragmentShader.glsl              |    3 
 chart2/opengl/textFragmentShader.glsl                    |    3 
 chart2/opengl/textFragmentShaderBatch.glsl               |   23 +
 chart2/opengl/textVertexShaderBatch.glsl                 |   23 +
 chart2/source/controller/main/ChartController.cxx        |   50 --
 chart2/source/controller/main/ChartController.hxx        |   46 --
 chart2/source/controller/main/ChartController_Window.cxx |   34 -
 chart2/source/view/charttypes/GL3DBarChart.cxx           |   10 
 chart2/source/view/inc/GL3DRenderer.hxx                  |   44 ++
 chart2/source/view/main/3DChartObjects.cxx               |   11 
 chart2/source/view/main/GL3DRenderer.cxx                 |  315 +++++++++++----
 sdext/source/pdfimport/wrapper/wrapper.cxx               |    2 
 13 files changed, 367 insertions(+), 199 deletions(-)

New commits:
commit ac0989d5eaad3f8ab52b0288e345f30527dc45a4
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 04:20:49 2014 +0200

    avoid manual OpenGL extension checking
    
    Change-Id: I75faa82fc2eef7f3bfd3546d64f47dee6a0b7d08

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 06a1163..090685b 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -200,34 +200,7 @@ OpenGL3DRenderer::ShaderResources::~ShaderResources()
 
 void OpenGL3DRenderer::CheckGLSLVersion()
 {
-    char version[256] = {0};
-    strcpy(version, (char *)glGetString(GL_SHADING_LANGUAGE_VERSION));
-    char *p = version;
-    int iVersion = 0;
-    //get the first point
-    while ((*p != '\0') && (*p != '.'))
-    {
-        iVersion = iVersion * 10 + ((*p) - 0x30);
-        p++;
-    }
-    if (iVersion < 3)
-    {
-        maResources.m_b330Support = false;
-        return;
-    }
-    if (iVersion > 3)
-    {
-        maResources.m_b330Support = true;
-        return;
-    }
-    p++;
-    iVersion = *p - 0x30;
-    if (iVersion >= 3)
-    {
-        maResources.m_b330Support = true;
-        return;
-    }
-    maResources.m_b330Support = false;
+    maResources.m_b330Support = GLEW_VERSION_3_3 == 1;
 }
 
 void OpenGL3DRenderer::ShaderResources::LoadShaders()
@@ -252,17 +225,7 @@ void OpenGL3DRenderer::ShaderResources::LoadShaders()
         m_3DBatchNormalID = glGetAttribLocation(m_3DBatchProID, "vertexNormalModelspace");
         m_3DBatchColorID = glGetAttribLocation(m_3DBatchProID, "barColor");
         //check whether the texture array is support
-        GLint numExtensions = 0;
-        glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
-        for( GLint i = 0; i < numExtensions; ++i )
-        {
-            OUString currExt = ::rtl::OUString::createFromAscii((char*)glGetStringi(GL_EXTENSIONS, i));
-            if (currExt == "GL_EXT_texture_array")
-            {
-                mbTexBatchSupport = true;
-                break;
-            }
-        }
+        mbTexBatchSupport = GLEW_EXT_texture_array == 1;
         if (mbTexBatchSupport)
         {
             m_BatchTextProID = OpenGLHelper::LoadShaders("textVertexShaderBatch", "textFragmentShaderBatch");
commit 00272efc1c71bdbd7fc0126f411765f482eaa2fb
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 03:58:43 2014 +0200

    I don't see a good reason for marking private methods with SAL_CALL
    
    Change-Id: I9b73b6b6073b3249317f4e1124d840930cbe558f

diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 40cae9c..ee8b60a 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -541,12 +541,12 @@ private:
     void                impl_deleteDrawViewController();
 
     //executeDispatch methods
-    void SAL_CALL       executeDispatch_ObjectProperties();
-    void SAL_CALL       executeDispatch_FormatObject( const OUString& rDispatchCommand );
-    void SAL_CALL       executeDlg_ObjectProperties( const OUString& rObjectCID );
+    void executeDispatch_ObjectProperties();
+    void executeDispatch_FormatObject( const OUString& rDispatchCommand );
+    void executeDlg_ObjectProperties( const OUString& rObjectCID );
     bool                executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bOkClickOnUnchangedDialogSouldBeRatedAsSuccessAlso );
 
-    void SAL_CALL       executeDispatch_ChartType();
+    void executeDispatch_ChartType();
 
     void                executeDispatch_InsertTitles();
     void                executeDispatch_InsertLegend();
@@ -588,16 +588,16 @@ private:
     void                executeDispatch_DeleteMajorGrid();
     void                executeDispatch_DeleteMinorGrid();
 
-    void SAL_CALL       executeDispatch_InsertSpecialCharacter();
-    void SAL_CALL       executeDispatch_EditText( const Point* pMousePixel = NULL );
-    void SAL_CALL       executeDispatch_SourceData();
-    void SAL_CALL       executeDispatch_MoveSeries( bool bForward );
+    void executeDispatch_InsertSpecialCharacter();
+    void executeDispatch_EditText( const Point* pMousePixel = NULL );
+    void executeDispatch_SourceData();
+    void executeDispatch_MoveSeries( bool bForward );
 
     void                StartTextEdit( const Point* pMousePixel = NULL );
     bool                EndTextEdit();
 
-    void SAL_CALL       executeDispatch_View3D();
-    void SAL_CALL       executeDispatch_PositionAndSize();
+    void executeDispatch_View3D();
+    void executeDispatch_PositionAndSize();
 
     void                executeDispatch_EditData();
 
commit 374160d659c9790f24165e62dd89128fa5f7295e
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 03:56:25 2014 +0200

    volatile does not make any sense here
    
    Change-Id: I337d845e05007efb29f1c1fa39cdcc046b156281

diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 6d673fa..40cae9c 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -443,7 +443,7 @@ private:
             void acquire();
             void release();
         private:
-            sal_Int32 volatile      m_nRefCount;
+            sal_Int32 m_nRefCount;
     };
     class TheModel : public RefCountable
     {
@@ -466,7 +466,7 @@ private:
 
             //the ownership between model and controller is not clear at first
             //each controller might consider himself as owner of the model first
-            bool volatile       m_bOwnership;
+            bool m_bOwnership;
     };
     class TheModelRef
     {
@@ -487,8 +487,8 @@ private:
     mutable ::apphelper::LifeTimeManager    m_aLifeTimeManager;
 
     mutable ::osl::Mutex    m_aControllerMutex;
-    bool volatile       m_bSuspended;
-    bool volatile       m_bCanClose;
+    bool m_bSuspended;
+    bool m_bCanClose;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>        m_xCC;
 
@@ -509,10 +509,10 @@ private:
     SdrDragMode         m_eDragMode;
 
     Timer               m_aDoubleClickTimer;
-    bool volatile       m_bWaitingForDoubleClick;
-    bool volatile       m_bWaitingForMouseUp;
+    bool m_bWaitingForDoubleClick;
+    bool m_bWaitingForMouseUp;
 
-    bool volatile       m_bConnectingToView;
+    bool m_bConnectingToView;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager >    m_xUndoManager;
     ::std::auto_ptr< UndoGuard >                                                    m_pTextActionUndoGuard;
commit 7fd1fd1dead9799e50641bc920b5bcbe409d330f
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 03:55:06 2014 +0200

    remove unneeded code for 3D charts in controller
    
    Change-Id: I5c1f624cc05a90878f717abc8ffb0b2220ce94d5

diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index ef1d606..1045ec2 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -105,7 +105,6 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const &
     m_bWaitingForDoubleClick(false),
     m_bWaitingForMouseUp(false),
     m_bConnectingToView(false),
-    m_bGL3DChart(false),
     m_xUndoManager( 0 ),
     m_aDispatchContainer( m_xCC, this ),
     m_eDrawMode( CHARTDRAW_SELECT )
@@ -480,8 +479,6 @@ void SAL_CALL ChartController::modeChanged( const util::ModeChangeEvent& rEvent
                 }
 
                 m_bConnectingToView = false;
-
-                queryGL3DChart();
             }
         }
     }
@@ -577,8 +574,6 @@ sal_Bool SAL_CALL ChartController::attachModel( const uno::Reference< frame::XMo
     uno::Reference< document::XUndoManagerSupplier > xSuppUndo( getModel(), uno::UNO_QUERY_THROW );
     m_xUndoManager.set( xSuppUndo->getUndoManager(), uno::UNO_QUERY_THROW );
 
-    queryGL3DChart();
-
     return sal_True;
 }
 
@@ -1389,51 +1384,6 @@ DrawViewWrapper* ChartController::GetDrawViewWrapper()
     return m_pDrawViewWrapper;
 }
 
-void ChartController::queryGL3DChart()
-{
-    m_bGL3DChart = false;
-
-    uno::Reference<frame::XModel> xModel;
-    {   // it's possible that model was cleared by a different thread!
-        osl::MutexGuard g(m_aModelMutex);
-        if (!m_aModel.is())
-            return;
-        xModel = m_aModel->getModel();
-    }
-
-    uno::Reference<XChartDocument> xChartDoc(xModel, uno::UNO_QUERY);
-    if (!xChartDoc.is())
-        return;
-
-    uno::Reference<chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram();
-    m_bGL3DChart = GL3DHelper::isGL3DDiagram(xDiagram);
-}
-
-void ChartController::executeGL3D_Tracking( const TrackingEvent& /*rTEvt*/ )
-{
-}
-
-void ChartController::executeGL3D_Command( const CommandEvent& /*rCEvt*/ )
-{
-}
-
-bool ChartController::executeGL3D_KeyInput( const KeyEvent& /*rKEvt*/ )
-{
-    return false;
-}
-
-void ChartController::executeGL3D_MouseButtonUp( const MouseEvent& /*rMEvt*/ )
-{
-}
-
-void ChartController::executeGL3D_MouseButtonDown( const MouseEvent& /*rMEvt*/ )
-{
-}
-
-void ChartController::executeGL3D_MouseMove( const MouseEvent& /*rMEvt*/ )
-{
-}
-
 uno::Reference< XAccessible > ChartController::CreateAccessible()
 {
     uno::Reference< XAccessible > xResult = new AccessibleChartView( m_xCC, GetDrawViewWrapper() );
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 41bc763..6d673fa 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -432,16 +432,6 @@ private:
     DrawModelWrapper* GetDrawModelWrapper();
     DrawViewWrapper* GetDrawViewWrapper();
 
-    void queryGL3DChart();
-
-    void executeGL3D_Tracking( const TrackingEvent& rTEvt );
-    void executeGL3D_Command( const CommandEvent& rCEvt );
-    bool executeGL3D_KeyInput( const KeyEvent& rKEvt );
-
-    void executeGL3D_MouseButtonUp( const MouseEvent& rMEvt );
-    void executeGL3D_MouseButtonDown( const MouseEvent& rMEvt );
-    void executeGL3D_MouseMove( const MouseEvent& rMEvt );
-
 private:
     class TheModelRef;
     friend class ChartController::TheModelRef;
@@ -524,8 +514,6 @@ private:
 
     bool volatile       m_bConnectingToView;
 
-    bool m_bGL3DChart;
-
     ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager >    m_xUndoManager;
     ::std::auto_ptr< UndoGuard >                                                    m_pTextActionUndoGuard;
     /// needed for dispatching URLs in FeatureStateEvents
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index a05c685..905bcaa 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -562,12 +562,6 @@ IMPL_LINK_NOARG(ChartController, DoubleClickWaitingHdl)
 
 void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
 {
-    if (m_bGL3DChart)
-    {
-        executeGL3D_MouseButtonDown(rMEvt);
-        return;
-    }
-
     SolarMutexGuard aGuard;
 
     m_bWaitingForMouseUp = true;
@@ -714,12 +708,6 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
 
 void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
 {
-    if (m_bGL3DChart)
-    {
-        executeGL3D_MouseMove(rMEvt);
-        return;
-    }
-
     SolarMutexGuard aGuard;
 
     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
@@ -740,23 +728,12 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
     impl_SetMousePointer( rMEvt );
 }
 
-void ChartController::execute_Tracking( const TrackingEvent& rTEvt )
+void ChartController::execute_Tracking( const TrackingEvent& )
 {
-    if (m_bGL3DChart)
-    {
-        executeGL3D_Tracking(rTEvt);
-        return;
-    }
 }
 
 void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
 {
-    if (m_bGL3DChart)
-    {
-        executeGL3D_MouseButtonUp(rMEvt);
-        return;
-    }
-
     ControllerLockGuardUNO aCLGuard( getModel() );
     bool bMouseUpWithoutMouseDown = !m_bWaitingForMouseUp;
     m_bWaitingForMouseUp = false;
@@ -987,12 +964,6 @@ void ChartController::execute_LoseFocus()
 
 void ChartController::execute_Command( const CommandEvent& rCEvt )
 {
-    if (m_bGL3DChart)
-    {
-        executeGL3D_Command(rCEvt);
-        return;
-    }
-
     bool bIsAction = false;
     {
         SolarMutexGuard aGuard;
@@ -1308,9 +1279,6 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
 
 bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
 {
-    if (m_bGL3DChart)
-        return executeGL3D_KeyInput(rKEvt);
-
     bool bReturn=false;
 
     DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
commit 6ef4565efe0393bde8e792d66287a532aea82d31
Author: weigao <weigao at multicorewareinc.com>
Date:   Wed Jun 18 08:21:41 2014 -0700

    add code to call batch texture render
    
    Includes warning fixes from Markus Mohrhard.
    
    Conflicts:
    	chart2/source/view/inc/GL3DRenderer.hxx
    	chart2/source/view/main/GL3DRenderer.cxx
    
    Change-Id: I09da7c49eb11da9ea2bc18a5e13f2fd2c0d6bd8f

diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 0821cfe..9c4c03f 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -141,6 +141,26 @@ struct TextInfo
     float vertex[12];
 };
 
+struct TextureArrayInfo
+{
+    size_t subTextureNum;
+    int textureArrayWidth;
+    int textureArrayHeight;
+    GLuint textureID;
+
+    TextureArrayInfo();
+};
+
+struct TextInfoBatch
+{
+    size_t batchNum;
+    std::vector<glm::vec4> idList;
+    std::vector<TextureArrayInfo> texture;
+    std::vector<glm::vec3> vertexList;
+    std::vector<glm::vec3> textureCoordList;
+};
+
+
 struct BatchBarInfo
 {
     std::vector <glm::mat4> modelMatrixList;
@@ -231,6 +251,18 @@ private:
     void UpdateBatch3DUniformBlock();
     void RenderBatchBars(bool bNewScene);
     void CheckGLSLVersion();
+    void RenderTextShapeBatch();
+    void ReleaseTextShapesBatch();
+    void CreateTextTextureSingle(const boost::shared_array<sal_uInt8> &bitmapBuf,
+                           ::Size maSizePixels,
+                           glm::vec3 vTopLeft,glm::vec3 vTopRight,
+                           glm::vec3 vBottomRight, glm::vec3 vBottomLeft,
+                           sal_uInt32 nUniqueId);
+    void CreateTextTextureBatch(const boost::shared_array<sal_uInt8> &bitmapBuf,
+                       ::Size maSizePixels,
+                       glm::vec3 vTopLeft,glm::vec3 vTopRight,
+                       glm::vec3 vBottomRight, glm::vec3 vBottomLeft,
+                       sal_uInt32 nUniqueId);
 private:
 
     struct ShaderResources
@@ -286,6 +318,14 @@ private:
         GLint m_3DBatchNormalID;
         GLint m_3DBatchColorID;
 
+        //Batch render text
+        bool mbTexBatchSupport;
+        GLint m_BatchTextProID;
+        GLint m_BatchTextMatrixID;
+        GLint m_BatchTextVertexID;
+        GLint m_BatchTextTexCoordID;
+        GLint m_BatchTextTexID;
+
         ShaderResources();
         ~ShaderResources();
 
@@ -358,6 +398,7 @@ private:
     std::vector <TextInfo> m_TextInfoList;
     std::vector <TextInfo> m_ScreenTextInfoList;
     GLuint m_TextTexCoordBuf;
+    GLuint m_TextTexCoordBufBatch;
 
     std::vector<glm::vec3> m_Vertices;
 
@@ -388,6 +429,7 @@ private:
     GLint m_Batch3DActualSizeLight;
 
     glm::mat4 m_GlobalScaleMatrix;
+    TextInfoBatch m_TextInfoBatch;
     //for 3.0 version
     int m_iLightNum;
     glm::vec4 m_Ambient;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index d3db57c..06a1163 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -71,6 +71,14 @@ glm::vec4 getColorAsVector(sal_uInt32 nColor)
 
 }
 
+TextureArrayInfo::TextureArrayInfo():
+    subTextureNum(0),
+    textureArrayWidth(0),
+    textureArrayHeight(0),
+    textureID(0)
+{
+}
+
 OpenGL3DRenderer::OpenGL3DRenderer():
       m_iWidth(0)
     , m_iHeight(0)
@@ -111,6 +119,7 @@ OpenGL3DRenderer::OpenGL3DRenderer():
 
 OpenGL3DRenderer::~OpenGL3DRenderer()
 {
+    ReleaseShapes();
     // delete buffers
     glDeleteBuffers(1, &m_CubeVertexBuf);
     glDeleteBuffers(1, &m_CubeNormalBuf);
@@ -126,10 +135,18 @@ OpenGL3DRenderer::~OpenGL3DRenderer()
     glDeleteBuffers(1, &m_Batch3DUBOBuffer);
     glDeleteBuffers(1, &m_3DUBOBuffer);
     glDeleteBuffers(1, &m_3DUBOBuffer);
+    glDeleteBuffers(1, &m_TextTexCoordBufBatch);
 
     glDeleteFramebuffers(1, &mnPickingFbo);
     glDeleteRenderbuffers(1, &mnPickingRboDepth);
     glDeleteRenderbuffers(1, &mnPickingRboColor);
+
+    for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+    {
+        glDeleteTextures(1, &m_TextInfoBatch.texture[i].textureID);
+    }
+    m_TextInfoBatch.texture.clear();
+
 }
 
 OpenGL3DRenderer::ShaderResources::ShaderResources()
@@ -162,6 +179,12 @@ OpenGL3DRenderer::ShaderResources::ShaderResources()
     , m_3DBatchVertexID(0)
     , m_3DBatchNormalID(0)
     , m_3DBatchColorID(0)
+    , mbTexBatchSupport(false)
+    , m_BatchTextProID(0)
+    , m_BatchTextMatrixID(0)
+    , m_BatchTextVertexID(0)
+    , m_BatchTextTexCoordID(0)
+    , m_BatchTextTexID(0)
 {
 }
 
@@ -172,6 +195,7 @@ OpenGL3DRenderer::ShaderResources::~ShaderResources()
     glDeleteProgram(m_ScreenTextProID);
     glDeleteProgram(m_3DProID);
     glDeleteProgram(m_3DBatchProID);
+    glDeleteProgram(m_BatchTextProID);
 }
 
 void OpenGL3DRenderer::CheckGLSLVersion()
@@ -227,6 +251,27 @@ void OpenGL3DRenderer::ShaderResources::LoadShaders()
         m_3DBatchVertexID = glGetAttribLocation(m_3DBatchProID, "vertexPositionModelspace");
         m_3DBatchNormalID = glGetAttribLocation(m_3DBatchProID, "vertexNormalModelspace");
         m_3DBatchColorID = glGetAttribLocation(m_3DBatchProID, "barColor");
+        //check whether the texture array is support
+        GLint numExtensions = 0;
+        glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+        for( GLint i = 0; i < numExtensions; ++i )
+        {
+            OUString currExt = ::rtl::OUString::createFromAscii((char*)glGetStringi(GL_EXTENSIONS, i));
+            if (currExt == "GL_EXT_texture_array")
+            {
+                mbTexBatchSupport = true;
+                break;
+            }
+        }
+        if (mbTexBatchSupport)
+        {
+            m_BatchTextProID = OpenGLHelper::LoadShaders("textVertexShaderBatch", "textFragmentShaderBatch");
+            m_BatchTextMatrixID = glGetUniformLocation(m_BatchTextProID, "MVP");
+            m_BatchTextTexID = glGetUniformLocation(m_BatchTextProID, "texArray");
+            m_BatchTextVertexID = glGetAttribLocation(m_BatchTextProID, "vPosition");
+            m_BatchTextTexCoordID = glGetAttribLocation(m_BatchTextProID, "texCoord");
+        }
+        mbTexBatchSupport = m_BatchTextProID ? true : false;
     }
     else
     {
@@ -250,11 +295,14 @@ void OpenGL3DRenderer::ShaderResources::LoadShaders()
         m_3DVertexID = glGetAttribLocation(m_3DProID, "vertexPositionModelspace");
         m_3DNormalID = glGetAttribLocation(m_3DProID, "vertexNormalModelspace");
     }
-    m_TextProID = OpenGLHelper::LoadShaders("textVertexShader", "textFragmentShader");
-    m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP");
-    m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition");
-    m_TextTexCoordID = glGetAttribLocation(m_TextProID, "texCoord");
-    m_TextTexID = glGetUniformLocation(m_TextProID, "TextTex");
+    if (!mbTexBatchSupport)
+    {
+        m_TextProID = OpenGLHelper::LoadShaders("textVertexShader", "textFragmentShader");
+        m_TextMatrixID = glGetUniformLocation(m_TextProID, "MVP");
+        m_TextVertexID = glGetAttribLocation(m_TextProID, "vPosition");
+        m_TextTexCoordID = glGetAttribLocation(m_TextProID, "texCoord");
+        m_TextTexID = glGetUniformLocation(m_TextProID, "TextTex");
+    }
 
     m_ScreenTextProID = OpenGLHelper::LoadShaders("screenTextVertexShader", "screenTextFragmentShader");
     m_ScreenTextVertexID = glGetAttribLocation(m_ScreenTextProID, "vPosition");
@@ -326,6 +374,7 @@ void OpenGL3DRenderer::init()
     glGenBuffers(1, &m_BatchModelMatrixBuf);
     glGenBuffers(1, &m_BatchNormalMatrixBuf);
     glGenBuffers(1, &m_BatchColorBuf);
+    glGenBuffers(1, &m_TextTexCoordBufBatch);
     glGenBuffers(1, &m_BoundBox);
     glBindBuffer(GL_ARRAY_BUFFER, m_BoundBox);
     glBufferData(GL_ARRAY_BUFFER, sizeof(boundBox), boundBox, GL_STATIC_DRAW);
@@ -367,6 +416,7 @@ void OpenGL3DRenderer::init()
         Init3DUniformBlock();
         InitBatch3DUniformBlock();
     }
+    m_TextInfoBatch.batchNum = 512;
     CHECK_GL_ERROR();
     glViewport(0, 0, m_iWidth, m_iHeight);
     Set3DSenceInfo(0xFFFFFF, true);
@@ -1631,11 +1681,11 @@ void OpenGL3DRenderer::CreateScreenTextTexture(
     m_ScreenTextInfoList.push_back(aTextInfo);
 }
 
-void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
-                                         ::Size maSizePixels,
-                                         const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
-                                         const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
-                                         sal_uInt32 nUniqueId)
+void OpenGL3DRenderer::CreateTextTextureSingle(const boost::shared_array<sal_uInt8> &bitmapBuf,
+                           ::Size maSizePixels,
+                           glm::vec3 vTopLeft,glm::vec3 vTopRight,
+                           glm::vec3 vBottomRight, glm::vec3 vBottomLeft,
+                           sal_uInt32 nUniqueId)
 {
     long bmpWidth = maSizePixels.Width();
     long bmpHeight = maSizePixels.Height();
@@ -1676,6 +1726,92 @@ void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &b
     glBindTexture(GL_TEXTURE_2D, 0);
     CHECK_GL_ERROR();
     m_TextInfoList.push_back(aTextInfo);
+
+}
+
+
+void OpenGL3DRenderer::CreateTextTextureBatch(const boost::shared_array<sal_uInt8> &bitmapBuf,
+                   ::Size maSizePixels,
+                   glm::vec3 vTopLeft,glm::vec3 vTopRight,
+                   glm::vec3 vBottomRight, glm::vec3 vBottomLeft,
+                   sal_uInt32 nUniqueId)
+{
+    long bmpWidth = maSizePixels.Width();
+    long bmpHeight = maSizePixels.Height();
+    glm::vec4 id = getColorAsVector(nUniqueId);
+    m_TextInfoBatch.idList.push_back(id);
+    m_TextInfoBatch.vertexList.push_back(glm::vec3(vBottomRight.x, vBottomRight.y, vBottomRight.z));
+    m_TextInfoBatch.vertexList.push_back(glm::vec3(vTopRight.x, vTopRight.y, vTopRight.z));
+    m_TextInfoBatch.vertexList.push_back(glm::vec3(vTopLeft.x, vTopLeft.y, vTopLeft.z));
+    m_TextInfoBatch.vertexList.push_back(glm::vec3(vBottomLeft.x, vBottomLeft.y, vBottomLeft.z));
+    //find the last vector, which size is small than default batch number;
+    size_t index = 0;
+    while ((m_TextInfoBatch.texture.size() > 0) &&
+           (m_TextInfoBatch.texture[index].subTextureNum >= m_TextInfoBatch.batchNum) &&
+           (index < m_TextInfoBatch.texture.size() - 1))
+    {
+        index++;
+    }
+    //if the sub texture number of the last texture array reach the largest, create a new textur array
+    if ((m_TextInfoBatch.texture.size() == 0) ||
+        (m_TextInfoBatch.texture[index].subTextureNum >= m_TextInfoBatch.batchNum))
+    {
+        TextureArrayInfo textureArray;
+        glGenTextures(1, &textureArray.textureID);
+        CHECK_GL_ERROR();
+        glBindTexture(GL_TEXTURE_2D_ARRAY, textureArray.textureID);
+        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        CHECK_GL_ERROR();
+        textureArray.textureArrayWidth = bmpHeight * 8;
+        textureArray.textureArrayHeight = bmpHeight;
+        glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGB, textureArray.textureArrayWidth, textureArray.textureArrayHeight,
+                     m_TextInfoBatch.batchNum, 0, GL_RGB,  GL_UNSIGNED_BYTE, NULL);
+        CHECK_GL_ERROR();
+        if (m_TextInfoBatch.texture.size() > 0)
+        {
+            index++;
+        }
+        m_TextInfoBatch.texture.push_back(textureArray);
+        glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
+    }
+    glBindTexture(GL_TEXTURE_2D_ARRAY, m_TextInfoBatch.texture[index].textureID);
+    CHECK_GL_ERROR();
+    glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, m_TextInfoBatch.texture[index].subTextureNum, bmpWidth, bmpHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get());
+    CHECK_GL_ERROR();
+        //calc texture coordinate
+    m_TextInfoBatch.textureCoordList.push_back(glm::vec3((float)bmpWidth / (float)m_TextInfoBatch.texture[index].textureArrayWidth,
+                                                         0,
+                                                         m_TextInfoBatch.texture[index].subTextureNum));
+    m_TextInfoBatch.textureCoordList.push_back(glm::vec3((float)bmpWidth / (float)m_TextInfoBatch.texture[index].textureArrayWidth,
+                                                         (float)bmpHeight/ (float)m_TextInfoBatch.texture[index].textureArrayHeight,
+                                                         m_TextInfoBatch.texture[index].subTextureNum));
+    m_TextInfoBatch.textureCoordList.push_back(glm::vec3(0,
+                                                         (float)bmpHeight/ (float)m_TextInfoBatch.texture[index].textureArrayHeight,
+                                                         m_TextInfoBatch.texture[index].subTextureNum));
+    m_TextInfoBatch.textureCoordList.push_back(glm::vec3(0,
+                                                         0,
+                                                         m_TextInfoBatch.texture[index].subTextureNum));
+    m_TextInfoBatch.texture[index].subTextureNum++;
+    glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
+}
+
+void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &bitmapBuf,
+                                         ::Size maSizePixels,
+                                         const glm::vec3& vTopLeft, const glm::vec3& vTopRight,
+                                         const glm::vec3& vBottomRight, const glm::vec3& vBottomLeft,
+                                         sal_uInt32 nUniqueId)
+{
+    if (maResources.mbTexBatchSupport)
+    {
+        CreateTextTextureBatch(bitmapBuf, maSizePixels, vTopLeft, vTopRight, vBottomRight, vBottomLeft, nUniqueId);
+    }
+    else
+    {
+        CreateTextTextureSingle(bitmapBuf, maSizePixels, vTopLeft, vTopRight, vBottomRight, vBottomLeft, nUniqueId);
+    }
 }
 
 void OpenGL3DRenderer::ReleaseTextShapes()
@@ -1753,7 +1889,67 @@ void OpenGL3DRenderer::RenderScreenTextShape()
     }
     CHECK_GL_ERROR();
 }
+void OpenGL3DRenderer::ReleaseTextShapesBatch()
+{
+    for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+    {
+        m_TextInfoBatch.texture[i].subTextureNum = 0;
+    }
+    m_TextInfoBatch.vertexList.clear();
+    m_TextInfoBatch.textureCoordList.clear();
+    m_TextInfoBatch.idList.clear();
+}
 
+void OpenGL3DRenderer::RenderTextShapeBatch()
+{
+    glm::mat4 aMVP = m_3DProjection * m_3DView * m_GlobalScaleMatrix;
+    glUseProgram(maResources.m_BatchTextProID);
+    CHECK_GL_ERROR();
+    glUniformMatrix4fv(maResources.m_BatchTextMatrixID, 1, GL_FALSE, &aMVP[0][0]);
+    glEnableVertexAttribArray(maResources.m_BatchTextVertexID);
+    glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+    glVertexAttribPointer(
+        maResources.m_BatchTextVertexID,
+        3,                  // size
+        GL_FLOAT,           // type
+        GL_FALSE,           // normalized?
+        0,                  // stride
+        (void*)0            // array buffer offset
+        );
+    //tex coord
+    CHECK_GL_ERROR();
+    glEnableVertexAttribArray(maResources.m_BatchTextTexCoordID);
+    glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBufBatch);
+    glVertexAttribPointer(
+        maResources.m_BatchTextTexCoordID,
+        3,                  // size
+        GL_FLOAT,           // type
+        GL_FALSE,           // normalized?
+        0,                  // stride
+        (void*)0            // array buffer offset
+        );
+    //use texture array to get the vertex
+    for (size_t i = 0; i < m_TextInfoBatch.texture.size(); i++)
+    {
+        int vertexNum = m_TextInfoBatch.texture[i].subTextureNum;
+        glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
+        glBufferData(GL_ARRAY_BUFFER, 4 * vertexNum * sizeof(glm::vec3), &m_TextInfoBatch.vertexList[4 * i * m_TextInfoBatch.batchNum], GL_STATIC_DRAW);
+        glBindBuffer(GL_ARRAY_BUFFER, m_TextTexCoordBufBatch);
+        glBufferData(GL_ARRAY_BUFFER, 4 * vertexNum * sizeof(glm::vec3), &m_TextInfoBatch.textureCoordList[4 * i * m_TextInfoBatch.batchNum], GL_STATIC_DRAW);
+        glBindTexture(GL_TEXTURE_2D_ARRAY, m_TextInfoBatch.texture[i].textureID);
+        CHECK_GL_ERROR();
+        glUniform1i(maResources.m_BatchTextTexID, 0);
+        CHECK_GL_ERROR();
+        //TODO: moggi: get rid fo GL_QUADS
+        glDrawArrays(GL_QUADS, 0, 4 * vertexNum);
+    }
+    glDisableVertexAttribArray(maResources.m_BatchTextVertexID);
+    CHECK_GL_ERROR();
+    glDisableVertexAttribArray(maResources.m_BatchTextTexCoordID);
+    CHECK_GL_ERROR();
+    glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
+    glUseProgram(0);
+}
 void OpenGL3DRenderer::RenderTextShape()
 {
     CHECK_GL_ERROR();
@@ -1869,7 +2065,14 @@ void OpenGL3DRenderer::ProcessUnrenderedShape(bool bNewScene)
         }
     }
     //render text
-    RenderTextShape();
+    if (maResources.mbTexBatchSupport)
+    {
+        RenderTextShapeBatch();
+    }
+    else
+    {
+        RenderTextShape();
+    }
     // render screen text
     RenderScreenTextShape();
 #if DEBUG_FBO
@@ -1929,6 +2132,7 @@ void OpenGL3DRenderer::ReleaseShapes()
     ReleaseTextShapes();
     ReleaseScreenTextShapes();
     ReleaseBatchBarInfo();
+    ReleaseTextShapesBatch();
 }
 
 void OpenGL3DRenderer::GetBatchMiddleInfo(const Extrude3DInfo &extrude3D)
commit 50a5739cee2b26d9a70c321664f7166a32fa8647
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 03:31:33 2014 +0200

    small whitespace changes
    
    Change-Id: I10aa08268bf148eb792440f13bcf044b350d6937

diff --git a/chart2/opengl/textFragmentShaderBatch.glsl b/chart2/opengl/textFragmentShaderBatch.glsl
index d7bd4ae..7008883 100644
--- a/chart2/opengl/textFragmentShaderBatch.glsl
+++ b/chart2/opengl/textFragmentShaderBatch.glsl
@@ -6,15 +6,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
+
 #version 330 core
 #extension GL_EXT_texture_array : enable
+
 uniform sampler2DArray texArray;
 in vec3 vTexCoord;
 
 out vec4 actualColor;
 void main()
 {
-	vec3 color = texture2DArray(texArray, vTexCoord.xyz).rgb;
+    vec3 color = texture2DArray(texArray, vTexCoord.xyz).rgb;
     actualColor = vec4(color, 1.0 - color.r);
 }
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textVertexShaderBatch.glsl b/chart2/opengl/textVertexShaderBatch.glsl
index f894333..e61beb6 100644
--- a/chart2/opengl/textVertexShaderBatch.glsl
+++ b/chart2/opengl/textVertexShaderBatch.glsl
@@ -6,6 +6,7 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
+
 #version 330 core
 in vec3 vPosition;
 in vec3 texCoord;
commit 016467d8a54bc5ed4990236dc990824b3efefa9c
Author: weigao <weigao at multicorewareinc.com>
Date:   Wed Jun 18 08:01:46 2014 -0700

    add batch render texture shaders
    
    Change-Id: I922d24bc63ed7c1f16318c25da0b6b3401d24b6f

diff --git a/chart2/Package_opengl.mk b/chart2/Package_opengl.mk
index 3d68a93..6e1e298 100644
--- a/chart2/Package_opengl.mk
+++ b/chart2/Package_opengl.mk
@@ -32,6 +32,8 @@ $(eval $(call gb_Package_add_files,chart2_opengl_shader,$(LIBO_BIN_FOLDER)/openg
 	shape3DVertexShaderBatch.glsl \
 	shape3DFragmentShaderV300.glsl \
 	shape3DVertexShaderV300.glsl \
+	textFragmentShaderBatch.glsl \
+	textVertexShaderBatch.glsl \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/chart2/opengl/textFragmentShaderBatch.glsl b/chart2/opengl/textFragmentShaderBatch.glsl
new file mode 100644
index 0000000..d7bd4ae
--- /dev/null
+++ b/chart2/opengl/textFragmentShaderBatch.glsl
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#version 330 core
+#extension GL_EXT_texture_array : enable
+uniform sampler2DArray texArray;
+in vec3 vTexCoord;
+
+out vec4 actualColor;
+void main()
+{
+	vec3 color = texture2DArray(texArray, vTexCoord.xyz).rgb;
+    actualColor = vec4(color, 1.0 - color.r);
+}
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textVertexShaderBatch.glsl b/chart2/opengl/textVertexShaderBatch.glsl
new file mode 100644
index 0000000..f894333
--- /dev/null
+++ b/chart2/opengl/textVertexShaderBatch.glsl
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+#version 330 core
+in vec3 vPosition;
+in vec3 texCoord;
+
+out vec3 vTexCoord;
+uniform mat4 MVP;
+
+void main()
+{
+    gl_Position =  MVP * vec4(vPosition, 1);
+    vTexCoord = texCoord;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 87e23f425f60b0b7459c63b824bc8bdc17796ad2
Author: weigao <weigao at multicorewareinc.com>
Date:   Wed Jun 18 01:10:05 2014 -0700

    use shader to calculate alpha channel
    
    Conflicts:
    	chart2/source/view/main/GL3DRenderer.cxx
    
    Change-Id: I3cf9636b36ffd47589dd3ab61278802ca73644ce

diff --git a/chart2/opengl/screenTextFragmentShader.glsl b/chart2/opengl/screenTextFragmentShader.glsl
index a848103..7e2bd26 100644
--- a/chart2/opengl/screenTextFragmentShader.glsl
+++ b/chart2/opengl/screenTextFragmentShader.glsl
@@ -11,7 +11,8 @@ varying vec2 vTexCoord;
 uniform sampler2D TextTex;
 void main()
 {
-    gl_FragColor = vec4(texture2D(TextTex, vTexCoord).rgba);
+    vec3 color = texture2D(TextTex, vTexCoord).rgb;
+    gl_FragColor = vec4(color, 1.0 - color.r);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textFragmentShader.glsl b/chart2/opengl/textFragmentShader.glsl
index ef8d44d..c1d44bc 100644
--- a/chart2/opengl/textFragmentShader.glsl
+++ b/chart2/opengl/textFragmentShader.glsl
@@ -11,7 +11,8 @@ uniform sampler2D TextTex;
 varying vec2 vTexCoord;
 void main()
 {
-    gl_FragColor = vec4(texture2D(TextTex, vTexCoord).rgba);
+    vec3 color = texture2D(TextTex, vTexCoord).rgb;
+    gl_FragColor = vec4(color, 1.0 - color.r);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/view/inc/GL3DRenderer.hxx b/chart2/source/view/inc/GL3DRenderer.hxx
index 6218fbc..0821cfe 100644
--- a/chart2/source/view/inc/GL3DRenderer.hxx
+++ b/chart2/source/view/inc/GL3DRenderer.hxx
@@ -373,8 +373,6 @@ private:
 
     float m_fViewAngle;
 
-    float m_fHeightWeight;
-
     bool mbPickingMode;
 
     GLuint mnPickingFbo;
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index 1b962c6..f1db16f 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -12,6 +12,7 @@
 #include <vcl/svapp.hxx>
 
 #include <vcl/opengl/OpenGLHelper.hxx>
+#include <vcl/bmpacc.hxx>
 
 namespace chart {
 
@@ -90,7 +91,15 @@ const TextCacheItem& TextCache::getText(OUString const & rText)
     aDevice.DrawText(Point(0,0), rText);
 
     BitmapEx aText(aDevice.GetBitmapEx(Point(0,0), aDevice.GetOutputSize()));
-    TextCacheItem *pItem = new TextCacheItem(OpenGLHelper::ConvertBitmapExToRGBABuffer(aText), aText.GetSizePixel());
+//    TextCacheItem *pItem = new TextCacheItem(OpenGLHelper::ConvertBitmapExToRGBABuffer(aText), aText.GetSizePixel());
+    Bitmap aBitmap (aText.GetBitmap());
+    BitmapReadAccess *pAcc = aBitmap.AcquireReadAccess();
+    sal_uInt8 *buf = (sal_uInt8 *)pAcc->GetBuffer();
+    long nBmpWidth = aText.GetSizePixel().Width();
+    long nBmpHeight = aText.GetSizePixel().Height();
+    sal_uInt8* pBitmapBuf(new sal_uInt8[3* nBmpWidth * nBmpHeight]);
+    memcpy(pBitmapBuf, buf, 3* nBmpWidth * nBmpHeight);
+    TextCacheItem *pItem = new TextCacheItem(pBitmapBuf, aText.GetSizePixel());
     maTextCache.insert(rText, pItem);
 
     return *maTextCache.find(rText)->second;
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 1291230..d3db57c 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -55,10 +55,10 @@ int static checkGLError(const char *file, int line)
 #define CHECK_GL_ERROR() checkGLError(__FILE__, __LINE__)
 
 GLfloat texCoords[] = {
-    0.0f, 0.0f,
     1.0f, 0.0f,
     1.0f, 1.0f,
-    0.0f, 1.0f
+    0.0f, 1.0f,
+    0.0f, 0.0f
 };
 
 glm::vec4 getColorAsVector(sal_uInt32 nColor)
@@ -88,7 +88,6 @@ OpenGL3DRenderer::OpenGL3DRenderer():
     , m_RenderVertexBuf(0)
     , m_RenderTexCoordBuf(0)
     , m_fViewAngle(30.0f)
-    , m_fHeightWeight(1.0f)
     , mbPickingMode(false)
     , mnPickingFbo(0)
     , mnPickingRboDepth(0)
@@ -786,7 +785,7 @@ void OpenGL3DRenderer::RenderLine3D(const Polygon3DInfo& polygon)
     glUseProgram(maResources.m_CommonProID);
     PosVecf3 trans = {0.0f, 0, 0.0};
     PosVecf3 angle = {0.0f, 0.0f, 0.0f};
-    PosVecf3 scale = {1.0f, 1.0f, m_fHeightWeight};
+    PosVecf3 scale = {1.0f, 1.0f, 1.0f};
     MoveModelf(trans, angle, scale);
     m_Model = m_GlobalScaleMatrix * m_Model;
     m_3DMVP = m_3DProjection * m_3DView * m_Model;
@@ -877,7 +876,7 @@ void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
         Normals3D *normalList = polygon.normalsList[i];
         PosVecf3 trans = {0.0f, 0.0f, 0.0};
         PosVecf3 angle = {0.0f, 0.0f, 0.0f};
-        PosVecf3 scale = {1.0f, 1.0f, m_fHeightWeight};
+        PosVecf3 scale = {1.0f, 1.0f, 1.0f};
         MoveModelf(trans, angle, scale);
         m_Model = m_GlobalScaleMatrix * m_Model;
         glm::mat3 normalMatrix(m_Model);
@@ -1546,8 +1545,6 @@ void OpenGL3DRenderer::RenderExtrude3DObject()
                     (void*)0            // array buffer offset
                     );
         }
-        extrude3DInfo.zTransform *= m_fHeightWeight;
-        extrude3DInfo.zScale *= m_fHeightWeight;
         if(!mbPickingMode)
         {
             if (maResources.m_b330Support)
@@ -1598,22 +1595,22 @@ void OpenGL3DRenderer::CreateScreenTextTexture(
 
     TextInfo aTextInfo;
     aTextInfo.id = getColorAsVector(nUniqueId);
-    aTextInfo.vertex[0] = vTopLeft.x;
-    aTextInfo.vertex[1] = vTopLeft.y;
+    aTextInfo.vertex[0] = vBottomRight.x;
+    aTextInfo.vertex[1] = vBottomRight.y;
     aTextInfo.vertex[2] = 0;
 
     aTextInfo.vertex[3] = vBottomRight.x;
     aTextInfo.vertex[4] = vTopLeft.y;
     aTextInfo.vertex[5] = 0;
 
+    aTextInfo.vertex[6] = vTopLeft.x;
+    aTextInfo.vertex[7] = vTopLeft.y;
+    aTextInfo.vertex[8] = 0;
+
     aTextInfo.vertex[9] = vTopLeft.x;
     aTextInfo.vertex[10] = vBottomRight.y;
     aTextInfo.vertex[11] = 0;
 
-    aTextInfo.vertex[6] = vBottomRight.x;
-    aTextInfo.vertex[7] = vBottomRight.y;
-    aTextInfo.vertex[8] = 0;
-
     CHECK_GL_ERROR();
     glGenTextures(1, &aTextInfo.texture);
     CHECK_GL_ERROR();
@@ -1627,7 +1624,7 @@ void OpenGL3DRenderer::CreateScreenTextTexture(
     CHECK_GL_ERROR();
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     CHECK_GL_ERROR();
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bmpWidth, bmpHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmapBuf.get());
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmpWidth, bmpHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get());
     CHECK_GL_ERROR();
     glBindTexture(GL_TEXTURE_2D, 0);
     CHECK_GL_ERROR();
@@ -1645,21 +1642,21 @@ void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &b
 
     TextInfo aTextInfo;
     aTextInfo.id = getColorAsVector(nUniqueId);
-    aTextInfo.vertex[0] = vTopLeft.x;
-    aTextInfo.vertex[1] = vTopLeft.y;
-    aTextInfo.vertex[2] = vTopLeft.z * m_fHeightWeight;
+    aTextInfo.vertex[0] = vBottomRight.x;
+    aTextInfo.vertex[1] = vBottomRight.y;
+    aTextInfo.vertex[2] = vBottomRight.z;
 
     aTextInfo.vertex[3] = vTopRight.x;
     aTextInfo.vertex[4] = vTopRight.y;
-    aTextInfo.vertex[5] = vTopRight.z * m_fHeightWeight;
+    aTextInfo.vertex[5] = vTopRight.z;
 
     aTextInfo.vertex[9] = vBottomLeft.x;
     aTextInfo.vertex[10] = vBottomLeft.y;
-    aTextInfo.vertex[11] = vBottomLeft.z * m_fHeightWeight;
+    aTextInfo.vertex[11] = vBottomLeft.z;
 
-    aTextInfo.vertex[6] = vBottomRight.x;
-    aTextInfo.vertex[7] = vBottomRight.y;
-    aTextInfo.vertex[8] = vBottomRight.z * m_fHeightWeight;
+    aTextInfo.vertex[6] = vTopLeft.x;
+    aTextInfo.vertex[7] = vTopLeft.y;
+    aTextInfo.vertex[8] = vTopLeft.z;
 
     CHECK_GL_ERROR();
     glGenTextures(1, &aTextInfo.texture);
@@ -1674,7 +1671,7 @@ void OpenGL3DRenderer::CreateTextTexture(const boost::shared_array<sal_uInt8> &b
     CHECK_GL_ERROR();
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     CHECK_GL_ERROR();
-    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, bmpWidth, bmpHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, bitmapBuf.get());
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmpWidth, bmpHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get());
     CHECK_GL_ERROR();
     glBindTexture(GL_TEXTURE_2D, 0);
     CHECK_GL_ERROR();
@@ -2013,8 +2010,6 @@ void OpenGL3DRenderer::GetBatchBarsInfo()
     for (size_t i = 0; i < m_Extrude3DList.size(); i++)
     {
         Extrude3DInfo &extrude3DInfo = m_Extrude3DList[i];
-        extrude3DInfo.zTransform *= m_fHeightWeight;
-        extrude3DInfo.zScale *= m_fHeightWeight;
         if (m_Extrude3DInfo.rounded)
         {
             GetBatchTopAndFlatInfo(extrude3DInfo);
commit f4436dcb95b341dbb8d2c58e6c7bf1ceb2ffbc10
Author: weigao <weigao at multicorewareinc.com>
Date:   Wed Jun 18 00:04:08 2014 -0700

    add global scale matrix
    
    Conflicts:
    	chart2/source/view/main/GL3DRenderer.cxx
    
    Change-Id: I23b9929dd3f0f1b0a070091ed9c1fe920edfcbf9

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 8f6bc27..1291230 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -788,7 +788,7 @@ void OpenGL3DRenderer::RenderLine3D(const Polygon3DInfo& polygon)
     PosVecf3 angle = {0.0f, 0.0f, 0.0f};
     PosVecf3 scale = {1.0f, 1.0f, m_fHeightWeight};
     MoveModelf(trans, angle, scale);
-    m_Model =m_GlobalScaleMatrix * m_Model;
+    m_Model = m_GlobalScaleMatrix * m_Model;
     m_3DMVP = m_3DProjection * m_3DView * m_Model;
 
     for (size_t i = 0; i < polygon.verticesList.size(); i++)
@@ -879,7 +879,7 @@ void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
         PosVecf3 angle = {0.0f, 0.0f, 0.0f};
         PosVecf3 scale = {1.0f, 1.0f, m_fHeightWeight};
         MoveModelf(trans, angle, scale);
-        m_Model =m_GlobalScaleMatrix * m_Model;
+        m_Model = m_GlobalScaleMatrix * m_Model;
         glm::mat3 normalMatrix(m_Model);
         glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
 
@@ -1279,7 +1279,7 @@ void OpenGL3DRenderer::RenderExtrudeFlatSurface(const Extrude3DInfo& extrude3D,
                       extrude3D.zTransform};
     glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
     glm::mat4 flatScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
-    m_Model = aTranslationMatrix * extrude3D.rotation * flatScale;
+    m_Model = m_GlobalScaleMatrix * aTranslationMatrix * extrude3D.rotation * flatScale;
     if(!mbPickingMode)
     {
         glm::mat3 normalMatrix(m_Model);
@@ -1323,7 +1323,7 @@ void OpenGL3DRenderer::RenderExtrudeBottomSurface(const Extrude3DInfo& extrude3D
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
         m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale;
     }
-    m_Model =m_GlobalScaleMatrix * m_Model;
+    m_Model = m_GlobalScaleMatrix * m_Model;
     if(!mbPickingMode)
     {
         glm::mat3 normalMatrix(m_Model);
@@ -1368,7 +1368,7 @@ void OpenGL3DRenderer::RenderExtrudeMiddleSurface(const Extrude3DInfo& extrude3D
         glm::mat4 reverseMatrix = glm::translate(glm::vec3(0.0, 0.0, -1.0));
         m_Model = m_Model * reverseMatrix;
     }
-    m_Model =m_GlobalScaleMatrix * m_Model;
+    m_Model = m_GlobalScaleMatrix * m_Model;
     if(!mbPickingMode)
     {
         glm::mat3 normalMatrix(m_Model);
@@ -1413,7 +1413,7 @@ void OpenGL3DRenderer::RenderExtrudeTopSurface(const Extrude3DInfo& extrude3D)
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
         m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale * orgTrans;
     }
-    m_Model =m_GlobalScaleMatrix * m_Model;
+    m_Model = m_GlobalScaleMatrix * m_Model;
     if(!mbPickingMode)
     {
         glm::mat3 normalMatrix(m_Model);
@@ -1443,7 +1443,7 @@ void OpenGL3DRenderer::RenderNonRoundedBar(const Extrude3DInfo& extrude3D)
         glm::mat4 reverseMatrix = glm::translate(glm::vec3(0.0, 0.0, -1.0));
         m_Model = m_Model * reverseMatrix;
     }
-    m_Model =m_GlobalScaleMatrix * m_Model;
+    m_Model = m_GlobalScaleMatrix * m_Model;
     if(!mbPickingMode)
     {
         glm::mat3 normalMatrix(m_Model);
@@ -1767,7 +1767,7 @@ void OpenGL3DRenderer::RenderTextShape()
         PosVecf3 angle = {0.0f, 0.0f, 0.0f};
         PosVecf3 scale = {1.0, 1.0, 1.0f};
         MoveModelf(trans, angle, scale);
-        m_Model =m_GlobalScaleMatrix * m_Model;
+        m_Model = m_GlobalScaleMatrix * m_Model;
         glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
         glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
         CHECK_GL_ERROR();
@@ -1952,7 +1952,8 @@ void OpenGL3DRenderer::GetBatchMiddleInfo(const Extrude3DInfo &extrude3D)
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
         m_Model = aTranslationMatrix * extrude3D.rotation * scale;
     }
-    m_Model =m_GlobalScaleMatrix * m_Model;
+
+    m_Model = m_GlobalScaleMatrix * m_Model;
     glm::mat3 normalMatrix(m_Model);
     glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
     m_BarSurface[MIDDLE_SURFACE].modelMatrixList.push_back(m_Model);
@@ -1987,7 +1988,8 @@ void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
         glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
         m_Model = aTranslationMatrix * extrude3D.rotation * topTrans * topScale * orgTrans;
     }
-    m_Model =m_GlobalScaleMatrix * m_Model;
+
+    m_Model = m_GlobalScaleMatrix * m_Model;
     glm::mat3 normalMatrix(m_Model);
     glm::mat3 normalInverseTranspos = glm::inverseTranspose(normalMatrix);
     m_BarSurface[TOP_SURFACE].modelMatrixList.push_back(m_Model);
@@ -1997,7 +1999,7 @@ void OpenGL3DRenderer::GetBatchTopAndFlatInfo(const Extrude3DInfo &extrude3D)
     glm::mat4 aTranslationMatrix = glm::translate(glm::vec3(trans.x, trans.y, trans.z));
     glm::mat4 flatScale = glm::scale(glm::vec3(xyScale, xyScale, xyScale));
     m_Model = aTranslationMatrix * extrude3D.rotation * flatScale;
-    m_Model =m_GlobalScaleMatrix * m_Model;
+    m_Model = m_GlobalScaleMatrix * m_Model;
     normalMatrix = glm::mat3(m_Model);
     normalInverseTranspos = glm::inverseTranspose(normalMatrix);
 
commit 4444e6cf7979b646d655c438c5f7c16fd4e7bcdc
Author: weigao <weigao at multicorewareinc.com>
Date:   Tue Jun 17 23:29:09 2014 -0700

    fix the using 3.0 version bug
    
    Change-Id: Ie197d0156a2d8b54fe6b08a905d82a63d31513f2

diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 2fc70f9..8f6bc27 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -195,7 +195,6 @@ void OpenGL3DRenderer::CheckGLSLVersion()
     if (iVersion > 3)
     {
         maResources.m_b330Support = true;
-        maResources.m_b330Support = false;
         return;
     }
     p++;
commit c7d390bf21623c148ff5c3955561b903d9581da8
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 03:20:20 2014 +0200

    remove old comment
    
    Change-Id: I427b408f898b4f4697f460a61fc306f65d68e12a

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 1de3a3a..d61162a 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -111,11 +111,6 @@ void GL3DBarChart::create3DShapes(const boost::ptr_vector<VDataSeries>& rDataSer
     // Each series of data flows from left to right, and multiple series are
     // stacked vertically along y axis.
 
-    // NOTE: These objects are created and positioned in a totally blind
-    // fashion since we don't even have a way to see them on screen.  So, no
-    // guarantee they are positioned correctly.  In fact, they are guaranteed
-    // to be positioned incorrectly.
-
     sal_uInt32 nId = 1;
     float nXEnd = 0.0;
     float nYPos = 0.0;
commit d3e15ac8df0d6a2bc634686c1f2993f5abbd9451
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Jun 21 03:19:42 2014 +0200

    add disabled code for square bars
    
    Change-Id: I4b315d9a4a6fb384eaec4d58c53291e473fb6d85

diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 29a6fbd..1de3a3a 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -70,8 +70,13 @@ const size_t STEPS = 200;
 const sal_uLong TIMEOUT = 5;
 const sal_uInt32 ID_STEP = 10;
 
+#if 0
+const float BAR_SIZE_X = 15.0f;
+const float BAR_SIZE_Y = 15.0f;
+#else
 const float BAR_SIZE_X = 30.0f;
 const float BAR_SIZE_Y = 5.0f;
+#endif
 const float BAR_DISTANCE_X = 5.0f;
 const float BAR_DISTANCE_Y = 5.0;
 
commit 0c7c8aa5f690a4e751076a774feffcf6f95769f7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Fri Jun 20 22:13:56 2014 +0200

    prevent invalid memory access
    
    e.g. fdo26139-1.pdf
    
    Change-Id: Ic5854e2056c246d48e2962dfe0a91f67c2c30c04

diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index 08519a5..c60a141 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -553,7 +553,7 @@ void Parser::parseFontFamilyName( FontAttributes& rResult )
             nLen -= nAttribLen;
             pCopy += nAttribLen;
         }
-        else
+        else if(nLen > 0)
         {
             if( *pCopy != '-' )
                 aNewFamilyName.append( *pCopy );


More information about the Libreoffice-commits mailing list