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
This commit is contained in:
Chris Sherlock
2014-04-08 08:12:49 +10:00
parent 702d79a3f8
commit 97043e70ef
3 changed files with 24 additions and 70 deletions

View File

@@ -730,10 +730,6 @@ public:
SAL_DLLPRIVATE void ImplDrawBitmapEx ( const Point& rDestPt, const Size& rDestSize, SAL_DLLPRIVATE void ImplDrawBitmapEx ( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Point& rSrcPtPixel, const Size& rSrcSizePixel,
const BitmapEx& rBitmapEx, const sal_uLong nAction ); 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, SAL_DLLPRIVATE void ImplDrawAlpha ( const Bitmap& rBmp, const AlphaMask& rAlpha,
const Point& rDestPt, const Size& rDestSize, const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel ); const Point& rSrcPtPixel, const Size& rSrcSizePixel );
@@ -1104,7 +1100,8 @@ public:
const Bitmap& rBitmap, const Color& rMaskColor ); const Bitmap& rBitmap, const Color& rMaskColor );
void DrawMask( const Point& rDestPt, const Size& rDestSize, void DrawMask( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel, 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, void DrawImage( const Point& rPos,
const Image& rImage, sal_uInt16 nStyle = 0 ); const Image& rImage, sal_uInt16 nStyle = 0 );

View File

@@ -1917,7 +1917,7 @@ MetaMaskScalePartAction::MetaMaskScalePartAction( const Point& rDstPt, const Siz
void MetaMaskScalePartAction::Execute( OutputDevice* pOut ) 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() MetaAction* MetaMaskScalePartAction::Clone()

View File

@@ -1146,84 +1146,24 @@ void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize
void OutputDevice::DrawMask( const Point& rDestPt, void OutputDevice::DrawMask( const Point& rDestPt,
const Bitmap& rBitmap, const Color& rMaskColor ) const Bitmap& rBitmap, const Color& rMaskColor )
{ {
if( ImplIsRecordLayout() )
return;
const Size aSizePix( rBitmap.GetSizePixel() ); const Size aSizePix( rBitmap.GetSizePixel() );
ImplDrawMask( rDestPt, PixelToLogic( aSizePix ), Point(), aSizePix, rBitmap, rMaskColor, META_MASK_ACTION ); DrawMask( 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 ) );
}
} }
void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
const Bitmap& rBitmap, const Color& rMaskColor ) const Bitmap& rBitmap, const Color& rMaskColor )
{ {
if( ImplIsRecordLayout() ) DrawMask( rDestPt, rDestSize, Point(), rBitmap.GetSizePixel(), rBitmap, rMaskColor, META_MASKSCALE_ACTION );
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 ) );
}
} }
void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize, void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel, const Point& rSrcPtPixel, const Size& rSrcSizePixel,
const Bitmap& rBitmap, const Color& rMaskColor ) const Bitmap& rBitmap, const Color& rMaskColor,
const sal_uLong nAction )
{ {
if( ImplIsRecordLayout() ) if( ImplIsRecordLayout() )
return; 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 ) if( ROP_INVERT == meRasterOp )
{ {
DrawRect( Rectangle( rDestPt, rDestSize ) ); 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 namespace