[gtk/matthiasc/color-profile-rebased: 43/47] gsk: Add color space in gsk_renderer_render_texture




commit d14809bd1bfc4f8ccac67d4992b81d5befa476c9
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon May 9 17:05:11 2022 -0400

    gsk: Add color space in gsk_renderer_render_texture
    
    Make gsk_renderer_render_texture produce a texture
    that has the correct color space attached. This
    fixes the rendering of node files in the node editor.

 gsk/gl/gskgldriver.c        | 20 ++++++++++++--------
 gsk/gl/gskgldriverprivate.h |  4 +++-
 gsk/gl/gskglrenderer.c      |  6 +++++-
 3 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index 72c3444af8..3b3cccf057 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -1542,8 +1542,10 @@ create_texture_from_texture_destroy (gpointer data)
 }
 
 GdkTexture *
-gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
-                                  guint        texture_id)
+gsk_gl_driver_create_gdk_texture (GskGLDriver       *self,
+                                  guint              texture_id,
+                                  GdkGLTextureFlags  flags,
+                                  GdkColorSpace     *color_space)
 {
   GskGLTextureState *state;
   GskGLTexture *texture;
@@ -1571,10 +1573,12 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
   texture->texture_id = 0;
   gsk_gl_texture_free (texture);
 
-  return gdk_gl_texture_new (self->command_queue->context,
-                             texture_id,
-                             width,
-                             height,
-                             create_texture_from_texture_destroy,
-                             state);
+  return gdk_gl_texture_new_with_color_space (self->command_queue->context,
+                                              texture_id,
+                                              width,
+                                              height,
+                                              flags,
+                                              color_space,
+                                              create_texture_from_texture_destroy,
+                                              state);
 }
diff --git a/gsk/gl/gskgldriverprivate.h b/gsk/gl/gskgldriverprivate.h
index accae5b3bb..e61b29018e 100644
--- a/gsk/gl/gskgldriverprivate.h
+++ b/gsk/gl/gskgldriverprivate.h
@@ -155,7 +155,9 @@ void                gsk_gl_driver_begin_frame            (GskGLDriver         *s
 void                gsk_gl_driver_end_frame              (GskGLDriver         *self);
 void                gsk_gl_driver_after_frame            (GskGLDriver         *self);
 GdkTexture        * gsk_gl_driver_create_gdk_texture     (GskGLDriver         *self,
-                                                          guint                texture_id);
+                                                          guint                texture_id,
+                                                          GdkGLTextureFlags    flags,
+                                                          GdkColorSpace       *color_space);
 void                gsk_gl_driver_cache_texture          (GskGLDriver         *self,
                                                           const GskTextureKey *key,
                                                           guint                texture_id);
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index afb34cd2f1..bb1b4bb62b 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -24,6 +24,7 @@
 #include <gdk/gdkdisplayprivate.h>
 #include <gdk/gdkglcontextprivate.h>
 #include <gdk/gdksurfaceprivate.h>
+#include <gdk/gdkcolorspaceprivate.h>
 #include <gdk/gdkintl.h>
 #include <gsk/gskdebugprivate.h>
 #include <gsk/gskrendererprivate.h>
@@ -386,7 +387,10 @@ gsk_gl_renderer_render_texture (GskRenderer           *renderer,
 #endif
       gsk_gl_render_job_render_flipped (job, root);
       texture_id = gsk_gl_driver_release_render_target (self->driver, render_target, FALSE);
-      texture = gsk_gl_driver_create_gdk_texture (self->driver, texture_id);
+      texture = gsk_gl_driver_create_gdk_texture (self->driver,
+                                                  texture_id,
+                                                  GDK_GL_TEXTURE_PREMULTIPLIED,
+                                                  gdk_color_space_get_srgb_linear ());
       gsk_gl_driver_end_frame (self->driver);
       gsk_gl_render_job_free (job);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]