diff options
author | John Ralls <jralls@ceridwen.us> | 2023-02-07 09:48:16 -0800 |
---|---|---|
committer | John Ralls <jralls@ceridwen.us> | 2023-02-17 10:25:14 -0800 |
commit | 951a3dd9a78c7882106b5c0d5c0a74454ffcd387 (patch) | |
tree | d6dc8df640d985e93cc053ce6f74d6eea02ca198 /src/cairo-quartz-private.h | |
parent | d7b9695ee431dfe43a2ae48ebfd907623c6cb6e0 (diff) | |
download | cairo-951a3dd9a78c7882106b5c0d5c0a74454ffcd387.tar.gz |
[quartz]Conditionally Use Main Display ColorSpace instead of kCGColorSpaceDefaultRGB.
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.
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.
This is applied to quartz surfaces created with
cairo_quartz_surface_create(); surfaces created with
cairo_quartz_surface_create_for_cg_context will inherit the colorspace
from the context.
In order to generate PNGs that look right I've converted the
existing debugging functions for writing a quartz surface to png
into private functions and wired cairo-boilerplate-quartz to use
them. Using the generic cairo routine produced washed-out PNGs.
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/330
Diffstat (limited to 'src/cairo-quartz-private.h')
-rw-r--r-- | src/cairo-quartz-private.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h index 4b6d2a99a..bdfdf8c2b 100644 --- a/src/cairo-quartz-private.h +++ b/src/cairo-quartz-private.h @@ -96,6 +96,8 @@ _cairo_surface_is_quartz_image (const cairo_surface_t *surface); cairo_private cairo_bool_t _cairo_quartz_image_surface_is_zero (const cairo_quartz_image_surface_t *surface); +cairo_private CGColorSpaceRef +_cairo_quartz_create_color_space (CGContextRef context); cairo_private CGContextRef _cairo_quartz_image_surface_get_cg_context (cairo_surface_t *surface); @@ -108,6 +110,9 @@ _cairo_quartz_font_face_create_for_ctfont (CTFontRef ctFont); cairo_private void _cairo_quartz_set_antialiasing (CGContextRef context, cairo_antialias_t antialias); +cairo_status_t _cairo_quartz_surface_to_png (cairo_surface_t *abstract_surface, const char *dest); +cairo_private void _cairo_quartz_image_to_png (CGImageRef, const char *dest); + #else # error Cairo was not compiled with support for the quartz backend |