diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 15:39:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-04-29 18:25:10 +0200 |
commit | 76c793d2acf66f46e9edcda43d2f4327e8374841 (patch) | |
tree | 163af729e0210d6bc3c6c68d121a2d65cbf89eec | |
parent | debac7777007038aeebd395119ba2ad4a9cc5d88 (diff) |
rename A field in ::Color to T
because it's actually transparency, not alpha, and having proper naming
helps my limited brain keep track of stuff better when debugging
And have both the stream operator and the debugging printer print out
alpha values, for consistency.
Change-Id: I9bc9ffcb71d554603591935e4043a3fb14646ebd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114886
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | include/tools/color.hxx | 12 | ||||
-rw-r--r-- | solenv/gdb/libreoffice/tl.py | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/include/tools/color.hxx b/include/tools/color.hxx index 4770efee7b0a..ac361474c228 100644 --- a/include/tools/color.hxx +++ b/include/tools/color.hxx @@ -55,7 +55,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color struct { #ifdef OSL_BIGENDIAN - sal_uInt8 A; + sal_uInt8 T; sal_uInt8 R; sal_uInt8 G; sal_uInt8 B; @@ -63,7 +63,7 @@ class SAL_WARN_UNUSED TOOLS_DLLPUBLIC Color sal_uInt8 B; sal_uInt8 G; sal_uInt8 R; - sal_uInt8 A; + sal_uInt8 T; #endif }; }; @@ -163,7 +163,7 @@ public: */ sal_uInt8 GetAlpha() const { - return 255 - A; + return 255 - T; } /** Is the color transparent? @@ -177,7 +177,7 @@ public: */ bool IsFullyTransparent() const { - return A == 255; + return T == 255; } /** Sets the red value. @@ -209,7 +209,7 @@ public: */ void SetAlpha(sal_uInt8 nAlpha) { - A = 255 - nAlpha; + T = 255 - nAlpha; } /** Returns the same color but ignoring the transparency value. @@ -495,7 +495,7 @@ template<typename charT, typename traits> inline std::basic_ostream<charT, traits>& operator <<(std::basic_ostream<charT, traits>& rStream, const Color& rColor) { std::ios_base::fmtflags nOrigFlags = rStream.flags(); - rStream << "c[" << std::hex << std::setfill ('0') + rStream << "rgba[" << std::hex << std::setfill ('0') << std::setw(2) << static_cast<int>(rColor.GetRed()) << std::setw(2) << static_cast<int>(rColor.GetGreen()) << std::setw(2) << static_cast<int>(rColor.GetBlue()) diff --git a/solenv/gdb/libreoffice/tl.py b/solenv/gdb/libreoffice/tl.py index 22ca3ba57c5f..8e15bfd47a0d 100644 --- a/solenv/gdb/libreoffice/tl.py +++ b/solenv/gdb/libreoffice/tl.py @@ -47,9 +47,9 @@ class ColorPrinter(object): r = self.val['R'] g = self.val['G'] b = self.val['B'] - a = self.val['A'] - if a: - return "rgba(%d, %d, %d, %d)" % (r, g, b, a) + t = self.val['T'] + if t: + return "rgba(%d, %d, %d, %d)" % (r, g, b, 255 - t) else: return "rgb(%d, %d, %d)" % (r, g, b) |