diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-12 20:47:29 +1000 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2014-04-12 23:05:40 +1000 |
commit | 555d49bf1a5d299d45a3b29fa555efcd4e2c917a (patch) | |
tree | 89a18475330c8153130c77d7c72117d3b165bb2c /vcl | |
parent | 4981bb9eed1a51f8ce54d01c37bfb5b5d46f0637 (diff) |
Detect if polypolygon is a rectangle in DrawGradient
If the polypolygon that we use for DrawGradient is a rectangle, then we
need to 1) expand the gradient rectangle to avoid missing lines on the
right and bottom edge, and 2) we should pass NULL as the clipping
parameter for ImplDrawLinearGradient and ImplDrawComplexGradient.
Change-Id: I8d8289ace069b5c500db59d1a2addfcea8388dfb
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/outdev4.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index fde279004f8e..794c6d7108a1 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -760,10 +760,22 @@ void OutputDevice::ClipAndDrawGradient ( Gradient &rGradient, const PolyPolygon if ( !rGradient.GetSteps() ) rGradient.SetSteps( GRADIENT_DEFAULT_STEPCOUNT ); + if ( rPolyPoly.IsRect() ) + { + // because we draw with no border line, we have to expand gradient + // rect to avoid missing lines on the right and bottom edge + aRect.Left()--; + aRect.Top()--; + aRect.Right()++; + aRect.Bottom()++; + } + + // if the clipping polypolygon is a rectangle, then it's the same size as the bounding of the + // polypolygon, so pass in a NULL for the clipping parameter if( rGradient.GetStyle() == GradientStyle_LINEAR || rGradient.GetStyle() == GradientStyle_AXIAL ) - ImplDrawLinearGradient( aRect, rGradient, false, &aClipPolyPoly ); + ImplDrawLinearGradient( aRect, rGradient, false, aClipPolyPoly.IsRect() ? NULL : &aClipPolyPoly ); else - ImplDrawComplexGradient( aRect, rGradient, false, &aClipPolyPoly ); + ImplDrawComplexGradient( aRect, rGradient, false, aClipPolyPoly.IsRect() ? NULL : &aClipPolyPoly ); } Pop(); |