[quartz] Set the sRGB colorspace on the IOSurface.
authorJohn Ralls <jralls@ceridwen.us>
Sat, 11 Feb 2023 20:48:34 +0000 (12:48 -0800)
committerJohn Ralls <jralls@ceridwen.us>
Sat, 11 Feb 2023 20:52:38 +0000 (12:52 -0800)
Enables colorspace tranformation in Core Animation. This transform
is executed on the GPU and unlike the Core Graphics one has no
affect on performance.

Fixes #5579

gdk/quartz/GdkQuartzView.c

index 81c2d320078e18cbe74ee0141e5899f740670c8b..f8c53841f3d703fd6840d94cc2be93c7777b7001 100644 (file)
@@ -548,6 +548,8 @@ copy_rectangle_argb32 (cairo_surface_t *dest, cairo_surface_t *source,
 
 -(void)createBackingStoreWithWidth: (CGFloat) width andHeight: (CGFloat) height
 {
+  IOSurfaceRef surface;
+
   g_return_if_fail (width && height);
 
   CVPixelBufferRelease (pixels);
@@ -555,6 +557,9 @@ copy_rectangle_argb32 (cairo_surface_t *dest, cairo_surface_t *source,
                        kCVPixelFormatType_32BGRA,
                        cfpb_props, &pixels);
 
+  surface = CVPixelBufferGetIOSurface (pixels);
+  IOSurfaceSetValue(surface, CFSTR("IOSurfaceColorSpace"),
+                    kCGColorSpaceSRGB);
 }
 
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 10700