diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-16 13:32:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-02-16 19:51:05 +0100 |
commit | fe96d07621f75e6e5a106407c8ef80ace1b7f137 (patch) | |
tree | 2c282c165e93ad7fe259e63dda4d249882bbc90e | |
parent | bddd6c77811e0489a5632437116f5eec356cc397 (diff) |
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@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/svtools/grfmgr.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/sidebar/CellBorderUpdater.cxx | 99 |
2 files changed, 22 insertions, 78 deletions
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 |