diff options
-rw-r--r-- | include/vcl/outdev.hxx | 2 | ||||
-rw-r--r-- | include/vcl/print.hxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/print.cxx | 10 | ||||
-rw-r--r-- | vcl/source/outdev/gradient.cxx | 23 |
4 files changed, 32 insertions, 4 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 23abb00c7023..0d363096086e 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -1511,6 +1511,8 @@ protected: virtual void EmulateDrawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ); void DrawInvisiblePolygon( const tools::PolyPolygon& rPolyPoly ); + virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly ); + private: SAL_DLLPRIVATE bool DrawTransparentNatively( const tools::PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ); diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 3a9ad1d3c236..242873c95dd1 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 tools::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 3fec08f330b0..fd23d197f64c 100644 --- a/vcl/source/gdi/print.cxx +++ b/vcl/source/gdi/print.cxx @@ -1813,6 +1813,16 @@ bool Printer::UsePolyPolygonForComplexGradient() return true; } +void Printer::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly ) +{ + const Rectangle aBoundRect( rPolyPoly.GetBoundRect() ); + + Push( PushFlags::CLIPREGION ); + IntersectClipRegion(vcl::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 8916e76825dd..7031103431bc 100644 --- a/vcl/source/outdev/gradient.cxx +++ b/vcl/source/outdev/gradient.cxx @@ -146,6 +146,24 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly, mpAlphaVDev->DrawPolyPolygon( rPolyPoly ); } +void OutputDevice::ClipAndDrawGradientMetafile ( const Gradient &rGradient, const tools::PolyPolygon &rPolyPoly ) +{ + const Rectangle aBoundRect( rPolyPoly.GetBoundRect() ); + const bool bOldOutput = IsOutputEnabled(); + + EnableOutput( false ); + Push( PushFlags::RASTEROP ); + SetRasterOp( ROP_XOR ); + DrawGradient( aBoundRect, rGradient ); + SetFillColor( COL_BLACK ); + SetRasterOp( ROP_0 ); + DrawPolyPolygon( rPolyPoly ); + SetRasterOp( ROP_XOR ); + DrawGradient( aBoundRect, rGradient ); + Pop(); + EnableOutput( bOldOutput ); +} + void OutputDevice::DrawGradientToMetafile ( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient ) { @@ -172,10 +190,7 @@ void OutputDevice::DrawGradientToMetafile ( const tools::PolyPolygon& rPolyPoly, mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) ); mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) ); - Push( PushFlags::CLIPREGION ); - IntersectClipRegion(vcl::Region(rPolyPoly)); - DrawGradient( aBoundRect, rGradient ); - Pop(); + ClipAndDrawGradientMetafile ( rGradient, rPolyPoly ); mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) ); } |