vcl/source/gdi/gradient.cxx | 7 ------- vcl/source/gdi/outdev4.cxx | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 12 deletions(-)
New commits: commit 055fca04a4e00b14e68fa5860b417cb25e471299 Author: Michael Meeks <michael.me...@suse.com> Date: Tue Dec 11 11:28:30 2012 +0000 fdo#42553 - fix square gradient rendering by vcl. diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index 5a776e3..06b3e48 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -286,13 +286,6 @@ void Gradient::GetBoundRect( const Rectangle& rRect, Rectangle& rBoundRect, Poin aSize.Width() = (long)( 0.5 + (double) aSize.Width() * 1.4142 ); aSize.Height() = (long)( 0.5 + (double) aSize.Height() * 1.4142 ); } - else if( GetStyle() == GradientStyle_SQUARE ) - { - if ( aSize.Width() > aSize.Height() ) - aSize.Height() = aSize.Width(); - else - aSize.Width() = aSize.Height(); - } // neue Mittelpunkte berechnen long nZWidth = aRect.GetWidth() * (long) GetOfsX() / 100; diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index 8096924..4e895eb 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -481,7 +481,18 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, double fScanTop = aRect.Top(); double fScanRight = aRect.Right(); double fScanBottom = aRect.Bottom(); - double fScanInc = (double) nMinRect / (double) nSteps * 0.5; + double fScanIncX = (double) aRect.GetWidth() / (double) nSteps * 0.5; + double fScanIncY = (double) aRect.GetHeight() / (double) nSteps * 0.5; + + // all gradients are rendered as nested rectangles which shrink + // equally in each dimension - except for 'square' gradients + // which shrink to a central vertex but are not per-se square. + if( rGradient.GetStyle() != GradientStyle_SQUARE ) + { + fScanIncY = std::min( fScanIncY, fScanIncX ); + fScanIncX = fScanIncY; + } + sal_uInt8 nRed = (sal_uInt8) nStartRed, nGreen = (sal_uInt8) nStartGreen, nBlue = (sal_uInt8) nStartBlue; bool bPaintLastPolygon( false ); // #107349# Paint last polygon only if loop has generated any output @@ -512,10 +523,10 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, for( long i = 1; i < nSteps; i++ ) { // neues Polygon berechnen - aRect.Left() = (long)( fScanLeft += fScanInc ); - aRect.Top() = (long)( fScanTop += fScanInc ); - aRect.Right() = (long)( fScanRight -= fScanInc ); - aRect.Bottom() = (long)( fScanBottom -= fScanInc ); + aRect.Left() = (long)( fScanLeft += fScanIncX ); + aRect.Top() = (long)( fScanTop += fScanIncY ); + aRect.Right() = (long)( fScanRight -= fScanIncX ); + aRect.Bottom() = (long)( fScanBottom -= fScanIncY ); if( ( aRect.GetWidth() < 2 ) || ( aRect.GetHeight() < 2 ) ) break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits