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 /boilerplate | |
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 'boilerplate')
-rw-r--r-- | boilerplate/cairo-boilerplate-quartz.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/boilerplate/cairo-boilerplate-quartz.c b/boilerplate/cairo-boilerplate-quartz.c index d4ca35383..1a1417c75 100644 --- a/boilerplate/cairo-boilerplate-quartz.c +++ b/boilerplate/cairo-boilerplate-quartz.c @@ -26,7 +26,7 @@ #include "cairo-boilerplate-private.h" -#include <cairo-quartz.h> +#include <cairo-quartz-private.h> static cairo_surface_t * _cairo_boilerplate_quartz_create_surface (const char *name, @@ -56,7 +56,7 @@ static const cairo_boilerplate_target_t targets[] = { cairo_surface_create_similar, NULL, NULL, _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, + _cairo_quartz_surface_to_png, NULL, NULL, NULL, TRUE, FALSE, FALSE }, @@ -68,7 +68,7 @@ static const cairo_boilerplate_target_t targets[] = { cairo_surface_create_similar, NULL, NULL, _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, + _cairo_quartz_surface_to_png, NULL, NULL, NULL, FALSE, FALSE, FALSE }, |