[Libreoffice-commits] core.git: include/svtools sc/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Feb 16 18:51:33 UTC 2018


 include/svtools/grfmgr.hxx                 |    1 
 sc/source/ui/sidebar/CellBorderUpdater.cxx |   99 ++++++-----------------------
 2 files changed, 22 insertions(+), 78 deletions(-)

New commits:
commit fe96d07621f75e6e5a106407c8ef80ace1b7f137
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Feb 16 13:32:47 2018 +0200

    move CellBorderUpdater bitmap update to VirtualDevice
    
    part of the process of making Bitmap an internal detail of vcl/
    
    and remove last outside-of-vcl use of BitmapWriteAccess from
    header file.
    
    Change-Id: I59a4353e11f881d24a7be50cf0f91f4f0dcffcaa
    Reviewed-on: https://gerrit.libreoffice.org/49850
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svtools/grfmgr.hxx b/include/svtools/grfmgr.hxx
index 84e60975891f..f4a9d88244b2 100644
--- a/include/svtools/grfmgr.hxx
+++ b/include/svtools/grfmgr.hxx
@@ -74,7 +74,6 @@ enum class GraphicDrawMode
 
 class GraphicManager;
 class SvStream;
-class BitmapWriteAccess;
 class GraphicCache;
 class VirtualDevice;
 struct GrfSimpleCacheObj;
diff --git a/sc/source/ui/sidebar/CellBorderUpdater.cxx b/sc/source/ui/sidebar/CellBorderUpdater.cxx
index 64912d6f3898..cc7edb54d63a 100644
--- a/sc/source/ui/sidebar/CellBorderUpdater.cxx
+++ b/sc/source/ui/sidebar/CellBorderUpdater.cxx
@@ -18,7 +18,7 @@
  */
 
 #include "CellBorderUpdater.hxx"
-#include <vcl/bitmapaccess.hxx>
+#include <vcl/virdev.hxx>
 #include <vcl/svapp.hxx>
 #include <vcl/settings.hxx>
 
@@ -38,85 +38,30 @@ CellBorderUpdater::~CellBorderUpdater()
 
 void CellBorderUpdater::UpdateCellBorder(bool bTop, bool bBot, bool bLeft, bool bRight, Image const & aImg, bool bVer, bool bHor)
 {
-    BitmapEx            aBmpEx( aImg.GetBitmapEx() );
-    Bitmap              aBmp( aBmpEx.GetBitmap() );
-    BitmapWriteAccess*  pBmpAcc = aBmp.AcquireWriteAccess();
-    const Size aBmpSize = aBmp.GetSizePixel();
+    const Size aBmpSize = aImg.GetBitmapEx().GetSizePixel();
+    if(aBmpSize.Width() != 43 || aBmpSize.Height() != 43)
+        return;
 
-    if( pBmpAcc )
-    {
-        Bitmap              aMsk;
-        BitmapWriteAccess*  pMskAcc;
+    ScopedVclPtr<VirtualDevice> pVirDev(VclPtr<VirtualDevice>::Create());
+    pVirDev->SetOutputSizePixel(aBmpSize);
+    pVirDev->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
+    pVirDev->SetFillColor( COL_BLACK);
 
-        if( aBmpEx.IsAlpha() )
-            pMskAcc = ( aMsk = aBmpEx.GetAlpha().GetBitmap() ).AcquireWriteAccess();
-        else if( aBmpEx.IsTransparent() )
-            pMskAcc = ( aMsk = aBmpEx.GetMask() ).AcquireWriteAccess();
-        else
-            pMskAcc = nullptr;
+    Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41);
+    if(bLeft)
+        pVirDev->DrawLine( aTL,aBL );
+    if(bRight)
+        pVirDev->DrawLine( aTR,aBR );
+    if(bTop)
+        pVirDev->DrawLine( aTL,aTR );
+    if(bBot)
+        pVirDev->DrawLine( aBL,aBR );
+    if(bVer)
+        pVirDev->DrawLine( aVT,aVB );
+    if(bHor)
+        pVirDev->DrawLine( aHL,aHR );
 
-        pBmpAcc->SetLineColor( ::Application::GetSettings().GetStyleSettings().GetFieldTextColor() ) ;
-        pBmpAcc->SetFillColor( COL_BLACK);
-
-        if(aBmpSize.Width() == 43 && aBmpSize.Height() == 43)
-        {
-            Point aTL(2, 1), aTR(42,1), aBL(2, 41), aBR(42, 41), aHL(2,21), aHR(42, 21), aVT(22,1), aVB(22, 41);
-            if( pMskAcc )
-            {
-                pMskAcc->SetLineColor( COL_BLACK );
-                pMskAcc->SetFillColor( COL_BLACK );
-            }
-            if(bLeft)
-            {
-                pBmpAcc->DrawLine( aTL,aBL );
-                if( pMskAcc )
-                    pMskAcc->DrawLine( aTL,aBL );
-            }
-            if(bRight)
-            {
-                pBmpAcc->DrawLine( aTR,aBR );
-                if( pMskAcc )
-                    pMskAcc->DrawLine( aTR,aBR );
-            }
-            if(bTop)
-            {
-                pBmpAcc->DrawLine( aTL,aTR );
-                if( pMskAcc )
-                    pMskAcc->DrawLine( aTL,aTR );
-            }
-            if(bBot)
-            {
-                pBmpAcc->DrawLine( aBL,aBR );
-                if( pMskAcc )
-                    pMskAcc->DrawLine( aBL,aBR );
-            }
-            if(bVer)
-            {
-                pBmpAcc->DrawLine( aVT,aVB );
-                if( pMskAcc )
-                    pMskAcc->DrawLine( aVT,aVB );
-            }
-            if(bHor)
-            {
-                pBmpAcc->DrawLine( aHL,aHR );
-                if( pMskAcc )
-                    pMskAcc->DrawLine( aHL,aHR );
-            }
-        }
-
-        Bitmap::ReleaseAccess( pBmpAcc );
-        if( pMskAcc )
-                Bitmap::ReleaseAccess( pMskAcc );
-
-        if( aBmpEx.IsAlpha() )
-            aBmpEx = BitmapEx( aBmp, AlphaMask( aMsk ) );
-        else if( aBmpEx.IsTransparent() )
-            aBmpEx = BitmapEx( aBmp, aMsk );
-        else
-            aBmpEx = aBmp;
-
-        mrTbx.SetItemImage( mnBtnId, Image( aBmpEx ) );
-    }
+    mrTbx.SetItemOverlayImage( mnBtnId, Image( pVirDev->GetBitmapEx(Point(0,0), aBmpSize) ) );
 }
 
 } } // end of namespace svx::sidebar


More information about the Libreoffice-commits mailing list