chart2/source/view/main/DummyXShape.cxx | 28 ++++++++++++++++++++++++++++ chart2/source/view/main/OpenGLRender.cxx | 22 ++++++++++++++-------- chart2/source/view/main/OpenGLRender.hxx | 4 +++- 3 files changed, 45 insertions(+), 9 deletions(-)
New commits: commit d021258df3c9f27cf285ab0097e79d5261bf5896 Author: Markus Mohrhard <[email protected]> Date: Thu Jan 9 21:10:04 2014 +0100 a bit more clean-up in the chart2 OpenGL code Change-Id: I0c30a9c8e2a9e0f199308523bbc5fc76c94307c7 diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 6218dc8..cf2a0fc 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -290,8 +290,8 @@ int static checkGLError(const char *file, int line) #define CHECK_GL_FRAME_BUFFER_STATUS() \ status = glCheckFramebufferStatus(GL_FRAMEBUFFER);\ if( status != GL_FRAMEBUFFER_COMPLETE ) {\ - printf(" error at line(%d) '%d'\n", __LINE__, status );\ - return -1;\ + SAL_WARN("chart2.opengl", "OpenGL error: " << status );\ + return -1;\ } GLint OpenGLRender::LoadShaders(const char *vertexShader,const char *fragmentShader) @@ -1038,7 +1038,7 @@ int OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) //create a temp windwo to check whether support multi-sample, if support, get the format if (InitTempWindow(&hWnd, m_iWidth, m_iHeight, pfd) < 0) { - printf("Can't create temp window to test\n"); + SAL_WARN("chart2.opengl", "Can't create temp window to test\n"); return false; } @@ -1046,7 +1046,7 @@ int OpenGLRender::InitMultisample(PIXELFORMATDESCRIPTOR pfd) if (!WGLisExtensionSupported("WGL_ARB_multisample")) { m_iArbMultisampleSupported = 0; - printf("Device doesn't support multi sample\n"); + SAL_WARN("chart2.opengl", "Device doesn't support multi sample\n"); return false; } // Get Our Pixel Format @@ -1678,7 +1678,7 @@ int OpenGLRender::RenderArea2DShape() return 0; } -void OpenGLRender::SetBackGroundColor(long color1, long color2) +void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2) { sal_uInt8 r = (color1 & 0x00FF0000) >> 16; sal_uInt8 g = (color1 & 0x0000FF00) >> 8; @@ -1707,7 +1707,7 @@ void OpenGLRender::SetBackGroundColor(long color1, long color2) m_BackgroundColor[13] = (float)g / 255.0f; m_BackgroundColor[14] = (float)b / 255.0f; m_BackgroundColor[15] = 1.0; - cout << "color1 = " << color1 << ", color2 = " << color2 << endl; + SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2); } void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient) diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index 87b6cde..0b79d99 100644 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -197,7 +197,7 @@ private: int WGLisExtensionSupported(const char *extension); int CreateMultiSampleFrameBufObj(); int Create2DCircle(int detail); - void SetBackGroundColor(long color1, long color2); + void SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2); private: // Projection matrix : default 45 degree Field of View, 4:3 ratio, display range : 0.1 unit <-> 100 units commit c818ad2ce69498dbf465d94705c7ec8f3b9e88a9 Author: Peilin <[email protected]> Date: Thu Jan 9 15:40:04 2014 +0800 Rectangle transparence gradient Change-Id: Ibca7039eee1c48d487928822e5a01455a07351fd diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 6e64f13..8d5910f 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -567,6 +567,18 @@ void DummyRectangle::render() sal_Int32 nColorValue = co.get<sal_Int32>(); pChart->m_GLRender.SetColor(nColorValue); } + + //TODO: moggi: correct handling of gradients + itr = maProperties.find("FillTransparenceGradientName"); + if (itr != maProperties.end()) + { + uno::Any co = itr->second; + rtl::OUString aGradientValue = co.get<rtl::OUString>(); + if (aGradientValue.endsWithAsciiL("1", 1)) + { + pChart->m_GLRender.SetChartTransparencyGradient(1); + } + } pChart->m_GLRender.RectangleShapePoint(maPosition.X, maPosition.Y, maSize.Width, maSize.Height); pChart->m_GLRender.RenderRectangleShape(); } diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index de98c00..6218dc8 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1710,5 +1710,12 @@ void OpenGLRender::SetBackGroundColor(long color1, long color2) cout << "color1 = " << color1 << ", color2 = " << color2 << endl; } - +void OpenGLRender::SetChartTransparencyGradient(long transparencyGradient) +{ + if (transparencyGradient == 1) + { + m_BackgroundColor[11] = 0.0; + m_BackgroundColor[15] = 0.0; + } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/view/main/OpenGLRender.hxx b/chart2/source/view/main/OpenGLRender.hxx index a65730b..87b6cde 100644 --- a/chart2/source/view/main/OpenGLRender.hxx +++ b/chart2/source/view/main/OpenGLRender.hxx @@ -182,6 +182,8 @@ public: int SetArea2DShapePoint(float x, float y, int listLength); int RenderArea2DShape(); + void SetChartTransparencyGradient(long transparencyGradient); + private: GLint LoadShaders(const char *vertexShader,const char *fragmentShader); int CreateTextureObj(int width, int height); commit ab515e7e39af0fb555ed5af9b0dc3db7784bd6a8 Author: Markus Mohrhard <[email protected]> Date: Thu Jan 9 21:00:32 2014 +0100 use UNO constants instead of magic numbers Change-Id: I7a38518783e57d3230301f94bf0831a73670385f diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 6d58976..6e64f13 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -513,7 +513,7 @@ void DummyLine2D::render() { uno::Any cow = itr->second; sal_Int32 nStyle = cow.get<sal_Int32>(); - if (0 == nStyle) + if (drawing::LineStyle_NONE == nStyle) { pChart->m_GLRender.SetTransparency(0); } commit 411c82edca1e6f830feeae98de2aa603d5b60907 Author: Peilin <[email protected]> Date: Thu Jan 9 15:24:36 2014 +0800 add Line2D style property Change-Id: I72d9426b6910205645bae2828ef14aaabad138c3 diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 2979189..6d58976 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -507,6 +507,22 @@ void DummyLine2D::render() else SAL_WARN("chart2.opengl", "no line width set"); + //add style and transparency + itr = maProperties.find(UNO_NAME_LINESTYLE); + if (itr != maProperties.end()) + { + uno::Any cow = itr->second; + sal_Int32 nStyle = cow.get<sal_Int32>(); + if (0 == nStyle) + { + pChart->m_GLRender.SetTransparency(0); + } + else + { + pChart->m_GLRender.SetTransparency(255); + } + } + sal_Int32 pointsscount = maPoints.getLength(); for(sal_Int32 i = 0; i < pointsscount; i++) { diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 73aedac..de98c00 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1711,5 +1711,4 @@ void OpenGLRender::SetBackGroundColor(long color1, long color2) } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
