From 19545c12e3d47b9b6a31f91f5e083d4847890aaf Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 12 Sep 2016 13:40:47 -0300 Subject: [PATCH] Improve OS X performance using the same display's color space to blit to the screen --- src/she/skia/skia_window_osx.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/she/skia/skia_window_osx.mm b/src/she/skia/skia_window_osx.mm index cb299f752..d046efb6c 100644 --- a/src/she/skia/skia_window_osx.mm +++ b/src/she/skia/skia_window_osx.mm @@ -300,7 +300,8 @@ private: { NSGraphicsContext* gc = [NSGraphicsContext currentContext]; CGContextRef cg = (CGContextRef)[gc graphicsPort]; - CGImageRef img = SkCreateCGImageRef(bitmap); + CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(CGMainDisplayID()); + CGImageRef img = SkCreateCGImageRefWithColorspace(bitmap, colorSpace); if (img) { CGRect r = CGRectMake(viewBounds.origin.x+rect.x, viewBounds.origin.y+rect.y, @@ -312,6 +313,7 @@ private: CGContextRestoreGState(cg); CGImageRelease(img); } + CGColorSpaceRelease(colorSpace); } bitmap.unlockPixels(); }