From c33d96aa8bbe94761b609215951a64e380856cac Mon Sep 17 00:00:00 2001 From: peilin Date: Mon, 17 Mar 2014 10:48:46 +0800 Subject: modify SetBackGroundColor to fix background color and gradients issue Change-Id: Ie2ffa39f6aad8df127e99109618a64fb0d32599e --- chart2/source/view/main/DummyXShape.cxx | 14 ++++---------- chart2/source/view/main/OpenGLRender.cxx | 10 +++++----- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index e0b5f21de765..bdec56519512 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -720,10 +720,11 @@ void DummyRectangle::render() } bool bFill = true; + drawing::FillStyle eStyle = drawing::FillStyle_NONE; itr = maProperties.find("FillStyle"); if(itr != maProperties.end()) { - drawing::FillStyle eStyle = itr->second.get(); + eStyle = itr->second.get(); if(eStyle == drawing::FillStyle_NONE) { bFill = false; @@ -735,15 +736,8 @@ void DummyRectangle::render() { uno::Any co = itr->second; sal_Int32 nColorValue = co.get(); - - itr = maProperties.find("FillTransparence"); - sal_uInt8 nAlpha = 255; - if(itr != maProperties.end()) - { - uno::Any al = itr->second; - nAlpha = 255 - al.get()/100.0*255; - } - pChart->m_GLRender.SetBackGroundColor(nColorValue, nColorValue, nAlpha); + //here FillStyle works for background color and gradients + pChart->m_GLRender.SetBackGroundColor(nColorValue, nColorValue, eStyle); } bool bBorder = true; diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 72e0c2776553..689925a7dfd2 100755 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -1304,7 +1304,7 @@ int OpenGLRender::RenderArea2DShape() return 0; } -void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 nAlpha) +void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_uInt8 fillStyle) { sal_uInt8 r = (color1 & 0x00FF0000) >> 16; sal_uInt8 g = (color1 & 0x0000FF00) >> 8; @@ -1313,12 +1313,12 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_ m_BackgroundColor[0] = (float)r / 255.0f; m_BackgroundColor[1] = (float)g / 255.0f; m_BackgroundColor[2] = (float)b / 255.0f; - m_BackgroundColor[3] = nAlpha / 255.0f; + m_BackgroundColor[3] = fillStyle ? 1.0 : 0.0; m_BackgroundColor[4] = (float)r / 255.0f; m_BackgroundColor[5] = (float)g / 255.0f; m_BackgroundColor[6] = (float)b / 255.0f; - m_BackgroundColor[7] = nAlpha / 255.0f; + m_BackgroundColor[7] = fillStyle ? 1.0 : 0.0; r = (color2 & 0x00FF0000) >> 16; g = (color2 & 0x0000FF00) >> 8; @@ -1327,12 +1327,12 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, sal_ m_BackgroundColor[8] = (float)r / 255.0f; m_BackgroundColor[9] = (float)g / 255.0f; m_BackgroundColor[10] = (float)b / 255.0f; - m_BackgroundColor[11] = nAlpha / 255.0f; + m_BackgroundColor[11] = fillStyle ? 1.0 : 0.0; m_BackgroundColor[12] = (float)r / 255.0f; m_BackgroundColor[13] = (float)g / 255.0f; m_BackgroundColor[14] = (float)b / 255.0f; - m_BackgroundColor[15] = nAlpha / 255.0f; + m_BackgroundColor[15] = fillStyle ? 1.0 : 0.0; SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2); } -- cgit