diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-07 14:57:04 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-07 16:43:15 +1000 |
commit | 05fb3136904c8e6ff3a0c9d8c1c29ce904573d58 (patch) | |
tree | b78cd6d121b34478e139677571bd328896946016 /vcl | |
parent | 54687db04e3621f229d61cc690e7c065e24d0cfc (diff) |
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
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/outdev4.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index f402244d79d1..696c2f573c31 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) ) { |