fdo#74702 Move common mask functionality to ApplyMask

There is code in OutputDevice that essentially carries out the same
functionality as ImplPrintMask, but for VirtualDevice and Window
instances. Therefore, renamed ImplPrintMask to ApplyMask and moved
OutputDevice functionality into new protected function ApplyMask.

Change-Id: Ia88469e9b149f7819dfc538ecbe014198e4534f6
This commit is contained in:
Chris Sherlock 2014-04-17 02:56:10 +10:00
parent c1bc990aa5
commit bc3625fce4
4 changed files with 20 additions and 26 deletions

View File

@ -848,9 +848,9 @@ public:
protected:
OutputDevice();
virtual void ImplPrintMask ( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel );
virtual void ApplyMask ( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel );
virtual bool UsePolyPolygonForComplexGradient() = 0;

View File

@ -283,9 +283,9 @@ protected:
void SetSelfAsQueuePrinter( bool bQueuePrinter ) { mbIsQueuePrinter = bQueuePrinter; }
bool IsQueuePrinter() const { return mbIsQueuePrinter; }
virtual void ImplPrintMask ( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel ) SAL_OVERRIDE;
virtual void ApplyMask ( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel ) SAL_OVERRIDE;
bool DrawTransformBitmapExDirect(
const basegfx::B2DHomMatrix& aFullTransform,

View File

@ -801,9 +801,9 @@ void Printer::ImplInitDisplay( const Window* pWindow )
mnDPIY = mpDisplayDev->mnDPIY;
}
void Printer::ImplPrintMask( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
void Printer::ApplyMask( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
{
Point aPt;
Point aDestPt( LogicToPixel( rDestPt ) );

View File

@ -96,13 +96,15 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
OUTDEV_INIT();
if ( OUTDEV_PRINTER == meOutDevType )
{
ImplPrintMask( rBitmap, rMaskColor, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
return;
}
ApplyMask( rBitmap, rMaskColor, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
const ImpBitmap* pImpBmp = rBitmap.ImplGetImpBitmap();
}
void OutputDevice::ApplyMask( const Bitmap& rMask, const Color& rMaskColor,
const Point& rDestPt, const Size& rDestSize,
const Point& rSrcPtPixel, const Size& rSrcSizePixel )
{
const ImpBitmap* pImpBmp = rMask.ImplGetImpBitmap();
if ( pImpBmp )
{
SalTwoRect aPosAry;
@ -125,7 +127,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
if( nMirrFlags )
{
Bitmap aTmp( rBitmap );
Bitmap aTmp( rMask );
aTmp.Mirror( nMirrFlags );
mpGraphics->DrawMask( aPosAry, *aTmp.ImplGetImpBitmap()->ImplGetSalBitmap(),
ImplColorToSal( rMaskColor ) , this);
@ -140,7 +142,7 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
// TODO: Use mask here
if( mpAlphaVDev )
{
const Bitmap& rMask( rBitmap.CreateMask( rMaskColor ) );
const Bitmap& rAlphaMask( rMask.CreateMask( rMaskColor ) );
// #i25167# Restrict mask painting to _opaque_ areas
// of the mask, otherwise we spoil areas where no
@ -151,16 +153,8 @@ void OutputDevice::DrawMask( const Point& rDestPt, const Size& rDestSize,
rDestSize,
rSrcPtPixel,
rSrcSizePixel,
BitmapEx( rMask, rMask ) );
BitmapEx( rAlphaMask, rMask ) );
}
}
void OutputDevice::ImplPrintMask( const Bitmap& /*rMask*/, const Color& /*rMaskColor*/,
const Point& /*rDestPt*/, const Size& /*rDestSize*/,
const Point& /*rSrcPtPixel*/, const Size& /*rSrcSizePixel*/ )
{
// let's leave this for Printer
return;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */