[Libreoffice-commits] core.git: vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Wed Apr 9 08:32:52 PDT 2014


 vcl/source/gdi/outdev4.cxx |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 0156a3c3ce5359b19b05248801571a56d320c2a8
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Thu Apr 10 01:29:53 2014 +1000

    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

diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx
index b4b8041..1840797 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() )


More information about the Libreoffice-commits mailing list