diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2020-12-28 01:37:59 +1100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-01-13 10:47:01 +0100 |
commit | 19c4014c57c059b08cb7e90d3c9aef9d458fe774 (patch) | |
tree | 9535a35091ad3991c18f0c3b707cf731c92cf60a /vcl/source/gdi | |
parent | edb2724623e58cd8c9a5d3a85e8ee5d3858872d5 (diff) |
vcl: migrate OutputDevice::SetGrayscaleColors() to Gradient::MakeGrayscale()
Change-Id: I125ad3db3ee30833022113da5d78dcf81d0f7edc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108374
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/gdi')
-rw-r--r-- | vcl/source/gdi/gradient.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx index a3014abda46d..40a4f94d7204 100644 --- a/vcl/source/gdi/gradient.cxx +++ b/vcl/source/gdi/gradient.cxx @@ -273,6 +273,20 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB } } +void Gradient::MakeGrayscale() +{ + Color aStartCol(GetStartColor()); + Color aEndCol(GetEndColor()); + sal_uInt8 cStartLum = aStartCol.GetLuminance(); + sal_uInt8 cEndLum = aEndCol.GetLuminance(); + + aStartCol = Color(cStartLum, cStartLum, cStartLum); + aEndCol = Color(cEndLum, cEndLum, cEndLum); + + SetStartColor(aStartCol); + SetEndColor(aEndCol); +} + Gradient& Gradient::operator=( const Gradient& ) = default; Gradient& Gradient::operator=( Gradient&& ) = default; |