[gtk/modern-testsuite: 3/23] gltexture: Fallback in download_float()




commit 551f76ea69260db829c8a7891bbe541d65b1c2cf
Author: Benjamin Otte <otte redhat com>
Date:   Thu Sep 16 23:30:37 2021 +0200

    gltexture: Fallback in download_float()
    
    GLES only allows downloading float if the texture matches specific
    criteria and I'm too lazy to determine them, so always fall back.
    
    And the custom stride fallback code isn't necessary, because falling
    back does exactly that step already.

 gdk/gdkgltexture.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
---
diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c
index 80cfb26b7f..e2e292964d 100644
--- a/gdk/gdkgltexture.c
+++ b/gdk/gdkgltexture.c
@@ -302,8 +302,6 @@ gdk_gl_texture_download_float (GdkTexture *texture,
                                gsize       stride)
 {
   GdkGLTexture *self = GDK_GL_TEXTURE (texture);
-  int width, height, y;
-  float *copy;
 
   if (self->saved)
     {
@@ -311,22 +309,14 @@ gdk_gl_texture_download_float (GdkTexture *texture,
       return;
     }
 
-  width = gdk_texture_get_width (texture);
-  height = gdk_texture_get_height (texture);
-
-  if (stride == width * 4)
+  if (gdk_gl_context_get_use_es (self->context) ||
+      stride != texture->width * 4)
     {
-      gdk_gl_texture_run (self, gdk_gl_texture_do_download_float, data);
+      GDK_TEXTURE_CLASS (gdk_gl_texture_parent_class)->download_float (texture, data, stride);
       return;
     }
 
-  copy = g_new (float, width * height * 4);
-
-  gdk_gl_texture_run (self, gdk_gl_texture_do_download_float, copy);
-  for (y = 0; y < height; y++)
-    memcpy (data + y * stride, copy + y * 4 * width, 4 * width);
-
-  g_free (copy);
+  gdk_gl_texture_run (self, gdk_gl_texture_do_download_float, data);
 }
 
 static void


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