diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-10 01:29:53 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-10 01:29:53 +1000 |
commit | 0156a3c3ce5359b19b05248801571a56d320c2a8 (patch) | |
tree | 7f810bddc2c526411376ffb876a5573e0fd504b4 | |
parent | 8f61d6ca5d6de7615b1e8c10fde6feccc09f2779 (diff) |
Check if polygon is a rectangle when drawing gradient
DrawGradient should check to see if the polygon is a rectangle before
adding the gradient to the metafile. If it's a rectangle, we are
currently unnecessarily adding XGRAD_SEQ_(BEGIN|END) comment records.
Change-Id: I38aef322469f45403ed105d971d7e1d1441ba6a0
-rw-r--r-- | vcl/source/gdi/outdev4.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index b4b80413097e..184079781b79 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -862,12 +862,20 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly, if( mpMetaFile ) { - mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) ); - mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) ); + if ( rPolyPoly.IsRect() ) + { + const Rectangle aBoundRect( rPolyPoly.GetBoundRect() ); + mpMetaFile->AddAction( new MetaGradientAction( aBoundRect, aGradient ) ); + } + else + { + mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_BEGIN" ) ); + mpMetaFile->AddAction( new MetaGradientExAction( rPolyPoly, rGradient ) ); - ClipAndDrawGradientMetafile ( rGradient, rPolyPoly ); + ClipAndDrawGradientMetafile ( rGradient, rPolyPoly ); - mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) ); + mpMetaFile->AddAction( new MetaCommentAction( "XGRAD_SEQ_END" ) ); + } } if( !IsDeviceOutputNecessary() || ImplIsRecordLayout() ) |