[Libreoffice-commits] core.git: include/vcl vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Fri Mar 21 22:32:45 PDT 2014


 include/vcl/outdev.hxx     |    9 ++++++---
 include/vcl/print.hxx      |   10 ++++++++++
 vcl/source/gdi/outdev2.cxx |   31 +++++++++++++++----------------
 vcl/source/gdi/print.cxx   |   36 ++++++++++++++++++++++++++++++++++++
 4 files changed, 67 insertions(+), 19 deletions(-)

New commits:
commit 0eb7070e767fd395cf2c8fbb83707e2efda2bf01
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Sat Mar 15 02:08:55 2014 +1100

    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 at gmail.com>
    Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 76f6011..e82cb1d 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 2871521..93deb72 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 4d2cf6d..1e1671f 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 78d7eb5..c5d1961 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;


More information about the Libreoffice-commits mailing list