diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-28 11:41:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-28 16:08:03 +0200 |
commit | 4149201b099487c5b46d7015b0c174dfff1841ec (patch) | |
tree | e0c2a8d3d785a1f136563516953984436e4fc92e /tools | |
parent | 34b3c66da2e5a300930f4ea47661b0e38a459565 (diff) |
use more string_view in tools::Color
Change-Id: I0203aff3af19d3994af5325538520469ab2900ce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133541
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/source/generic/color.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index 0493b5250f62..1c740f03df03 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -159,30 +159,30 @@ Color Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) return Color( cR, cG, cB ); } -Color Color::STRtoRGB(const OUString& colorname) +Color Color::STRtoRGB(std::u16string_view colorname) { Color col; - if(colorname.isEmpty()) return col; + if(colorname.empty()) return col; - switch(colorname.getLength()){ + switch(colorname.size()){ case 7: - col.mValue = o3tl::toUInt32(colorname.subView(1,6), 16); + col.mValue = o3tl::toUInt32(colorname.substr(1,6), 16); break; case 6: - col.mValue = colorname.toUInt32(16); + col.mValue = o3tl::toUInt32(colorname, 16); break; case 4: { sal_Unicode data[6] = { colorname[1], colorname[1], colorname[2], colorname[2], colorname[3], colorname[3] }; - col.mValue = OUString(data,6).toUInt32(16); + col.mValue = o3tl::toUInt32(std::u16string_view(data,6), 16); break; } case 3: { sal_Unicode data[6] = { colorname[0], colorname[0], colorname[1], colorname[1], colorname[2], colorname[2] }; - col.mValue = OUString(data,6).toUInt32(16); + col.mValue = o3tl::toUInt32(std::u16string_view(data,6), 16); break; } default: |