mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +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;
|
gsize x, y, size, bpp, stride;
|
||||||
GdkMemoryFormat format;
|
GdkMemoryFormat format;
|
||||||
GdkMemoryDepth depth;
|
GdkMemoryDepth depth;
|
||||||
|
GdkColorState *color_state;
|
||||||
GBytes *bytes;
|
GBytes *bytes;
|
||||||
guchar *data;
|
guchar *data;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
@ -296,11 +297,16 @@ gsk_gpu_renderer_fallback_render_texture (GskGpuRenderer *self,
|
|||||||
MIN (image_width, width - x),
|
MIN (image_width, width - x),
|
||||||
MIN (image_height, height - y));
|
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);
|
frame = gsk_gpu_renderer_create_frame (self);
|
||||||
gsk_gpu_frame_render (frame,
|
gsk_gpu_frame_render (frame,
|
||||||
g_get_monotonic_time (),
|
g_get_monotonic_time (),
|
||||||
image,
|
image,
|
||||||
GDK_COLOR_STATE_SRGB,
|
color_state,
|
||||||
NULL,
|
NULL,
|
||||||
root,
|
root,
|
||||||
&GRAPHENE_RECT_INIT (rounded_viewport->origin.x + x,
|
&GRAPHENE_RECT_INIT (rounded_viewport->origin.x + x,
|
||||||
@ -340,6 +346,7 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
|||||||
GskGpuImage *image;
|
GskGpuImage *image;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
graphene_rect_t rounded_viewport;
|
graphene_rect_t rounded_viewport;
|
||||||
|
GdkColorState *color_state;
|
||||||
|
|
||||||
gsk_gpu_device_maybe_gc (priv->device);
|
gsk_gpu_device_maybe_gc (priv->device);
|
||||||
|
|
||||||
@ -357,13 +364,18 @@ gsk_gpu_renderer_render_texture (GskRenderer *renderer,
|
|||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return gsk_gpu_renderer_fallback_render_texture (self, root, &rounded_viewport);
|
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);
|
frame = gsk_gpu_renderer_create_frame (self);
|
||||||
|
|
||||||
texture = NULL;
|
texture = NULL;
|
||||||
gsk_gpu_frame_render (frame,
|
gsk_gpu_frame_render (frame,
|
||||||
g_get_monotonic_time (),
|
g_get_monotonic_time (),
|
||||||
image,
|
image,
|
||||||
GDK_COLOR_STATE_SRGB,
|
color_state,
|
||||||
NULL,
|
NULL,
|
||||||
root,
|
root,
|
||||||
&rounded_viewport,
|
&rounded_viewport,
|
||||||
|
Loading…
Reference in New Issue
Block a user