include/vcl/outdev.hxx | 2 +- vcl/source/gdi/outdev4.cxx | 32 +++++++++----------------------- 2 files changed, 10 insertions(+), 24 deletions(-)
New commits: commit c8e7bae4da31ca7ed0a30ad476b7733f3c770bf9 Author: Chris Sherlock <chris.sherloc...@gmail.com> Date: Sun Apr 6 17:18:09 2014 +1000 fdo#74702 use same gradient steps func. to draw linear and complex grads Reworked Output::ImplGetGradientSteps to be usable for both linear and complex (actually, axial, but that's another story) gradients by adding a default parameter. This gets rid of another meOutDevType from gradient functions Change-Id: I1dc918e4c3153617d172560523cfca303f0b904c Reviewed-on: https://gerrit.libreoffice.org/8872 Reviewed-by: Chris Sherlock <chris.sherloc...@gmail.com> Tested-by: Chris Sherlock <chris.sherloc...@gmail.com> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 56aa073..016fc16 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -853,7 +853,7 @@ private: SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists ); SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists ); SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists ); - SAL_DLLPRIVATE long ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf ); + SAL_DLLPRIVATE long ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf, bool bComplex=false ); // not implemented; to detect misuses of DrawOutDev(...OutputDevice&); void DrawOutDev( const Point&, const Size&, const Point&, const Size&, const Printer&); diff --git a/vcl/source/gdi/outdev4.cxx b/vcl/source/gdi/outdev4.cxx index a8dc07d..4b825f4 100644 --- a/vcl/source/gdi/outdev4.cxx +++ b/vcl/source/gdi/outdev4.cxx @@ -145,13 +145,17 @@ long OutputDevice::ImplGetGradientStepCount( long nMinRect ) return nInc; } -long OutputDevice::ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf ) +long OutputDevice::ImplGetGradientSteps( const Gradient& rGradient, const Rectangle& rRect, bool bMtf, bool bComplex ) { // calculate step count - long nStepCount = rGradient.GetSteps(); + long nStepCount = rGradient.GetSteps(); + long nMinRect; // generate nStepCount, if not passed - long nMinRect = rRect.GetHeight(); + if (bComplex) + nMinRect = std::min( rRect.GetWidth(), rRect.GetHeight() ); + else + nMinRect = rRect.GetHeight(); if ( !nStepCount ) { @@ -385,7 +389,6 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, long nRedSteps = nEndRed - nStartRed; long nGreenSteps = nEndGreen - nStartGreen; long nBlueSteps = nEndBlue - nStartBlue; - long nStepCount = rGradient.GetSteps(); sal_uInt16 nAngle = rGradient.GetAngle() % 3600; rGradient.GetBoundRect( rRect, aRect, aCenter ); @@ -393,25 +396,8 @@ void OutputDevice::ImplDrawComplexGradient( const Rectangle& rRect, if ( UsePolyPolygonForComplexGradient() || bMtf ) pPolyPoly.reset(new PolyPolygon( 2 )); - long nMinRect = std::min( aRect.GetWidth(), aRect.GetHeight() ); - - // calculate number of steps, if this was not passed - if( !nStepCount ) - { - long nInc; - - if ( meOutDevType != OUTDEV_PRINTER && !bMtf ) - { - nInc = ( nMinRect < 50 ) ? 2 : 4; - } - else - { - // #105998# Use display-equivalent step size calculation - nInc = (nMinRect < 800) ? 10 : 20; - } - - nStepCount = nMinRect / nInc; - } + // last parameter - true if complex gradient, false if linear + long nStepCount = ImplGetGradientSteps( rGradient, rRect, bMtf, true ); // at least three steps and at most the number of colour differences long nSteps = std::max( nStepCount, 2L ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits