[gtk/matthiasc/color-profiles: 108/111] glarea: Use the new GL texture constructor




commit be17bf29e1a95024be8a69c798f47ba9f6006311
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 3 16:21:25 2021 -0400

    glarea: Use the new GL texture constructor
    
    This lets us avoid doing the flipping in snapshot.
    We can just tell gsk to do it for us.

 gtk/gtkglarea.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index 610ac97c4f..7de2d105b3 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -735,24 +735,19 @@ gtk_gl_area_snapshot (GtkWidget   *widget,
       priv->texture = NULL;
       priv->textures = g_list_prepend (priv->textures, texture);
 
-      texture->holder = gdk_gl_texture_new (priv->context,
-                                            texture->id,
-                                            texture->width,
-                                            texture->height,
-                                            release_texture, texture);
-
-      /* Our texture is rendered by OpenGL, so it is upside down,
-       * compared to what GSK expects, so flip it back.
-       */
-      gtk_snapshot_save (snapshot);
-      gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, gtk_widget_get_height (widget)));
-      gtk_snapshot_scale (snapshot, 1, -1);
+      texture->holder = gdk_gl_texture_new_with_color_profile (priv->context,
+                                                               texture->id,
+                                                               texture->width,
+                                                               texture->height,
+                                                               
GDK_GL_TEXTURE_PREMULTIPLIED|GDK_GL_TEXTURE_FLIPPED,
+                                                               gdk_color_profile_get_srgb (),
+                                                               release_texture, texture);
+
       gtk_snapshot_append_texture (snapshot,
                                    texture->holder,
                                    &GRAPHENE_RECT_INIT (0, 0,
                                                         gtk_widget_get_width (widget),
                                                         gtk_widget_get_height (widget)));
-      gtk_snapshot_restore (snapshot);
 
       g_object_unref (texture->holder);
     }


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