[gtk/wip/otte/float-textures: 2/12] gltexture: Make release() use download_texture()




commit 6b42cc0a8755eb8ed85f8421c1264efdf8a59a24
Author: Benjamin Otte <otte redhat com>
Date:   Sun Sep 12 05:11:58 2021 +0200

    gltexture: Make release() use download_texture()
    
    1. It avoids Cairo, and in particular conversion to Cairo.
    
    2. Keeping a texture allows easy chaining in the vfuncs.
    
    3. Using a texture means releasing will work for HDR formats
       too, once we add them.

 gdk/gdkgltexture.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
---
diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c
index 9b5aa86866..ef95c4604b 100644
--- a/gdk/gdkgltexture.c
+++ b/gdk/gdkgltexture.c
@@ -216,24 +216,10 @@ gdk_gl_texture_get_id (GdkGLTexture *self)
 void
 gdk_gl_texture_release (GdkGLTexture *self)
 {
-  GdkTexture *texture = GDK_TEXTURE (self);
-  GBytes *bytes;
-  guchar *data;
-  gsize stride;
-
   g_return_if_fail (GDK_IS_GL_TEXTURE (self));
   g_return_if_fail (self->saved == NULL);
 
-  stride = texture->width * 4;
-  data = malloc (stride * texture->height);
-  gdk_texture_download (texture, data, stride);
-  bytes = g_bytes_new_take (data, stride * texture->height);
-  self->saved = gdk_memory_texture_new (texture->width,
-                                        texture->height,
-                                        GDK_MEMORY_DEFAULT,
-                                        bytes,
-                                        stride);
-  g_bytes_unref (bytes);
+  self->saved = gdk_texture_download_texture (GDK_TEXTURE (self));
 
   if (self->destroy)
     {


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