diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-03-15 02:08:55 +1100 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2014-03-22 05:32:17 +0000 |
commit | 0eb7070e767fd395cf2c8fbb83707e2efda2bf01 (patch) | |
tree | d1616d6bc229aaf73ee073028b912e0b4469bc48 | |
parent | d4855da9e9718b31b371376ee8a469e9e26495af (diff) |
fdo#74702 DrawOutDev() and CopyArea() functions now noops in Printer
DrawOutDev() and CopyArea() functions now assert when called from a
Printer instance. This has allowed the removal of meOutDevType, which
I hope to eventually completely eradicate from LO.
I've also included DrawOutDev(...) which holds a parameter with a
reference to a Printer object. This shouldn't be possible, so it
asserts.
Change-Id: Iabee853ca7c8bfc99349da086d1944ee13210a2e
Reviewed-on: https://gerrit.libreoffice.org/8592
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
-rw-r--r-- | include/vcl/outdev.hxx | 9 | ||||
-rw-r--r-- | include/vcl/print.hxx | 10 | ||||
-rw-r--r-- | vcl/source/gdi/outdev2.cxx | 31 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 36 |
4 files changed, 67 insertions, 19 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 76f6011f3b59..e82cb1ddb94d 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1028,12 +1028,15 @@ public: void DrawChord( const Rectangle& rRect, const Point& rStartPt, const Point& rEndPt ); - void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize ); - void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize, const OutputDevice& rOutDev ); - void CopyArea( const Point& rDestPt, + void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize, + const Printer& rOutDev ); + virtual void CopyArea( const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize, sal_uInt16 nFlags = 0 ); protected: diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 287152171b43..93deb72e9726 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -393,6 +393,16 @@ public: virtual bool HasMirroredGraphics() const; + virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize ); + virtual void DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize, + const OutputDevice& rOutDev ); + virtual void CopyArea( const Point& rDestPt, + const Point& rSrcPt, const Size& rSrcSize, + sal_uInt16 nFlags = 0 ); + + // implementation detail of PrintJob being asynchronous // not exported, not usable outside vcl static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, diff --git a/vcl/source/gdi/outdev2.cxx b/vcl/source/gdi/outdev2.cxx index 4d2cf6dce91a..1e1671f3baa3 100644 --- a/vcl/source/gdi/outdev2.cxx +++ b/vcl/source/gdi/outdev2.cxx @@ -224,14 +224,9 @@ void OutputDevice::ImplDrawOutDevDirect( const OutputDevice* pSrcDev, SalTwoRect void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize ) { - DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); - if( ImplIsRecordLayout() ) return; - if ( meOutDevType == OUTDEV_PRINTER ) - return; - if ( ROP_INVERT == meRasterOp ) { DrawRect( Rectangle( rDestPt, rDestSize ) ); @@ -276,10 +271,7 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, const Point& rSrcPt, const Size& rSrcSize, const OutputDevice& rOutDev ) { - DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); - DBG_ASSERT( rOutDev.meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); - - if ( (meOutDevType == OUTDEV_PRINTER) || (rOutDev.meOutDevType == OUTDEV_PRINTER) || ImplIsRecordLayout() ) + if ( ImplIsRecordLayout() ) return; if ( ROP_INVERT == meRasterOp ) @@ -312,10 +304,6 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, { // alpha-blend source over destination DrawBitmapEx( rDestPt, rDestSize, rOutDev.GetBitmapEx(rSrcPt, rSrcSize) ); - - // This would be mode SOURCE: - // copy source alpha channel to our alpha channel - //mpAlphaVDev->DrawOutDev( rDestPt, rDestSize, rSrcPt, rSrcSize, *rOutDev.mpAlphaVDev ); } else { @@ -340,13 +328,24 @@ void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, } } +void OutputDevice::DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize, + const Printer& rOutDev ) +{ + (void) rDestPt; + (void) rDestSize; + (void) rSrcPt; + (void) rSrcSize; + + // This should never occur! You can't call this function on a Printer instance + DBG_ASSERT( false, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); +} + void OutputDevice::CopyArea( const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize, sal_uInt16 nFlags ) { - DBG_ASSERT( meOutDevType != OUTDEV_PRINTER, "Don't use OutputDevice::CopyArea(...) with printer devices!" ); - - if ( meOutDevType == OUTDEV_PRINTER || ImplIsRecordLayout() ) + if ( ImplIsRecordLayout() ) return; RasterOp eOldRop = GetRasterOp(); diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx index 78d7eb5813e4..c5d1961eea16 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -234,6 +234,42 @@ bool Printer::TransformReduceBitmapExTargetRange( return true; } +void Printer::DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize ) +{ + (void) rDestPt; + (void) rDestSize; + (void) rSrcPt; + (void) rSrcSize; + + DBG_ASSERT( false, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); +} + +void Printer::DrawOutDev( const Point& rDestPt, const Size& rDestSize, + const Point& rSrcPt, const Size& rSrcSize, + const OutputDevice& rOutDev ) +{ + (void) rDestPt; + (void) rDestSize; + (void) rSrcPt; + (void) rSrcSize; + (void) rOutDev; + + DBG_ASSERT( false, "Don't use OutputDevice::DrawOutDev(...) with printer devices!" ); +} + +void Printer::CopyArea( const Point& rDestPt, + const Point& rSrcPt, const Size& rSrcSize, + sal_uInt16 nFlags ) +{ + (void) rDestPt; + (void) rSrcPt; + (void) rSrcSize; + (void) nFlags; + + DBG_ASSERT( false, "Don't use OutputDevice::CopyArea(...) with printer devices!" ); +} + void Printer::SetPrinterOptions( const PrinterOptions& i_rOptions ) { *mpPrinterOptions = i_rOptions; |