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




commit 5ca041c13720c023c237751401dc57bad4bdce95
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 af4d46ec91..d4d54c8031 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]