[gtk/matthiasc/color-profile-rebased: 40/47] glarea: Use the new GL texture constructor




commit f048b18972d4c3158e2741ffb2a3bd230c5b2927
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun May 8 14:56:55 2022 -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 1806021be3..99c26c3953 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_space (priv->context,
+                                                             texture->id,
+                                                             texture->width,
+                                                             texture->height,
+                                                             
GDK_GL_TEXTURE_PREMULTIPLIED|GDK_GL_TEXTURE_FLIPPED,
+                                                             gdk_color_space_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]