sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx |   29 +----------------
 1 file changed, 2 insertions(+), 27 deletions(-)

New commits:
commit 53486d831784285b42860882a6b270eb847ff7aa
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Tue Nov 30 11:02:46 2021 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Tue Nov 30 12:58:06 2021 +0100

    use DrawGradient() instead of doing it manually (tdf#145796)
    
    Change-Id: Ib771eb2ae35f68c81ef1fdcb1e4e3bf5d24a0dcc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126109
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lu...@collabora.com>

diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx 
b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 7b22240abfdd..feaf5a5fa36a 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -384,33 +384,8 @@ void PageObjectPainter::PaintBackgroundDetail (
     const Color aBottomColor(mpTheme->GetGradientColor(eColorType, 
Theme::GradientColorClass::Fill2));
     if (aTopColor != aBottomColor)
     {
-        const sal_Int32 nHeight (aPageObjectBox.GetHeight());
-        const sal_Int32 nDefaultConstantSize(nHeight/4);
-        const sal_Int32 nMinimalGradientSize(40);
-        const sal_Int32 nY1 (
-            ::std::max<sal_Int32>(
-                0,
-                ::std::min<sal_Int32>(
-                    nDefaultConstantSize,
-                    (nHeight - nMinimalGradientSize)/2)));
-        const sal_Int32 nY2 (nHeight-nY1);
-        const sal_Int32 nTop (aPageObjectBox.Top());
-        for (sal_Int32 nY=0; nY<nHeight; ++nY)
-        {
-            if (nY<=nY1)
-                rDevice.SetLineColor(aTopColor);
-            else if (nY>=nY2)
-                rDevice.SetLineColor(aBottomColor);
-            else
-            {
-                Color aColor (aTopColor);
-                aColor.Merge(aBottomColor, 255 * (nY2-nY) / (nY2-nY1));
-                rDevice.SetLineColor(aColor);
-            }
-            rDevice.DrawLine(
-                Point(aPageObjectBox.Left(), nY+nTop),
-                Point(aPageObjectBox.Right(), nY+nTop));
-        }
+        Gradient gradient(GradientStyle::Linear, aTopColor, aBottomColor);
+        rDevice.DrawGradient(aPageObjectBox, gradient);
     }
     else
     {

Reply via email to