mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 923945: Fix a memory leak when fetching OS X system color space. Also move system color space retrieval code from deprecated Color Manager APIs to Core Graphics. r=mstange
This commit is contained in:
parent
f707258233
commit
2b83c40b9d
@ -458,26 +458,20 @@ MacIOSurface::CGLTexImageIOSurface2D(void *c)
|
||||
}
|
||||
|
||||
CGColorSpaceRef CreateSystemColorSpace() {
|
||||
CMProfileRef system_profile = nullptr;
|
||||
CGColorSpaceRef cspace = nullptr;
|
||||
|
||||
if (::CMGetSystemProfile(&system_profile) == noErr) {
|
||||
// Create a colorspace with the systems profile
|
||||
cspace = ::CGColorSpaceCreateWithPlatformColorSpace(system_profile);
|
||||
::CMCloseProfile(system_profile);
|
||||
} else {
|
||||
// Default to generic
|
||||
cspace = ::CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
|
||||
}
|
||||
|
||||
return cspace;
|
||||
CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID());
|
||||
if (!cspace) {
|
||||
cspace = ::CGColorSpaceCreateDeviceRGB();
|
||||
}
|
||||
return cspace;
|
||||
}
|
||||
|
||||
CGContextRef MacIOSurface::CreateIOSurfaceContext() {
|
||||
CGColorSpaceRef cspace = CreateSystemColorSpace();
|
||||
CGContextRef ref = MacIOSurfaceLib::IOSurfaceContextCreate(mIOSurfacePtr,
|
||||
GetDevicePixelWidth(),
|
||||
GetDevicePixelHeight(),
|
||||
8, 32, CreateSystemColorSpace(), 0x2002);
|
||||
8, 32, cspace, 0x2002);
|
||||
::CGColorSpaceRelease(cspace);
|
||||
return ref;
|
||||
}
|
||||
|
||||
@ -639,9 +633,7 @@ nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight,
|
||||
dataProvider, nullptr, true, kCGRenderingIntentDefault);
|
||||
|
||||
::CGDataProviderRelease(dataProvider);
|
||||
if (colorSpace) {
|
||||
::CGColorSpaceRelease(colorSpace);
|
||||
}
|
||||
::CGColorSpaceRelease(colorSpace);
|
||||
if (!mCGImage) {
|
||||
mUnsupportedWidth = aWidth;
|
||||
mUnsupportedHeight = aHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user