summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-06 15:05:36 +0000
committerDavid Tardon <dtardon@redhat.com>2015-01-07 17:16:07 +0000
commit938deff2a1e5451fd5493520480ae3c9615af3f9 (patch)
tree4738a049bdae0015386e5f809da144c27a5fffff
parentbe2018f23f7886510316878647f5311a378cca1a (diff)
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 Change-Id: Iff1cb48cb8fa6d29937cf228a57aea9e8072110c (cherry picked from commit e2883ca86f747eb62d1fe9e9b8d115c689e3abd7) Reviewed-on: https://gerrit.libreoffice.org/13773 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r--include/vcl/outdev.hxx2
-rw-r--r--include/vcl/print.hxx1
-rw-r--r--vcl/source/gdi/print.cxx10
-rw-r--r--vcl/source/outdev/gradient.cxx23
4 files changed, 32 insertions, 4 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 3b7a00dbb5e1..806e50174647 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1515,6 +1515,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 99d781e60f30..b4b6e8c22a23 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 f6dd207f679f..b23e529387ce 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" ) );
}