Draw to screen context failure with source L*a*b* colorSpace

Hello,


We are drawing to a screen context in [NSView drawRect:] using an NSColor based off of a L*a*b* NSColorSpace loaded form an ICC Profile. On 10.11, we get the following assertion:

Assertion failed: (space->state->type == kCGColorSpaceLAB), function CGColorSpaceGetLabData, file ColorSpaces/CGColorSpace_Lab.c, line 137.

The same exact code works on 10.8 and up. Any ideas what might have changed? Is this new or am i doing something all wrong? Here's the simple code:


- (void)drawRect:(NSRect)dirtyRect

{

NSString* labProfilePath = [[NSBundle mainBundle] pathForResource:@"Lab" ofType:@"icc"];

NSData* labProfileData = [NSData dataWithContentsOfFile:labProfilePath];

NSColorSpace* labCS = [[NSColorSpace alloc] initWithICCProfileData:labProfileData];


CGFloat components[4] = { 0, 1, 1, 1 };

NSColor* color = [NSColor colorWithColorSpace:labCS components:components count:4];


[color set];

[[NSBezierPath bezierPathWithRect:dirtyRect] fill];

}


regards,

Alex Cohen

We found exactly the same issue here.

It seems that the NSColorSpace does not like this icc profile.

Did you try with the "Generic Lab Profile.icc" that can be found in /System/Library/ColorSync/Profiles ?

Draw to screen context failure with source L*a*b* colorSpace
 
 
Q