Cocoa: Remove references to CMProfileRef and related APIs

Deprecated since 10.6.

Change-Id: If1398c6cce0f199f9546d17695d47803f4a6fcba
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
Gabriel de Dietrich 2013-07-03 17:33:54 +02:00 committed by The Qt Project
parent 692e642305
commit b06304e164
2 changed files with 3 additions and 33 deletions

View File

@ -502,7 +502,6 @@ CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
CGColorSpaceRef colorSpace; CGColorSpaceRef colorSpace;
CGDirectDisplayID displayID; CGDirectDisplayID displayID;
CMProfileRef displayProfile = 0;
if (widget == 0) { if (widget == 0) {
displayID = CGMainDisplayID(); displayID = CGMainDisplayID();
} else { } else {
@ -520,18 +519,11 @@ CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
if ((colorSpace = m_displayColorSpaceHash.value(displayID))) if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
return colorSpace; return colorSpace;
CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile); colorSpace = CGDisplayCopyColorSpace(displayID);
if (err == noErr) {
colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
} else if (widget) {
return qt_mac_displayColorSpace(0); // fall back on main display
}
if (colorSpace == 0) if (colorSpace == 0)
colorSpace = CGColorSpaceCreateDeviceRGB(); colorSpace = CGColorSpaceCreateDeviceRGB();
m_displayColorSpaceHash.insert(displayID, colorSpace); m_displayColorSpaceHash.insert(displayID, colorSpace);
CMCloseProfile(displayProfile);
if (!m_postRoutineRegistered) { if (!m_postRoutineRegistered) {
m_postRoutineRegistered = true; m_postRoutineRegistered = true;
void qt_mac_cleanUpMacColorSpaces(); void qt_mac_cleanUpMacColorSpaces();
@ -804,20 +796,7 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy)
NULL, NULL,
false); false);
} else { } else {
// Try get a device color space. Using the device color space means CGColorSpaceRef cgColourSpaceRef = qt_mac_displayColorSpace(0);
// that the CGImage can be drawn to screen without per-pixel color
// space conversion, at the cost of less color accuracy.
CGColorSpaceRef cgColourSpaceRef = 0;
CMProfileRef sysProfile;
if (CMGetSystemProfile(&sysProfile) == noErr)
{
cgColourSpaceRef = CGColorSpaceCreateWithPlatformColorSpace(sysProfile);
CMCloseProfile(sysProfile);
}
// Fall back to Generic RGB if a profile was not found.
if (!cgColourSpaceRef)
cgColourSpaceRef = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
// Create a CGBitmapInfo contiaining the image format. // Create a CGBitmapInfo contiaining the image format.
// Support the 8-bit per component (A)RGB formats. // Support the 8-bit per component (A)RGB formats.
@ -851,7 +830,6 @@ CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy)
NULL, NULL,
false, false,
kCGRenderingIntentDefault); kCGRenderingIntentDefault);
CGColorSpaceRelease(cgColourSpaceRef);
} }
CGDataProviderRelease(cgDataProviderRef); CGDataProviderRelease(cgDataProviderRef);
return cgImage; return cgImage;

View File

@ -362,7 +362,6 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *wi
CGColorSpaceRef colorSpace; CGColorSpaceRef colorSpace;
CGDirectDisplayID displayID; CGDirectDisplayID displayID;
CMProfileRef displayProfile = 0;
if (widget == 0) { if (widget == 0) {
displayID = CGMainDisplayID(); displayID = CGMainDisplayID();
} else { } else {
@ -376,18 +375,11 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *wi
if ((colorSpace = m_displayColorSpaceHash.value(displayID))) if ((colorSpace = m_displayColorSpaceHash.value(displayID)))
return colorSpace; return colorSpace;
CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile); colorSpace = CGDisplayCopyColorSpace(displayID);
if (err == noErr) {
colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
} else if (widget) {
return macDisplayColorSpace(0); // fall back on main display
}
if (colorSpace == 0) if (colorSpace == 0)
colorSpace = CGColorSpaceCreateDeviceRGB(); colorSpace = CGColorSpaceCreateDeviceRGB();
m_displayColorSpaceHash.insert(displayID, colorSpace); m_displayColorSpaceHash.insert(displayID, colorSpace);
CMCloseProfile(displayProfile);
if (!m_postRoutineRegistered) { if (!m_postRoutineRegistered) {
m_postRoutineRegistered = true; m_postRoutineRegistered = true;
qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces); qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);