macOS: Reflect QWindow's color space after creation
If an explicit color space has been set, we assume that we can apply that to the CAMetalLayer or IOSurface we use when blitting our content. If not we want to reflect the NSWindow's color space, which will in turn reflect the NSScreen color space. Task-number: QTBUG-129499 Pick-to: 6.8 Change-Id: Idc465af39dafc80be0edd014abc55eb501ae1f89 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
b78baf634c
commit
a3a691c5a3
@ -183,7 +183,16 @@ QCocoaWindow::~QCocoaWindow()
|
||||
|
||||
QSurfaceFormat QCocoaWindow::format() const
|
||||
{
|
||||
return window()->requestedFormat();
|
||||
auto format = window()->requestedFormat();
|
||||
if (auto *view = qnsview_cast(m_view); view.colorSpace) {
|
||||
auto colorSpace = QColorSpace::fromIccProfile(QByteArray::fromNSData(view.colorSpace.ICCProfileData));
|
||||
if (!colorSpace.isValid()) {
|
||||
qCWarning(lcQpaWindow) << "Failed to parse ICC profile for" << view.colorSpace
|
||||
<< "with ICC data" << view.colorSpace.ICCProfileData;
|
||||
}
|
||||
format.setColorSpace(colorSpace);
|
||||
}
|
||||
return format;
|
||||
}
|
||||
|
||||
void QCocoaWindow::setGeometry(const QRect &rectIn)
|
||||
|
Loading…
x
Reference in New Issue
Block a user