[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - include/vcl vcl/source

Caolán McNamara caolanm at redhat.com
Wed Jan 7 11:28:46 PST 2015


 include/vcl/outdev.hxx         |    2 ++
 include/vcl/print.hxx          |    1 +
 vcl/source/gdi/print.cxx       |   10 ++++++++++
 vcl/source/outdev/gradient.cxx |   24 ++++++++++++++++++++----
 4 files changed, 33 insertions(+), 4 deletions(-)

New commits:
commit 3c3f77338ebfdc449cec2cd658bf07e99a765466
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jan 6 15:05:36 2015 +0000

    Resolves: fdo#82219 color graphics as black and white
    
    i.e. revert
    
    commit bb5c7d6a79309236d4f19bb2498f2e850f735a2f
    Date:   Sun Apr 13 01:42:27 2014 +1000
    
        fdo#38844 Reduce XOR clipping for gradients
    
        Removed XOR clipping version of ClipAndDrawGradientMetafile. Because it
        has been removed, the other version isn't really needed in it's own
        function so I've moved it back into DrawGradient.
    
        Change-Id: Ib1519a019061c8c71183db63e5c11681bcad4cc4
    
    (cherry picked from commit e2883ca86f747eb62d1fe9e9b8d115c689e3abd7)
    Reviewed-on: https://gerrit.libreoffice.org/13773
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>
    (cherry picked from commit 938deff2a1e5451fd5493520480ae3c9615af3f9)
    Signed-off-by: Michael Stahl <mstahl at redhat.com>
    
    Conflicts:
    	vcl/source/outdev/gradient.cxx
    
    Change-Id: Iff1cb48cb8fa6d29937cf228a57aea9e8072110c
    Reviewed-on: https://gerrit.libreoffice.org/13804
    Reviewed-by: David Tardon <dtardon at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 25bf4cf..3e98666 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1463,6 +1463,8 @@ protected:
     virtual void                EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
     void                        DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
 
+    virtual void                ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly );
+
 private:
 
     SAL_DLLPRIVATE bool         DrawTransparentNatively( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index 01c3430..bb79496 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -259,6 +259,7 @@ protected:
 
     virtual long                GetGradientStepCount( long nMinRect ) SAL_OVERRIDE;
     virtual bool                UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
+    virtual void                ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly ) SAL_OVERRIDE;
 
     void                        ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { };
 
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index e6e1e36..3464fb9 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -1812,6 +1812,16 @@ bool Printer::UsePolyPolygonForComplexGradient()
     return true;
 }
 
+void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly )
+{
+    const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
+
+    Push( PUSH_CLIPREGION );
+    IntersectClipRegion(Region(rPolyPoly));
+    DrawGradient( aBoundRect, rGradient );
+    Pop();
+}
+
 void Printer::InitFont() const
 {
     DBG_TESTSOLARMUTEX();
diff --git a/vcl/source/outdev/gradient.cxx b/vcl/source/outdev/gradient.cxx
index 1f2a26c..a782664 100644
--- a/vcl/source/outdev/gradient.cxx
+++ b/vcl/source/outdev/gradient.cxx
@@ -84,10 +84,8 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
                 mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) );
                 mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) );
 
-                Push( PUSH_CLIPREGION );
-                IntersectClipRegion(Region(rPolyPoly));
-                DrawGradient( aBoundRect, rGradient );
-                Pop();
+
+                ClipAndDrawGradientMetafile(rGradient, rPolyPoly);
 
                 mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) );
             }
@@ -162,6 +160,24 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
         mpAlphaVDev->DrawPolyPolygon( rPolyPoly );
 }
 
+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( aBoundRect, rGradient );
+    SetFillColor( COL_BLACK );
+    SetRasterOp( ROP_0 );
+    DrawPolyPolygon( rPolyPoly );
+    SetRasterOp( ROP_XOR );
+    DrawGradient( aBoundRect, rGradient );
+    Pop();
+    EnableOutput( bOldOutput );
+}
+
 namespace
 {
     inline sal_uInt8 GetGradientColorValue( long nValue )


More information about the Libreoffice-commits mailing list