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

Chris Sherlock chris.sherlock79 at gmail.com
Mon Apr 7 00:06:11 PDT 2014


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

New commits:
commit 97cfb1fe0163a9dc09734a761c56d149b8c61f4b
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Apr 7 15:14:52 2014 +1000

    DrawGradient( const PolyPolygon&... etc) gets graphics instance too early
    
    The OutputDevice::DrawGradient function that takes a PolyPolygon checks
    for a graphics instance far too early. It then checks it again when it
    actually needs it, but we really only need to get it once.
    
    Change-Id: I2426dfe2e5c03f0e8e3939b53b16c99afe637812

diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx
index 696c2f5..b84b8b8 100644
--- a/vcl/source/gdi/outdev4.cxx
+++ b/vcl/source/gdi/outdev4.cxx
@@ -812,10 +812,6 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
     if( mbOutputClipped )
         return;
 
-    if( !mpGraphics )
-        if( !ImplGetGraphics() )
-            return;
-
     if( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() )
     {
         if ( mnDrawMode & ( DRAWMODE_BLACKGRADIENT | DRAWMODE_WHITEGRADIENT | DRAWMODE_SETTINGSGRADIENT) )
commit 05fb3136904c8e6ff3a0c9d8c1c29ce904573d58
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Apr 7 14:57:04 2014 +1000

    Exit out of DrawGradient that uses PolyPolygon much faster
    
    There are two DrawGradient(...) functions in OutputDevice. One uses
    a PolyPolygon, the other uses a Rectangle. The Rectangle version
    exits out a lot faster, the PolyPolygon one seems to try to getting
    clipping regions and a Graphics instance first which is entirely
    unnecessary if the drawing mode is DRAWMODE_NOGRADIENT! Therefore,
    I'm bailing out of this function much faster, bring the two functions
    into line with each other.
    
    Change-Id: I882862ab82a93c2c9dfd5fc86f2507926d28aaea

diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx
index f402244..696c2f5 100644
--- a/vcl/source/gdi/outdev4.cxx
+++ b/vcl/source/gdi/outdev4.cxx
@@ -554,7 +554,9 @@ void OutputDevice::DrawGradient( const Rectangle& rRect,
 {
 
     if ( mnDrawMode & DRAWMODE_NOGRADIENT )
-        return;
+    {
+        return;     // nothing to draw!
+    }
     else if ( mnDrawMode & ( DRAWMODE_BLACKGRADIENT | DRAWMODE_WHITEGRADIENT | DRAWMODE_SETTINGSGRADIENT) )
     {
         Color aColor;
@@ -801,6 +803,8 @@ void OutputDevice::XORClipAndDrawGradient ( Gradient &rGradient, const PolyPolyg
 void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
                                  const Gradient& rGradient )
 {
+    if ( mnDrawMode & DRAWMODE_NOGRADIENT )
+        return;     // nothing to draw!
 
     if( mbInitClipRegion )
         ImplInitClipRegion();
@@ -812,7 +816,7 @@ void OutputDevice::DrawGradient( const PolyPolygon& rPolyPoly,
         if( !ImplGetGraphics() )
             return;
 
-    if( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() && !( mnDrawMode & DRAWMODE_NOGRADIENT ) )
+    if( rPolyPoly.Count() && rPolyPoly[ 0 ].GetSize() )
     {
         if ( mnDrawMode & ( DRAWMODE_BLACKGRADIENT | DRAWMODE_WHITEGRADIENT | DRAWMODE_SETTINGSGRADIENT) )
         {


More information about the Libreoffice-commits mailing list