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

Chris Sherlock chris.sherlock79 at gmail.com
Wed Apr 9 08:12:19 PDT 2014


 include/vcl/outdev.hxx     |    6 +++---
 include/vcl/print.hxx      |    2 +-
 vcl/source/gdi/outdev4.cxx |   32 ++++++++++++++++----------------
 vcl/source/gdi/print.cxx   |   10 +++++-----
 4 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 480157e58fe4fe6694c0459d3f9f009d1c0902bf
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Thu Apr 10 00:33:28 2014 +1000

    Remove unnecessary bound-box parameter from clipping functions
    
    The bounding rectangle actually comes from the polygon. Therefore, it's
    not needed. Removed from the following functions in OutputDevice, et al
    
    + ClipAndDrawGradient
    + XORClipAndDrawGradient
    + ClipAndDrawGradientMetafile
    
    Change-Id: I4a87edcddb8895871982f0448854e1c0854124bc

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 94805c7..3c10cbd 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -842,10 +842,10 @@ protected:
     void                        DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
 
     virtual void                ClipAndDrawGradientToBounds( Gradient &rGradient, const PolyPolygon &rPolyPoly );
-    void                        ClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect );
-    void                        XORClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect );
+    void                        ClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly );
+    void                        XORClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly );
 
-    virtual void                ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect );
+    virtual void                ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly );
 
 private:
     typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 723d734..1f9b6fd 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -275,7 +275,7 @@ public:
 protected:
     long                        ImplGetGradientStepCount( long nMinRect ) SAL_OVERRIDE;
     virtual void                ClipAndDrawGradientToBounds( Gradient &rGradient, const PolyPolygon &rPolyPoly ) SAL_OVERRIDE;
-    virtual void                ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect ) SAL_OVERRIDE;
+    virtual void                ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly ) SAL_OVERRIDE;
     virtual bool                UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
 
     void                        ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { };
diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx
index 0198b84..5b3032f 100644
--- a/vcl/source/gdi/outdev4.cxx
+++ b/vcl/source/gdi/outdev4.cxx
@@ -702,39 +702,40 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
     }
 }
 
-void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect )
+void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly )
 {
+    const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
     const bool  bOldOutput = IsOutputEnabled();
 
     EnableOutput( false );
     Push( PUSH_RASTEROP );
     SetRasterOp( ROP_XOR );
-    DrawGradient( rBoundRect, rGradient );
+    DrawGradient( aBoundRect, rGradient );
     SetFillColor( COL_BLACK );
     SetRasterOp( ROP_0 );
     DrawPolyPolygon( rPolyPoly );
     SetRasterOp( ROP_XOR );
-    DrawGradient( rBoundRect, rGradient );
+    DrawGradient( aBoundRect, rGradient );
     Pop();
     EnableOutput( bOldOutput );
 }
 
 void OutputDevice::ClipAndDrawGradientToBounds ( Gradient &rGradient, const PolyPolygon &rPolyPoly )
 {
-    const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
-
     if( ImplGetSVData()->maGDIData.mbNoXORClipping )
-        ClipAndDrawGradient ( rGradient, rPolyPoly, aBoundRect );
+        ClipAndDrawGradient ( rGradient, rPolyPoly );
     else
-        XORClipAndDrawGradient ( rGradient, rPolyPoly, aBoundRect );
+        XORClipAndDrawGradient ( rGradient, rPolyPoly );
 }
 
-void OutputDevice::ClipAndDrawGradient ( Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect )
+void OutputDevice::ClipAndDrawGradient ( Gradient &rGradient, const PolyPolygon &rPolyPoly )
 {
+    const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
+
     if( !Rectangle( PixelToLogic( Point() ), GetOutputSize() ).IsEmpty() )
     {
         // convert rectangle to pixels
-        Rectangle aRect( ImplLogicToDevicePixel( rBoundRect ) );
+        Rectangle aRect( ImplLogicToDevicePixel( aBoundRect ) );
         aRect.Justify();
 
         // do nothing if the rectangle is empty
@@ -772,13 +773,14 @@ void OutputDevice::ClipAndDrawGradient ( Gradient &rGradient, const PolyPolygon
     }
 }
 
-void OutputDevice::XORClipAndDrawGradient ( Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect )
+void OutputDevice::XORClipAndDrawGradient ( Gradient &rGradient, const PolyPolygon &rPolyPoly )
 {
     const PolyPolygon   aPolyPoly( LogicToPixel( rPolyPoly ) );
+    const Rectangle     aBoundRect( rPolyPoly.GetBoundRect() );
     Point aPoint;
     Rectangle           aDstRect( aPoint, GetOutputSizePixel() );
 
-    aDstRect.Intersection( rBoundRect );
+    aDstRect.Intersection( aBoundRect );
 
     ClipToPaintRegion( aDstRect );
 
@@ -810,12 +812,12 @@ void OutputDevice::XORClipAndDrawGradient ( Gradient &rGradient, const PolyPolyg
             pVDev->SetRasterOp( ROP_XOR );
             aVDevMap.SetOrigin( Point( -aDstRect.Left(), -aDstRect.Top() ) );
             pVDev->SetMapMode( aVDevMap );
-            pVDev->DrawGradient( rBoundRect, rGradient );
+            pVDev->DrawGradient( aBoundRect, rGradient );
             pVDev->SetFillColor( COL_BLACK );
             pVDev->SetRasterOp( ROP_0 );
             pVDev->DrawPolyPolygon( aPolyPoly );
             pVDev->SetRasterOp( ROP_XOR );
-            pVDev->DrawGradient( rBoundRect, rGradient );
+            pVDev->DrawGradient( aBoundRect, rGradient );
             aVDevMap.SetOrigin( Point() );
             pVDev->SetMapMode( aVDevMap );
             DrawOutDev( aDstRect.TopLeft(), aDstSize, Point(), aDstSize, *pVDev );
@@ -853,12 +855,10 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
 
         if( mpMetaFile )
         {
-            const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
-
             mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) );
             mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) );
 
-            ClipAndDrawGradientMetafile ( rGradient, rPolyPoly, aBoundRect );
+            ClipAndDrawGradientMetafile ( rGradient, rPolyPoly );
 
             mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) );
         }
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 774a82f..cb8d903 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1814,16 +1814,16 @@ bool Printer::UsePolyPolygonForComplexGradient()
 
 void Printer::ClipAndDrawGradientToBounds ( Gradient &rGradient, const PolyPolygon &rPolyPoly )
 {
-    const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
-
-    ClipAndDrawGradient ( rGradient, rPolyPoly, aBoundRect );
+    ClipAndDrawGradient ( rGradient, rPolyPoly );
 }
 
-void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly, const Rectangle &rBoundRect )
+void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly )
 {
+    const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
+
     Push( PUSH_CLIPREGION );
     IntersectClipRegion(Region(rPolyPoly));
-    DrawGradient( rBoundRect, rGradient );
+    DrawGradient( aBoundRect, rGradient );
     Pop();
 }
 


More information about the Libreoffice-commits mailing list