Skip to content

Better color management for improved performance on some apps.

John Ralls requested to merge jralls/cairo:quartz-colorspace into master

The default RGB colorspace must be converted to the GPU's colorspace using CGColorTransformConvertUsingCMSConverter. Profiling has shown this function to consume as much as 48% of a redraw cycle in gdk-quartz in Gtk3 applications that directly create cairo surfaces rather than relying on GdkQuartzNSView's drawRect method to set up cairo, in particular Gimp.

There seems to be no named colorspace that matches the one stored on the display, so we use the one associated with the main display. This has some risks for users with multiple monitors but in testing with my own two-monitor setup, one of which is HDR and the other not, the colorspace was the same for both.

There's another issue: The monitor's color space is wrong for generating PNGs, producing somewhat faded colors and causing many tests to fail, so I've resorted to a bit of a hack: If cairo_quartz_surface_create_for_cg_context has been called then we're drawing for a screen and need to use its colorspace, otherwise we use kCGColorSpaceDefaultRGB as usual.

Fixes #330 (closed)

Merge request reports