[Libreoffice-commits] core.git: vcl/inc vcl/quartz

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Sun Oct 18 12:45:01 UTC 2020


 vcl/inc/quartz/utils.h |    1 
 vcl/quartz/utils.cxx   |   56 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

New commits:
commit 2cd47f53b4c7bd300c210eaa466e13adc832c9b5
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Sun Oct 18 14:20:24 2020 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Sun Oct 18 14:44:24 2020 +0200

    tdf#137468: Add debug output function for CGColorSpaceRef
    
    Change-Id: I6fdb00652bf3dd892b531b80c2bb621ff22e8717
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104475
    Tested-by: Jenkins
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/vcl/inc/quartz/utils.h b/vcl/inc/quartz/utils.h
index 2452c151d28e..a2a39f2605d2 100644
--- a/vcl/inc/quartz/utils.h
+++ b/vcl/inc/quartz/utils.h
@@ -44,6 +44,7 @@ std::ostream &operator <<(std::ostream& s, const CGPoint &rPoint);
 std::ostream &operator <<(std::ostream& s, const CGSize &rSize);
 std::ostream &operator <<(std::ostream& s, CGColorRef pSize);
 std::ostream &operator <<(std::ostream& s, const CGAffineTransform &aXform);
+std::ostream &operator <<(std::ostream& s, CGColorSpaceRef cs);
 
 #endif // INCLUDED_VCL_INC_QUARTZ_UTILS_H
 
diff --git a/vcl/quartz/utils.cxx b/vcl/quartz/utils.cxx
index 0e0ac8f4d90a..1bbd5cdde873 100644
--- a/vcl/quartz/utils.cxx
+++ b/vcl/quartz/utils.cxx
@@ -158,4 +158,60 @@ std::ostream &operator <<(std::ostream& s, const CGAffineTransform &aXform)
     return s;
 }
 
+std::ostream &operator <<(std::ostream& s, CGColorSpaceRef cs)
+{
+#ifndef SAL_LOG_INFO
+    (void) cs;
+#else
+    if (cs == nullptr)
+    {
+        s << "null";
+        return s;
+    }
+
+    CGColorSpaceModel model = CGColorSpaceGetModel(cs);
+    switch (model)
+    {
+    case kCGColorSpaceModelUnknown:
+        s << "Unknown";
+        break;
+    case kCGColorSpaceModelMonochrome:
+        s << "Monochrome";
+        break;
+    case kCGColorSpaceModelRGB:
+        s << "RGB";
+        if (CGColorSpaceIsWideGamutRGB(cs))
+            s << " (wide gamut)";
+        break;
+    case kCGColorSpaceModelCMYK:
+        s << "CMYK";
+        break;
+    case kCGColorSpaceModelLab:
+        s << "Lab";
+        break;
+    case kCGColorSpaceModelDeviceN:
+        s << "DeviceN";
+        break;
+    case kCGColorSpaceModelIndexed:
+        s << "Indexed (" << CGColorSpaceGetColorTableCount(cs) << ")";
+        break;
+    case kCGColorSpaceModelPattern:
+        s << "Pattern";
+        break;
+    case kCGColorSpaceModelXYZ:
+        s << "XYZ";
+        break;
+    default:
+        s << "?(" << model << ")";
+        break;
+    }
+
+    CFStringRef name = CGColorSpaceCopyName(cs);
+    if (name != NULL)
+        s << " (" << [(NSString *)name UTF8String] << ")";
+
+    return s;
+#endif
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list