cairo: Use the draw context's color state

This just passes through the sRGB set by the GDK backends instead of
hardcoding sRGB, so no functional changes.
This commit is contained in:
Benjamin Otte 2024-07-02 17:39:16 +02:00
parent 6287eaa745
commit 4fa6f791f4

View File

@ -25,6 +25,8 @@
#include "gskdebugprivate.h"
#include "gskrendererprivate.h"
#include "gskrendernodeprivate.h"
#include "gdk/gdkcolorstateprivate.h"
#include "gdk/gdkdrawcontextprivate.h"
#include "gdk/gdktextureprivate.h"
typedef struct {
@ -73,6 +75,7 @@ gsk_cairo_renderer_unrealize (GskRenderer *renderer)
static void
gsk_cairo_renderer_do_render (GskRenderer *renderer,
cairo_t *cr,
GdkColorState *ccs,
GskRenderNode *root)
{
GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer);
@ -82,7 +85,7 @@ gsk_cairo_renderer_do_render (GskRenderer *renderer,
profiler = gsk_renderer_get_profiler (renderer);
gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
gsk_render_node_draw (root, cr);
gsk_render_node_draw_with_color_state (root, cr, ccs);
cpu_time = gsk_profiler_timer_end (profiler, self->profile_timers.cpu_time);
gsk_profiler_timer_set (profiler, self->profile_timers.cpu_time, cpu_time);
@ -140,7 +143,7 @@ gsk_cairo_renderer_render_texture (GskRenderer *renderer,
cairo_translate (cr, - viewport->origin.x, - viewport->origin.y);
gsk_cairo_renderer_do_render (renderer, cr, root);
gsk_cairo_renderer_do_render (renderer, cr, GDK_COLOR_STATE_SRGB, root);
cairo_destroy (cr);
@ -178,7 +181,10 @@ gsk_cairo_renderer_render (GskRenderer *renderer,
cairo_restore (cr);
}
gsk_cairo_renderer_do_render (renderer, cr, root);
gsk_cairo_renderer_do_render (renderer,
cr,
gdk_draw_context_get_color_state (GDK_DRAW_CONTEXT (self->cairo_context)),
root);
cairo_destroy (cr);