summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-04-19 16:25:58 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-04-20 14:18:42 +0200
commit17e9789f6c0b676484609b61e3abbebca8c93f88 (patch)
treec5bf4f0bcc4cdbf39161273b376645ef8b601512 /include
parent764360df78535befcc4806736fcbaedbe0e34ea1 (diff)
reduce copy pasta with Color::GetLuminance()
Change-Id: I2eda3607a3be6ee56f0a9ddd14131be783b9698a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114294 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'include')
-rw-r--r--include/tools/color.hxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/tools/color.hxx b/include/tools/color.hxx
index 59ac4381de03..4770efee7b0a 100644
--- a/include/tools/color.hxx
+++ b/include/tools/color.hxx
@@ -311,7 +311,7 @@ public:
*/
bool IsDark() const
{
- return sal_uInt8((B * 29UL + G * 151UL + R * 76UL) >> 8) <= 60;
+ return GetLuminance() <= 60;
}
/** Comparison with luminance thresholds.
@@ -319,7 +319,7 @@ public:
*/
bool IsBright() const
{
- return sal_uInt8((B * 29UL + G * 151UL + R * 76UL) >> 8) >= 245;
+ return GetLuminance() >= 245;
}
/* Color filters */