From bc3625fce46e3e4529b2eb7daabc5c66d7b1cbcc Mon Sep 17 00:00:00 2001 From: Chris Sherlock Date: Thu, 17 Apr 2014 02:56:10 +1000 Subject: [PATCH] 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 --- include/vcl/outdev.hxx | 6 +++--- include/vcl/print.hxx | 6 +++--- vcl/source/gdi/print.cxx | 6 +++--- vcl/source/outdev/mask.cxx | 28 +++++++++++----------------- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 420fe444a0ce..3034fb37b529 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -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; diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 6309f127d2b3..23c656df0f40 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -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, diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 7adfcdef8bce..d25a28e5dde4 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -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 ) ); diff --git a/vcl/source/outdev/mask.cxx b/vcl/source/outdev/mask.cxx index f8562b2df3ab..20f97d356e86 100644 --- a/vcl/source/outdev/mask.cxx +++ b/vcl/source/outdev/mask.cxx @@ -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: */