Kaydet (Commit) bb5c7d6a authored tarafından Chris Sherlock's avatar Chris Sherlock

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
üst eb6bf90a
...@@ -841,9 +841,6 @@ protected: ...@@ -841,9 +841,6 @@ protected:
virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent ); virtual void EmulateDrawTransparent( const PolyPolygon& rPolyPoly, sal_uInt16 nTransparencePercent );
void DrawInvisiblePolygon( const PolyPolygon& rPolyPoly ); void DrawInvisiblePolygon( const PolyPolygon& rPolyPoly );
void ClipAndDrawGradient( Gradient &rGradient, const PolyPolygon &rPolyPoly );
virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly );
private: private:
typedef void ( OutputDevice::* FontUpdateHandler_t )( bool ); typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
......
...@@ -274,7 +274,6 @@ public: ...@@ -274,7 +274,6 @@ public:
protected: protected:
long ImplGetGradientStepCount( long nMinRect ) SAL_OVERRIDE; long ImplGetGradientStepCount( long nMinRect ) SAL_OVERRIDE;
virtual void ClipAndDrawGradientMetafile ( const Gradient &rGradient, const PolyPolygon &rPolyPoly ) SAL_OVERRIDE;
virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE; virtual bool UsePolyPolygonForComplexGradient() SAL_OVERRIDE;
void ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { }; void ScaleBitmap ( Bitmap&, SalTwoRect& ) SAL_OVERRIDE { };
......
...@@ -613,24 +613,6 @@ void OutputDevice::DrawGradient( const Rectangle& rRect, ...@@ -613,24 +613,6 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
DrawGradient ( aPolyPoly, rGradient ); DrawGradient ( aPolyPoly, rGradient );
} }
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 );
}
void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
const Gradient& rGradient ) const Gradient& rGradient )
{ {
...@@ -666,9 +648,10 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, ...@@ -666,9 +648,10 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
if( mpMetaFile ) if( mpMetaFile )
{ {
const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
if ( rPolyPoly.IsRect() ) if ( rPolyPoly.IsRect() )
{ {
const Rectangle aBoundRect( rPolyPoly.GetBoundRect() );
mpMetaFile->AddAction( new MetaGradientAction( aBoundRect, aGradient ) ); mpMetaFile->AddAction( new MetaGradientAction( aBoundRect, aGradient ) );
} }
else else
...@@ -676,7 +659,10 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, ...@@ -676,7 +659,10 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) ); mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) );
mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) ); mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) );
ClipAndDrawGradientMetafile ( rGradient, rPolyPoly ); Push( PUSH_CLIPREGION );
IntersectClipRegion(Region(rPolyPoly));
DrawGradient( aBoundRect, rGradient );
Pop();
mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) ); mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) );
} }
......
...@@ -1812,14 +1812,4 @@ bool Printer::UsePolyPolygonForComplexGradient() ...@@ -1812,14 +1812,4 @@ bool Printer::UsePolyPolygonForComplexGradient()
return true; 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();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment