diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-10-18 14:20:24 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-10-18 14:44:24 +0200 |
commit | 2cd47f53b4c7bd300c210eaa466e13adc832c9b5 (patch) | |
tree | 23131b1ceb55e5dcd3989daf7d8c2b0ed15188f1 | |
parent | ccdb78773ac6c9d19140e8084f37cc2c7f06240e (diff) |
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@collabora.com>
-rw-r--r-- | vcl/inc/quartz/utils.h | 1 | ||||
-rw-r--r-- | vcl/quartz/utils.cxx | 56 |
2 files changed, 57 insertions, 0 deletions
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: */ |