mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
gpu: Handle SRGB in render_texture()
When GDK_MEMORY_U8_SRGB is desired by the node, and a SRGB image is created, pick SRGB_LINEAR as the colorspace to pass to frame_render().
This commit is contained in:
parent
3ba63315d5
commit
05b79bc378
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user