From 97043e70ef96d1fe8f42eb352a97149f77b73ac6 Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Tue, 8 Apr 2014 08:12:49 +1000 Subject: Remove unnecessary ImplDrawMask function in OutputDevice Every DrawMask variant calls on a final DrawMask - we duplicate code and there is an unnecessary private ImplDrawMask function in OutputDevice. We should just forward calls to DrawMask. Change-Id: Ice24598e3a437ca51a047f6006acc5a66198ff22 --- include/vcl/outdev.hxx | 7 ++-- vcl/source/gdi/metaact.cxx | 2 +- vcl/source/gdi/outdev2.cxx | 85 ++++++++++++---------------------------------- 3 files changed, 24 insertions(+), 70 deletions(-) diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 6d60af5a4596..94805c709168 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -730,10 +730,6 @@ public: SAL_DLLPRIVATE void ImplDrawBitmapEx ( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, const BitmapEx& rBitmapEx, const sal_uLong nAction ); - SAL_DLLPRIVATE void ImplDrawMask ( const Point& rDestPt, const Size& rDestSize, - const Point& rSrcPtPixel, const Size& rSrcSizePixel, - const Bitmap& rBitmap, const Color& rMaskColor, - const sal_uLong nAction ); SAL_DLLPRIVATE void ImplDrawAlpha ( const Bitmap& rBmp, const AlphaMask& rAlpha, const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel ); @@ -1104,7 +1100,8 @@ public: const Bitmap& rBitmap, const Color& rMaskColor ); void DrawMask( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, - const Bitmap& rBitmap, const Color& rMaskColor ); + const Bitmap& rBitmap, const Color& rMaskColor, + sal_uLong nAction ); void DrawImage( const Point& rPos, const Image& rImage, sal_uInt16 nStyle = 0 ); diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index e563a37168ac..5f52aad45187 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1917,7 +1917,7 @@ MetaMaskScalePartAction::MetaMaskScalePartAction( const Point& rDstPt, const Siz void MetaMaskScalePartAction::Execute( OutputDevice* pOut ) { - pOut->DrawMask( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp, maColor ); + pOut->DrawMask( maDstPt, maDstSz, maSrcPt, maSrcSz, maBmp, maColor, META_MASKSCALE_ACTION ); } MetaAction* MetaMaskScalePartAction::Clone() diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index dfbba665258e..daf4e2c5ac8b 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -1146,84 +1146,24 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize void OutputDevice::DrawMask( const Point& rDestPt, const Bitmap& rBitmap, const Color& rMaskColor ) { - if( ImplIsRecordLayout() ) - return; - const Size aSizePix( rBitmap.GetSizePixel() ); - ImplDrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, META_MASK_ACTION ); - - if( mpAlphaVDev ) - { - const Bitmap& rMask( rBitmap.CreateMask( rMaskColor ) ); - - // #i25167# Restrict mask painting to _opaque_ areas - // of the mask, otherwise we spoil areas where no - // bitmap content was ever visible. Interestingly - // enough, this can be achieved by taking the mask as - // the transparency mask of itself - mpAlphaVDev->DrawBitmapEx( rDestPt, - PixelToLogic( aSizePix ), - BitmapEx( rMask, rMask ) ); - } + DrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, META_MASK_ACTION ); } void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Bitmap& rBitmap, const Color& rMaskColor ) { - if( ImplIsRecordLayout() ) - return; - - ImplDrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, META_MASKSCALE_ACTION ); - - // TODO: Use mask here - if( mpAlphaVDev ) - { - const Bitmap& rMask( rBitmap.CreateMask( rMaskColor ) ); - - // #i25167# Restrict mask painting to _opaque_ areas - // of the mask, otherwise we spoil areas where no - // bitmap content was ever visible. Interestingly - // enough, this can be achieved by taking the mask as - // the transparency mask of itself - mpAlphaVDev->DrawBitmapEx( rDestPt, - rDestSize, - BitmapEx( rMask, rMask ) ); - } + DrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, META_MASKSCALE_ACTION ); } void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPtPixel, const Size& rSrcSizePixel, - const Bitmap& rBitmap, const Color& rMaskColor ) + const Bitmap& rBitmap, const Color& rMaskColor, + const sal_uLong nAction ) { if( ImplIsRecordLayout() ) return; - ImplDrawMask( rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel, rBitmap, rMaskColor, META_MASKSCALEPART_ACTION ); - - // TODO: Use mask here - if( mpAlphaVDev ) - { - const Bitmap& rMask( rBitmap.CreateMask( rMaskColor ) ); - - // #i25167# Restrict mask painting to _opaque_ areas - // of the mask, otherwise we spoil areas where no - // bitmap content was ever visible. Interestingly - // enough, this can be achieved by taking the mask as - // the transparency mask of itself - mpAlphaVDev->DrawBitmapEx( rDestPt, - rDestSize, - rSrcPtPixel, - rSrcSizePixel, - BitmapEx( rMask, rMask ) ); - } -} - -void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize, - const Point& rSrcPtPixel, const Size& rSrcSizePixel, - const Bitmap& rBitmap, const Color& rMaskColor, - const sal_uLong nAction ) -{ - if( ROP_INVERT == meRasterOp ) { DrawRect( Rectangle( rDestPt, rDestSize ) ); @@ -1293,6 +1233,23 @@ void OutputDevice::ImplDrawMask( const Point& rDestPt, const Size& rDestSize, } } + + // TODO: Use mask here + if( mpAlphaVDev ) + { + const Bitmap& rMask( rBitmap.CreateMask( rMaskColor ) ); + + // #i25167# Restrict mask painting to _opaque_ areas + // of the mask, otherwise we spoil areas where no + // bitmap content was ever visible. Interestingly + // enough, this can be achieved by taking the mask as + // the transparency mask of itself + mpAlphaVDev->DrawBitmapEx( rDestPt, + rDestSize, + rSrcPtPixel, + rSrcSizePixel, + BitmapEx( rMask, rMask ) ); + } } namespace -- cgit