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

peilin peilin at multicorewareinc.com
Mon Mar 17 13:19:14 PDT 2014


 chart2/source/view/main/DummyXShape.cxx  |   14 ++++----------
 chart2/source/view/main/OpenGLRender.cxx |   10 +++++-----
 2 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit c33d96aa8bbe94761b609215951a64e380856cac
Author: peilin <peilin at multicorewareinc.com>
Date:   Mon Mar 17 10:48:46 2014 +0800

    modify SetBackGroundColor to fix background color and gradients issue
    
    Change-Id: Ie2ffa39f6aad8df127e99109618a64fb0d32599e

diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index e0b5f21..bdec565 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<drawing::FillStyle>();
+        eStyle = itr->second.get<drawing::FillStyle>();
         if(eStyle == drawing::FillStyle_NONE)
         {
             bFill = false;
@@ -735,15 +736,8 @@ void DummyRectangle::render()
     {
         uno::Any co =  itr->second;
         sal_Int32 nColorValue = co.get<sal_Int32>();
-
-        itr = maProperties.find("FillTransparence");
-        sal_uInt8 nAlpha = 255;
-        if(itr != maProperties.end())
-        {
-            uno::Any al = itr->second;
-            nAlpha = 255 - al.get<sal_Int32>()/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 72e0c27..689925a 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);
 
 }


More information about the Libreoffice-commits mailing list