diff --git a/gsk/gpu/gskgpurenderer.c b/gsk/gpu/gskgpurenderer.c index d07f2faab8..786a3c46fc 100644 --- a/gsk/gpu/gskgpurenderer.c +++ b/gsk/gpu/gskgpurenderer.c @@ -257,6 +257,7 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self, gsize x, y, size, bpp, stride; GdkMemoryFormat format; GdkMemoryDepth depth; + GdkColorState *color_state; GBytes *bytes; guchar *data; GdkTexture *texture; @@ -296,11 +297,16 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self, MIN (image_width, width - x), MIN (image_height, height - y)); + if (gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_SRGB) + color_state = GDK_COLOR_STATE_SRGB_LINEAR; + else + color_state = GDK_COLOR_STATE_SRGB; + frame = gsk_gpu_renderer_create_frame (self); gsk_gpu_frame_render (frame, g_get_monotonic_time (), image, - GDK_COLOR_STATE_SRGB, + color_state, NULL, root, &GRAPHENE_RECT_INIT (rounded_viewport->origin.x + x, @@ -340,6 +346,7 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer, GskGpuImage *image; GdkTexture *texture; graphene_rect_t rounded_viewport; + GdkColorState *color_state; gsk_gpu_device_maybe_gc (priv->device); @@ -357,13 +364,18 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer, if (image == NULL) return gsk_gpu_renderer_fallback_render_texture (self, root, &rounded_viewport); + if (gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_SRGB) + color_state = GDK_COLOR_STATE_SRGB_LINEAR; + else + color_state = GDK_COLOR_STATE_SRGB; + frame = gsk_gpu_renderer_create_frame (self); texture = NULL; gsk_gpu_frame_render (frame, g_get_monotonic_time (), image, - GDK_COLOR_STATE_SRGB, + color_state, NULL, root, &rounded_viewport,