Improve OS X performance using the same display's color space to blit to the screen

This commit is contained in:
David Capello 2016-09-12 13:40:47 -03:00
parent 5293d9cce5
commit 19545c12e3

View File

@ -300,7 +300,8 @@ private:
{ {
NSGraphicsContext* gc = [NSGraphicsContext currentContext]; NSGraphicsContext* gc = [NSGraphicsContext currentContext];
CGContextRef cg = (CGContextRef)[gc graphicsPort]; CGContextRef cg = (CGContextRef)[gc graphicsPort];
CGImageRef img = SkCreateCGImageRef(bitmap); CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID());
CGImageRef img = SkCreateCGImageRefWithColorspace(bitmap, colorSpace);
if (img) { if (img) {
CGRect r = CGRectMake(viewBounds.origin.x+rect.x, CGRect r = CGRectMake(viewBounds.origin.x+rect.x,
viewBounds.origin.y+rect.y, viewBounds.origin.y+rect.y,
@ -312,6 +313,7 @@ private:
CGContextRestoreGState(cg); CGContextRestoreGState(cg);
CGImageRelease(img); CGImageRelease(img);
} }
CGColorSpaceRelease(colorSpace);
} }
bitmap.unlockPixels(); bitmap.unlockPixels();
} }