wip: quartz: use colorspace from primary display

Using the default RGB colorspace seems to go through colorspace
conversion on tested macbook retina devices. Instead, default to the
colorspace of the main display so that it does not incur the conversion
cost on every frame.

This probably requires the equivalent patch to cairo, I have not tested
without it yet.
This commit is contained in:
Christian Hergert
2015-09-30 18:37:16 -07:00
parent abe99e4611
commit b1be2a70fd

View File

@@ -3014,21 +3014,25 @@ static CGContextRef
gdk_root_window_impl_quartz_get_context (GdkWindowImplQuartz *window,
gboolean antialias)
{
CGColorSpaceRef colorspace;
CGColorSpaceRef colorSpace;
CGContextRef cg_context;
GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (window);
if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
return NULL;
colorSpace = CGDisplayCopyColorSpace (CGMainDisplayID ());
if (!colorSpace)
colorSpace = CGColorSpaceCreateDeviceRGB ();
/* We do not have the notion of a root window on OS X. We fake this
* by creating a 1x1 bitmap and return a context to that.
*/
colorspace = CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB);
cg_context = CGBitmapContextCreate (NULL,
1, 1, 8, 4, colorspace,
kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease (colorspace);
1, 1, 8, 4, colorSpace,
kCGBitmapByteOrder32Host|kCGImageAlphaPremultipliedLast);
CGColorSpaceRelease (colorSpace);
return cg_context;
}