chart2/source/view/main/DummyXShape.cxx | 13 +++++++++++-- chart2/source/view/main/OpenGLRender.cxx | 24 ++++++++++++++++++++++++ chart2/source/view/main/OpenGLRender.hxx | 2 -- 3 files changed, 35 insertions(+), 4 deletions(-)
New commits: commit 0b2637dda47690da69f748119081151f41fe4133 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Tue Mar 4 21:33:17 2014 +0100 remove mfAlpha again The concept with separate alpha will result in nasty alpha bugs. Change-Id: I9c18d2a850aeed2bf14f43d247029204013d3c93 diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 036b306..493eb83 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -505,21 +505,23 @@ void DummyCircle::render() SAL_WARN("chart2.opengl", "render DummyCircle"); debugProperties(maProperties); DummyChart* pChart = getRootShape(); - std::map<OUString, uno::Any>::const_iterator itr = maProperties.find("FillColor"); + + sal_uInt8 nAlpha = 255; + std::map<OUString, uno::Any>::const_iterator itr = maProperties.find("FillTransparence"); if(itr != maProperties.end()) { - sal_Int32 nColor = itr->second.get<sal_Int32>(); - pChart->m_GLRender.SetColor(nColor, 255); + sal_Int32 nTrans = itr->second.get<sal_Int32>(); + nAlpha = static_cast<sal_uInt8>(nTrans & 0xFF); } - else - SAL_WARN("chart2.opengl", "missing color"); - itr = maProperties.find("FillTransparence"); + itr = maProperties.find("FillColor"); if(itr != maProperties.end()) { - sal_Int32 nTrans = itr->second.get<sal_Int32>(); - pChart->m_GLRender.SetTransparency(nTrans&0xFF); + sal_Int32 nColor = itr->second.get<sal_Int32>(); + pChart->m_GLRender.SetColor(nColor, nAlpha); } + else + SAL_WARN("chart2.opengl", "missing color"); pChart->m_GLRender.Bubble2DShapePoint(maPosition.X, maPosition.Y, maSize.Width, maSize.Height); diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 396ac94..55ce9d5 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1552,11 +1552,7 @@ void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient) m_BackgroundColor[15] = 0.0; } } -void OpenGLRender::SetTransparency(sal_uInt32 transparency) -{ - m_fAlpha = (float)transparency / 255.0; - m_2DColor = glm::vec4(m_2DColor.r, m_2DColor.g, m_2DColor.b, m_fAlpha); -} + void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadius, double nAngleStart, double nAngleWidth) { double nAngleStep = 1; diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index ab1da1e..ca999e2 100755 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -191,7 +191,6 @@ public: #endif void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha); - void SetTransparency(sal_uInt32 transparency); private: GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName); int CreateTextureObj(int width, int height); @@ -294,7 +293,6 @@ private: GLuint m_DebugVertexID; GLuint m_DebugColorID; #endif - float m_fAlpha; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 1c8fb3bd1137c1ab922b840bef5748abbbe6531e Author: Peilin <pei...@multicorewareinc.com> Date: Mon Mar 3 16:15:29 2014 +0800 add black bubble edge and modify transparence Change-Id: If18e74c2cec00d29bddaffbbd21991749490493a diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 8d4ac25..036b306 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -514,6 +514,13 @@ void DummyCircle::render() else SAL_WARN("chart2.opengl", "missing color"); + itr = maProperties.find("FillTransparence"); + if(itr != maProperties.end()) + { + sal_Int32 nTrans = itr->second.get<sal_Int32>(); + pChart->m_GLRender.SetTransparency(nTrans&0xFF); + } + pChart->m_GLRender.Bubble2DShapePoint(maPosition.X, maPosition.Y, maSize.Width, maSize.Height); pChart->m_GLRender.RenderBubble2FBO(GL_TRUE); diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index bf7bcdd..396ac94 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1044,6 +1044,7 @@ int OpenGLRender::Bubble2DShapePoint(float x, float y, float directionX, float d int OpenGLRender::RenderBubble2FBO(int) { CHECK_GL_ERROR(); + glm::vec4 edgeColor = glm::vec4(0.0, 0.0, 0.0, 1.0); size_t listNum = m_Bubble2DShapePointList.size(); for (size_t i = 0; i < listNum; i++) { @@ -1082,7 +1083,30 @@ int OpenGLRender::RenderBubble2FBO(int) glDrawArrays(GL_TRIANGLE_FAN, 0, m_Bubble2DCircle.size() / 2); glDisableVertexAttribArray(m_2DVertexID); glUseProgram(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); + //add black edge + glLineWidth(3.0); + glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); + glBufferData(GL_ARRAY_BUFFER, m_Bubble2DCircle.size() * sizeof(GLfloat) -2 , &m_Bubble2DCircle[2], GL_STATIC_DRAW); + glUseProgram(m_CommonProID); + glUniform4fv(m_2DColorID, 1, &edgeColor[0]); + glUniformMatrix4fv(m_MatrixID, 1, GL_FALSE, &m_MVP[0][0]); + glEnableVertexAttribArray(m_2DVertexID); + glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer); + glVertexAttribPointer( + m_2DVertexID, // attribute. No particular reason for 0, but must match the layout in the shader. + 2, // size + GL_FLOAT, // type + GL_FALSE, // normalized? + 0, // stride + (void*)0 // array buffer offset + ); + glDrawArrays(GL_LINE_STRIP, 0, (m_Bubble2DCircle.size() * sizeof(GLfloat) -2) / sizeof(float) / 2); + glDisableVertexAttribArray(m_2DVertexID); + glUseProgram(0); + glBindBuffer(GL_ARRAY_BUFFER, 0); m_Bubble2DShapePointList.pop_front(); + glLineWidth(m_fLineWidth); } //if use MSAA, we should copy the data to the FBO texture GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER); @@ -1528,7 +1552,11 @@ void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient) m_BackgroundColor[15] = 0.0; } } - +void OpenGLRender::SetTransparency(sal_uInt32 transparency) +{ + m_fAlpha = (float)transparency / 255.0; + m_2DColor = glm::vec4(m_2DColor.r, m_2DColor.g, m_2DColor.b, m_fAlpha); +} void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadius, double nAngleStart, double nAngleWidth) { double nAngleStep = 1; diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 09e0778..ab1da1e 100755 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -191,7 +191,7 @@ public: #endif void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha); - + void SetTransparency(sal_uInt32 transparency); private: GLint LoadShaders(const OUString& rVertexShaderName, const OUString& rFragmentShaderName); int CreateTextureObj(int width, int height); @@ -294,7 +294,7 @@ private: GLuint m_DebugVertexID; GLuint m_DebugColorID; #endif - + float m_fAlpha; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits