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.lunak@collabora.com>
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 7b22240..feaf5a5 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
{