[Libreoffice-commits] core.git: include/tools solenv/gdb

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 29 16:25:55 UTC 2021


 include/tools/color.hxx      |   12 ++++++------
 solenv/gdb/libreoffice/tl.py |    6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 76c793d2acf66f46e9edcda43d2f4327e8374841
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Apr 29 15:39:02 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Apr 29 18:25:10 2021 +0200

    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 at collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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)
 


More information about the Libreoffice-commits mailing list