summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-11-30 11:02:46 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2021-11-30 14:46:07 +0100
commit20029f713f2cb07b27d7be9bb4df5c2cec4723da (patch)
tree37a7000164cdb3167e3ef452d1f6d4b5d854a439 /sd
parent8185375a269b53bc1968f04223a0c290d30ef166 (diff)
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> (cherry picked from commit 53486d831784285b42860882a6b270eb847ff7aa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126103 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx29
1 files changed, 2 insertions, 27 deletions
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
{