diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-01 15:38:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-02 10:01:16 +0100 |
commit | 06ed7cd89b8cbbdfd64b474a5c0555a1047a96db (patch) | |
tree | 8cc6e26f60ef1ddfc0bb7efc08221604d33acba2 /cui | |
parent | 7e80b63d8304d435d305ea61988eaf6cf9667886 (diff) |
use more Color in HexColorControl
Change-Id: I889fa9f2a8711e95f24336718e35d11d0945dec1
Reviewed-on: https://gerrit.libreoffice.org/50573
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/dialogs/colorpicker.cxx | 21 | ||||
-rw-r--r-- | cui/source/tabpages/tpcolor.cxx | 2 |
2 files changed, 9 insertions, 14 deletions
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index 21d46383d5ac..fae025ce55d0 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -1227,22 +1227,17 @@ IMPL_LINK(ColorPickerDialog, ColorModifyEditHdl, Edit&, rEdit, void) } else if (&rEdit == mpEDHex) { - sal_Int32 nColor = mpEDHex->GetColor(); + Color aColor = mpEDHex->GetColor(); - if (nColor != -1) + if (aColor != Color(0xffffffff) && aColor != GetColor()) { - Color aColor(nColor); + mdRed = static_cast<double>(aColor.GetRed()) / 255.0; + mdGreen = static_cast<double>(aColor.GetGreen()) / 255.0; + mdBlue = static_cast<double>(aColor.GetBlue()) / 255.0; - if (aColor != GetColor()) - { - mdRed = static_cast<double>(aColor.GetRed()) / 255.0; - mdGreen = static_cast<double>(aColor.GetGreen()) / 255.0; - mdBlue = static_cast<double>(aColor.GetBlue()) / 255.0; - - RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); - RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); - n = UpdateFlags::All & ~UpdateFlags::Hex; - } + RGBtoHSV( mdRed, mdGreen, mdBlue, mdHue, mdSat, mdBri ); + RGBtoCMYK( mdRed, mdGreen, mdBlue, mdCyan, mdMagenta, mdYellow, mdKey ); + n = UpdateFlags::All & ~UpdateFlags::Hex; } } diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx index d33173d9b83b..cffd860f785e 100644 --- a/cui/source/tabpages/tpcolor.cxx +++ b/cui/source/tabpages/tpcolor.cxx @@ -321,7 +321,7 @@ IMPL_LINK(SvxColorTabPage, ModifiedHdl_Impl, Edit&, rEdit, void) { // read current MtrFields, if cmyk, then k-value as transparency if(&rEdit == m_pHexcustom) - aCurrentColor = Color(m_pHexcustom->GetColor()); + aCurrentColor = m_pHexcustom->GetColor(); else { aCurrentColor = Color( static_cast<sal_uInt8>(PercentToColor_Impl( static_cast<sal_uInt16>(m_pRcustom->GetValue()) )), |