diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-01-15 14:49:12 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-16 10:07:07 +0100 |
commit | 63a68064bb33f180b8a231f7524d99405d910226 (patch) | |
tree | 7ecf05b057c5ca4d80a48af045998a4b34484561 /include/sax | |
parent | d534a4c7b45ff254b339e806c6a11f13d9ff0043 (diff) |
make the Color constructors explicitly specify transparency
to reduce the churn, we leave the existing constructor in place,
and add a clang plugin to detect when the value passed to the
existing constructor may contain transparency/alpha data.
i.e. we leave expressions like Color(0xffffff) alone, but
warn about any non-constant expression, and any expression
like Color(0xff000000)
Change-Id: Id2ce58e08882d9b7bd0b9f88eca97359dcdbcc8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109362
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/sax')
-rw-r--r-- | include/sax/tools/converter.hxx | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/sax/tools/converter.hxx b/include/sax/tools/converter.hxx index 0d3d68ba301c..88cea1c33ab7 100644 --- a/include/sax/tools/converter.hxx +++ b/include/sax/tools/converter.hxx @@ -123,7 +123,15 @@ public: { sal_Int32 n(rColor); bool b = convertColor( n, rValue ); - if (b) rColor = n; + if (b) rColor = Color(ColorTransparency, n); + return b; + } + static bool convertColor( ::Color& rColor, + std::string_view rValue ) + { + sal_Int32 n(rColor); + bool b = convertColor( n, rValue ); + if (b) rColor = Color(ColorTransparency, n); return b; } |