[gtk/gamma-shenanigans: 8/8] Switch to downloading GdkRGBA




commit 39db04e7a8571a99b63b69f7aede17e5b905a7cd
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 8 10:29:38 2021 -0400

    Switch to downloading GdkRGBA

 gdk/gdktexture.c | 16 ++++++----------
 gdk/gdktexture.h |  4 ++--
 2 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c
index ead32c3a3b..8b885fd395 100644
--- a/gdk/gdktexture.c
+++ b/gdk/gdktexture.c
@@ -44,6 +44,7 @@
 #include "gdkmemorytextureprivate.h"
 #include "gdkpaintable.h"
 #include "gdksnapshot.h"
+#include "gdkrgba.h"
 
 #include <graphene.h>
 #include <png.h>
@@ -662,7 +663,7 @@ gdk_texture_convert_format (GdkTexture      *texture,
 }
 
 /*
- * gdk_texture_download_float:
+ * gdk_texture_download_hdr:
  * @texture: a `GdkTexture`
  * @data: (array): pointer to enough memory to be filled with the
  *   downloaded data of @texture
@@ -672,22 +673,17 @@ gdk_texture_convert_format (GdkTexture      *texture,
  * This may be an expensive operation, as the actual texture data
  * may reside on a GPU or on a remote display server.
  *
- * The data format of the downloaded data is equivalent to
- * GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED, so every downloaded
- * pixel requires 16 bytes of memory.
- *
- * Note that the caller is responsible to provide sufficiently
- * aligned memory to access the resulting data directly as floats.
+ * The data is stored in an array of `GdkRGBA` structs.
  *
  * Since: 4.6
  */
 void
-gdk_texture_download_float (GdkTexture *texture,
-                            float      *data)
+gdk_texture_download_hdr (GdkTexture *texture,
+                          GdkRGBA    *data)
 {
   GBytes *bytes;
 
-  bytes = gdk_texture_convert_format (texture, GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED);
+  bytes = gdk_texture_convert_format (texture, GDK_MEMORY_R32G32B32A32_FLOAT);
 
   g_assert (bytes);
 
diff --git a/gdk/gdktexture.h b/gdk/gdktexture.h
index 1547cce23a..067592156b 100644
--- a/gdk/gdktexture.h
+++ b/gdk/gdktexture.h
@@ -60,8 +60,8 @@ void                    gdk_texture_download                   (GdkTexture
                                                                 guchar          *data,
                                                                 gsize            stride);
 GDK_AVAILABLE_IN_4_6
-void                    gdk_texture_download_float             (GdkTexture      *texture,
-                                                                float           *data);
+void                    gdk_texture_download_hdr               (GdkTexture      *texture,
+                                                                GdkRGBA         *data);
 GDK_AVAILABLE_IN_ALL
 gboolean                gdk_texture_save_to_png                (GdkTexture      *texture,
                                                                 const char      *filename);


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